move more dlls
[reactos.git] / reactos / lib / cpl / sysdm / sysdm.c
1 /*
2 * ReactOS
3 * Copyright (C) 2004 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /* $Id$
20 *
21 * PROJECT: ReactOS System Control Panel
22 * FILE: lib/cpl/system/sysdm.c
23 * PURPOSE: ReactOS System Control Panel
24 * PROGRAMMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
25 * UPDATE HISTORY:
26 * 03-04-2004 Created
27 */
28 #include <windows.h>
29 #include <commctrl.h>
30 #include <prsht.h>
31 #include <cpl.h>
32 #include <stdlib.h>
33
34 #include "resource.h"
35 #include "sysdm.h"
36
37 #define NUM_APPLETS (1)
38
39 LONG CALLBACK SystemApplet(VOID);
40 HINSTANCE hApplet = 0;
41
42 /* Applets */
43 APPLET Applets[NUM_APPLETS] =
44 {
45 {IDI_CPLSYSTEM, IDS_CPLSYSTEMNAME, IDS_CPLSYSTEMDESCRIPTION, SystemApplet}
46 };
47
48 static void
49 InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
50 {
51 ZeroMemory(psp, sizeof(PROPSHEETPAGE));
52 psp->dwSize = sizeof(PROPSHEETPAGE);
53 psp->dwFlags = PSP_DEFAULT;
54 psp->hInstance = hApplet;
55 psp->pszTemplate = MAKEINTRESOURCE(idDlg);
56 psp->pfnDlgProc = DlgProc;
57 }
58
59 /* Property Sheet Callback */
60 int CALLBACK
61 PropSheetProc(
62 HWND hwndDlg,
63 UINT uMsg,
64 LPARAM lParam
65 )
66 {
67 switch(uMsg)
68 {
69 case PSCB_BUTTONPRESSED:
70 switch(lParam)
71 {
72 case PSBTN_OK: /* OK */
73 break;
74 case PSBTN_CANCEL: /* Cancel */
75 break;
76 case PSBTN_APPLYNOW: /* Apply now */
77 break;
78 case PSBTN_FINISH: /* Close */
79 break;
80 default:
81 return FALSE;
82 }
83 break;
84
85 case PSCB_INITIALIZED:
86 break;
87 }
88 return TRUE;
89 }
90
91 /* First Applet */
92
93 LONG CALLBACK
94 SystemApplet(VOID)
95 {
96 PROPSHEETPAGE psp[5];
97 PROPSHEETHEADER psh;
98 TCHAR Caption[1024];
99
100 LoadString(hApplet, IDS_CPLSYSTEMNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
101
102 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
103 psh.dwSize = sizeof(PROPSHEETHEADER);
104 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE; /* | PSH_USECALLBACK */
105 psh.hwndParent = NULL;
106 psh.hInstance = hApplet;
107 psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
108 psh.pszCaption = Caption;
109 psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
110 psh.nStartPage = 0;
111 psh.ppsp = psp;
112 psh.pfnCallback = NULL; /* PropSheetProc; */
113
114 InitPropSheetPage(&psp[0], IDD_PROPPAGEGENERAL, GeneralPageProc);
115 InitPropSheetPage(&psp[1], IDD_PROPPAGECOMPUTER, ComputerPageProc);
116 InitPropSheetPage(&psp[2], IDD_PROPPAGEHARDWARE, HardwarePageProc);
117 InitPropSheetPage(&psp[3], IDD_PROPPAGEUSERPROFILE, UserProfilePageProc);
118 InitPropSheetPage(&psp[4], IDD_PROPPAGEADVANCED, AdvancedPageProc);
119
120 return (LONG)(PropertySheet(&psh) != -1);
121 }
122
123 /* Control Panel Callback */
124 LONG CALLBACK
125 CPlApplet(
126 HWND hwndCPl,
127 UINT uMsg,
128 LPARAM lParam1,
129 LPARAM lParam2)
130 {
131 int i = (int)lParam1;
132
133 switch(uMsg)
134 {
135 case CPL_INIT:
136 {
137 return TRUE;
138 }
139 case CPL_GETCOUNT:
140 {
141 return NUM_APPLETS;
142 }
143 case CPL_INQUIRE:
144 {
145 CPLINFO *CPlInfo = (CPLINFO*)lParam2;
146 CPlInfo->lData = 0;
147 CPlInfo->idIcon = Applets[i].idIcon;
148 CPlInfo->idName = Applets[i].idName;
149 CPlInfo->idInfo = Applets[i].idDescription;
150 break;
151 }
152 case CPL_DBLCLK:
153 {
154 Applets[i].AppletProc();
155 break;
156 }
157 }
158 return FALSE;
159 }
160
161
162 BOOL STDCALL
163 DllMain(
164 HINSTANCE hinstDLL,
165 DWORD dwReason,
166 LPVOID lpvReserved)
167 {
168 switch(dwReason)
169 {
170 case DLL_PROCESS_ATTACH:
171 case DLL_THREAD_ATTACH:
172 hApplet = hinstDLL;
173 break;
174 }
175 return TRUE;
176 }
177