Updated French translations for input and winemine
[reactos.git] / reactos / dll / cpl / input / input.c
1 /*
2 * ReactOS
3 * Copyright (C) 2007 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 /*
20 *
21 * PROJECT: input.dll
22 * FILE: dll/win32/input/input.c
23 * PURPOSE: input.dll
24 * PROGRAMMER: Dmitry Chapyshev (lentind@yandex.ru)
25 * UPDATE HISTORY:
26 * 06-09-2007 Created
27 */
28
29 #include <windows.h>
30 #include <commctrl.h>
31 #include <cpl.h>
32
33 #include <stdlib.h>
34 #include <stdio.h>
35 #include <stdarg.h>
36 #include <tchar.h>
37 #include <process.h>
38
39 #include "resource.h"
40 #include "input.h"
41
42 #define NUM_APPLETS (1)
43
44 LONG CALLBACK SystemApplet(VOID);
45 HINSTANCE hApplet = 0;
46
47 /* Applets */
48 APPLET Applets[NUM_APPLETS] =
49 {
50 {IDI_CPLSYSTEM, IDS_CPLSYSTEMNAME, IDS_CPLSYSTEMDESCRIPTION, SystemApplet}
51 };
52
53
54 VOID
55 InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
56 {
57 ZeroMemory(psp, sizeof(PROPSHEETPAGE));
58 psp->dwSize = sizeof(PROPSHEETPAGE);
59 psp->dwFlags = PSP_DEFAULT;
60 psp->hInstance = hApplet;
61 psp->pszTemplate = MAKEINTRESOURCE(idDlg);
62 psp->pfnDlgProc = DlgProc;
63 }
64
65
66 /* First Applet */
67
68 LONG CALLBACK
69 SystemApplet(VOID)
70 {
71 PROPSHEETPAGE psp[2];
72 PROPSHEETHEADER psh;
73 TCHAR Caption[1024];
74
75 LoadString(hApplet, IDS_CPLSYSTEMNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
76
77 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
78 psh.dwSize = sizeof(PROPSHEETHEADER);
79 psh.dwFlags = PSH_PROPSHEETPAGE;
80 psh.hwndParent = NULL;
81 psh.hInstance = hApplet;
82 psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
83 psh.pszCaption = Caption;
84 psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
85 psh.nStartPage = 0;
86 psh.ppsp = psp;
87 psh.pfnCallback = NULL;
88
89 InitPropSheetPage(&psp[0], IDD_PROPPAGESETTINGS, (DLGPROC) SettingPageProc);
90 InitPropSheetPage(&psp[1], IDD_PROPPAGEADVANCED, (DLGPROC) AdvancedPageProc);
91
92 return (LONG)(PropertySheet(&psh) != -1);
93 }
94
95
96 /* Control Panel Callback */
97 LONG CALLBACK
98 CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
99 {
100 CPLINFO *CPlInfo;
101 DWORD i;
102
103 UNREFERENCED_PARAMETER(hwndCPl);
104
105 i = (DWORD)lParam1;
106 switch (uMsg)
107 {
108 case CPL_INIT:
109 return TRUE;
110
111 case CPL_GETCOUNT:
112 return NUM_APPLETS;
113
114 case CPL_INQUIRE:
115 CPlInfo = (CPLINFO*)lParam2;
116 CPlInfo->lData = 0;
117 CPlInfo->idIcon = Applets[i].idIcon;
118 CPlInfo->idName = Applets[i].idName;
119 CPlInfo->idInfo = Applets[i].idDescription;
120 break;
121
122 case CPL_DBLCLK:
123 Applets[i].AppletProc();
124 break;
125 }
126
127 return FALSE;
128 }
129
130
131 BOOL WINAPI
132 DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
133 {
134 UNREFERENCED_PARAMETER(lpvReserved);
135
136 switch (dwReason)
137 {
138 case DLL_PROCESS_ATTACH:
139 case DLL_THREAD_ATTACH:
140 hApplet = hinstDLL;
141 break;
142 }
143
144 return TRUE;
145 }
146
147 /* EOF */