German RC-File for sysdm and timedate and a few change in the Englich RC-File. Patch...
[reactos.git] / reactos / lib / cpl / timedate / timedate.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: timedate.c,v 1.1 2004/10/30 19:15:31 ekohl Exp $
20 *
21 * PROJECT: ReactOS Timedate Control Panel
22 * FILE: lib/cpl/timedate/timedate.c
23 * PURPOSE: ReactOS Timedate Control Panel
24 * PROGRAMMER: Eric Kohl
25 */
26
27 #include <windows.h>
28 #include <commctrl.h>
29 #include <cpl.h>
30
31 #include "resource.h"
32 #include "timedate.h"
33
34
35 #define NUM_APPLETS (1)
36
37 LONG APIENTRY
38 Applet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
39
40
41 HINSTANCE hApplet = 0;
42
43
44 /* Applets */
45 APPLET Applets[NUM_APPLETS] =
46 {
47 {IDC_CPLICON, IDS_CPLNAME, IDS_CPLDESCRIPTION, Applet}
48 };
49
50
51 /* Property page dialog callback */
52 INT_PTR CALLBACK
53 DateTimePageProc(HWND hwndDlg,
54 UINT uMsg,
55 WPARAM wParam,
56 LPARAM lParam)
57 {
58 switch (uMsg)
59 {
60 case WM_INITDIALOG:
61 break;
62 }
63
64 return FALSE;
65 }
66
67
68 /* Property page dialog callback */
69 INT_PTR CALLBACK
70 TimeZonePageProc(HWND hwndDlg,
71 UINT uMsg,
72 WPARAM wParam,
73 LPARAM lParam)
74 {
75 switch (uMsg)
76 {
77 case WM_INITDIALOG:
78 break;
79 }
80
81 return FALSE;
82 }
83
84
85 static VOID
86 InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
87 {
88 ZeroMemory(psp, sizeof(PROPSHEETPAGE));
89 psp->dwSize = sizeof(PROPSHEETPAGE);
90 psp->dwFlags = PSP_DEFAULT;
91 psp->hInstance = hApplet;
92 psp->pszTemplate = MAKEINTRESOURCE(idDlg);
93 psp->pfnDlgProc = DlgProc;
94 }
95
96
97 LONG APIENTRY
98 Applet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
99 {
100 PROPSHEETHEADER psh;
101 PROPSHEETPAGE psp[3];
102 TCHAR Caption[256];
103
104 LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
105
106 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
107 psh.dwSize = sizeof(PROPSHEETHEADER);
108 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
109 psh.hwndParent = NULL;
110 psh.hInstance = hApplet;
111 psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
112 psh.pszCaption = Caption;
113 psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
114 psh.nStartPage = 0;
115 psh.ppsp = psp;
116
117 InitPropSheetPage(&psp[0], IDD_DATETIMEPAGE, DateTimePageProc);
118 InitPropSheetPage(&psp[1], IDD_TIMEZONEPAGE, TimeZonePageProc);
119
120 return (LONG)(PropertySheet(&psh) != -1);
121 }
122
123
124 /* Control Panel Callback */
125 LONG CALLBACK
126 CPlApplet(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 return TRUE;
137
138 case CPL_GETCOUNT:
139 return NUM_APPLETS;
140
141 case CPL_INQUIRE:
142 {
143 CPLINFO *CPlInfo = (CPLINFO*)lParam2;
144 CPlInfo->lData = 0;
145 CPlInfo->idIcon = Applets[i].idIcon;
146 CPlInfo->idName = Applets[i].idName;
147 CPlInfo->idInfo = Applets[i].idDescription;
148 break;
149 }
150
151 case CPL_DBLCLK:
152 {
153 Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
154 break;
155 }
156 }
157 return FALSE;
158 }
159
160
161 BOOL STDCALL
162 DllMain(HINSTANCE hinstDLL,
163 DWORD dwReason,
164 LPVOID lpReserved)
165 {
166 switch (dwReason)
167 {
168 case DLL_PROCESS_ATTACH:
169 case DLL_THREAD_ATTACH:
170 hApplet = hinstDLL;
171 break;
172 }
173
174 return TRUE;
175 }
176
177 /* EOF */