german translation update
[reactos.git] / reactos / dll / cpl / access / access.c
1 /* $Id$
2 *
3 * PROJECT: ReactOS System Control Panel
4 * LICENSE: GPL - See COPYING in the top level directory
5 * FILE: lib/cpl/system/sysdm.c
6 * PURPOSE: ReactOS System Control Panel
7 * COPYRIGHT: Copyright 2004 Johannes Anderwald (j_anderw@sbox.tugraz.at)
8 * UPDATE HISTORY:
9 * 03-04-2004 Created
10 */
11 #include <windows.h>
12 #include <commctrl.h>
13 #include <cpl.h>
14
15 #include <stdlib.h>
16
17 #include "resource.h"
18 #include "access.h"
19
20 #define NUM_APPLETS (1)
21
22 LONG CALLBACK SystemApplet(VOID);
23 INT_PTR CALLBACK DisplayPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
24 INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
25 INT_PTR CALLBACK KeyboardPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
26 INT_PTR CALLBACK MousePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
27 INT_PTR CALLBACK SoundPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
28 HINSTANCE hApplet = 0;
29
30 /* Applets */
31 APPLET Applets[NUM_APPLETS] =
32 {
33 {IDI_CPLACCESS, IDS_CPLSYSTEMNAME, IDS_CPLSYSTEMDESCRIPTION, SystemApplet}
34 };
35
36 static void
37 InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
38 {
39 ZeroMemory(psp, sizeof(PROPSHEETPAGE));
40 psp->dwSize = sizeof(PROPSHEETPAGE);
41 psp->dwFlags = PSP_DEFAULT;
42 psp->hInstance = hApplet;
43 psp->pszTemplate = MAKEINTRESOURCE(idDlg);
44 psp->pfnDlgProc = DlgProc;
45 }
46
47 /* Property Sheet Callback */
48 int CALLBACK
49 PropSheetProc(
50 HWND hwndDlg,
51 UINT uMsg,
52 LPARAM lParam
53 )
54 {
55 switch(uMsg)
56 {
57 case PSCB_BUTTONPRESSED:
58 switch(lParam)
59 {
60 case PSBTN_OK: /* OK */
61 break;
62 case PSBTN_CANCEL: /* Cancel */
63 break;
64 case PSBTN_APPLYNOW: /* Apply now */
65 break;
66 case PSBTN_FINISH: /* Close */
67 break;
68 default:
69 return FALSE;
70 }
71 break;
72
73 case PSCB_INITIALIZED:
74 break;
75 }
76 return TRUE;
77 }
78
79 /* First Applet */
80
81 LONG CALLBACK
82 SystemApplet(VOID)
83 {
84 PROPSHEETPAGE psp[5];
85 PROPSHEETHEADER psh;
86 TCHAR Caption[1024];
87
88 LoadString(hApplet, IDS_CPLSYSTEMNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
89
90 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
91 psh.dwSize = sizeof(PROPSHEETHEADER);
92 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK | PSH_PROPTITLE;
93 psh.hwndParent = NULL;
94 psh.hInstance = hApplet;
95 psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLACCESS));
96 psh.pszCaption = Caption;
97 psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
98 psh.nStartPage = 0;
99 psh.ppsp = psp;
100 psh.pfnCallback = PropSheetProc;
101
102 InitPropSheetPage(&psp[0], IDD_PROPPAGEKEYBOARD, KeyboardPageProc);
103 InitPropSheetPage(&psp[1], IDD_PROPPAGESOUND, SoundPageProc);
104 InitPropSheetPage(&psp[2], IDD_PROPPAGEDISPLAY, DisplayPageProc);
105 InitPropSheetPage(&psp[3], IDD_PROPPAGEMOUSE, MousePageProc);
106 InitPropSheetPage(&psp[4], IDD_PROPPAGEGENERAL, GeneralPageProc);
107
108 return (LONG)(PropertySheet(&psh) != -1);
109 }
110
111 /* Control Panel Callback */
112 LONG CALLBACK
113 CPlApplet(
114 HWND hwndCPl,
115 UINT uMsg,
116 LPARAM lParam1,
117 LPARAM lParam2)
118 {
119 int i = (int)lParam1;
120
121 switch(uMsg)
122 {
123 case CPL_INIT:
124 {
125 return TRUE;
126 }
127 case CPL_GETCOUNT:
128 {
129 return NUM_APPLETS;
130 }
131 case CPL_INQUIRE:
132 {
133 CPLINFO *CPlInfo = (CPLINFO*)lParam2;
134 CPlInfo->lData = 0;
135 CPlInfo->idIcon = Applets[i].idIcon;
136 CPlInfo->idName = Applets[i].idName;
137 CPlInfo->idInfo = Applets[i].idDescription;
138 break;
139 }
140 case CPL_DBLCLK:
141 {
142 Applets[i].AppletProc();
143 break;
144 }
145 }
146 return FALSE;
147 }
148
149
150 BOOL STDCALL
151 DllMain(
152 HINSTANCE hinstDLL,
153 DWORD dwReason,
154 LPVOID lpvReserved)
155 {
156 switch(dwReason)
157 {
158 case DLL_PROCESS_ATTACH:
159 case DLL_THREAD_ATTACH:
160 hApplet = hinstDLL;
161 break;
162 }
163 return TRUE;
164 }
165