ReactOS  0.4.14-dev-384-g5b37caa
joy.c
Go to the documentation of this file.
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 along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 /*
20  *
21  * PROJECT: ReactOS Software Control Panel
22  * FILE: dll/cpl/joy/joy.c
23  * PURPOSE: ReactOS Software Control Panel
24  * PROGRAMMER: Dmitry Chapyshev (lentind@yandex.ru)
25  * UPDATE HISTORY:
26  * 10-18-2007 Created
27  */
28 
29 #include "joy.h"
30 
31 #define NUM_APPLETS (1)
32 
36 
37 /* Applets */
38 
40 {
42 };
43 
44 VOID
46 {
48  RECT rect;
49  int Size;
50  TCHAR szBuf[256];
51 
53  Size = rect.right - rect.left - 250;
54 
55  LoadString(hApplet, IDS_STATUS, szBuf, sizeof(szBuf) / sizeof(TCHAR));
56 
57  ZeroMemory(&dummy, sizeof(LV_COLUMN));
59  dummy.iSubItem = 0;
60  dummy.pszText = (LPTSTR)szBuf;
61  dummy.cx = Size;
63 
65 
66  LoadString(hApplet, IDS_CONTROLLER, szBuf, sizeof(szBuf) / sizeof(TCHAR));
67 
68  ZeroMemory(&dummy, sizeof(LV_COLUMN));
70  dummy.iSubItem = 0;
71  dummy.pszText = (LPTSTR)szBuf;
72  dummy.cx = rect.right - rect.left - Size;
74 }
75 
78 {
80 
81  switch (uMsg)
82  {
83  case WM_INITDIALOG:
84  break;
85 
86  case WM_COMMAND:
87  switch (LOWORD(wParam))
88  {
89  case IDOK:
90  EndDialog(hwndDlg,LOWORD(wParam));
91  break;
92 
93  case IDCANCEL:
94  EndDialog(hwndDlg,LOWORD(wParam));
95  break;
96  }
97  break;
98 
99  case WM_NOTIFY:
100  break;
101 
102  case WM_SYSCOMMAND:
103  switch (LOWORD(wParam))
104  {
105  case SC_CONTEXTHELP:
106  // Not implemented yet
107  break;
108  }
109  break;
110  }
111  return 0;
112 }
113 
116 {
118 
119  switch (uMsg)
120  {
121  case WM_INITDIALOG:
122  break;
123 
124  case WM_COMMAND:
125  switch (LOWORD(wParam))
126  {
127  case IDOK:
128  EndDialog(hwndDlg,LOWORD(wParam));
129  break;
130 
131  case IDCANCEL:
132  EndDialog(hwndDlg,LOWORD(wParam));
133  break;
134  }
135  break;
136 
137  case WM_NOTIFY:
138  break;
139 
140  case WM_SYSCOMMAND:
141  switch (LOWORD(wParam))
142  {
143  case SC_CONTEXTHELP:
144  // Not implemented yet
145  break;
146  }
147  break;
148  }
149  return 0;
150 }
151 
154 {
156 
157  switch (uMsg)
158  {
159  case WM_INITDIALOG:
160  break;
161 
162  case WM_COMMAND:
163  switch (LOWORD(wParam))
164  {
165  case IDC_CUSTOM_BUTTON:
168  hwndDlg,
170  break;
171 
172  case IDOK:
173  EndDialog(hwndDlg,LOWORD(wParam));
174  break;
175 
176  case IDCANCEL:
177  EndDialog(hwndDlg,LOWORD(wParam));
178  break;
179  }
180  break;
181 
182  case WM_NOTIFY:
183  break;
184 
185  case WM_SYSCOMMAND:
186  switch (LOWORD(wParam))
187  {
188  case SC_CONTEXTHELP:
189  // Not implemented yet
190  break;
191  }
192  break;
193  }
194  return 0;
195 }
196 
197 /* Property page dialog callback */
200 {
201  static HICON s_hIcon = NULL, s_hIconSm = NULL;
203 
204  switch (uMsg)
205  {
206  case WM_INITDIALOG:
210  IMAGE_ICON,
213  SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)s_hIcon);
214  SendMessageW(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)s_hIconSm);
215  break;
216 
217  case WM_COMMAND:
218  switch (LOWORD(wParam))
219  {
220  case IDC_ADD_BUTTON:
223  hwndDlg,
224  AddPageProc);
225  break;
226 
227  case IDC_ADVANCED_BUTTON:
230  hwndDlg,
232  break;
233 
234  case IDOK:
235  DestroyIcon(s_hIcon);
236  DestroyIcon(s_hIconSm);
237  EndDialog(hwndDlg,LOWORD(wParam));
238  break;
239  }
240  break;
241 
242  case WM_NOTIFY:
243  break;
244 
245  case WM_SYSCOMMAND:
246  switch (LOWORD(wParam))
247  {
248  case SC_CLOSE:
249  DestroyIcon(s_hIcon);
250  DestroyIcon(s_hIconSm);
251  EndDialog(hwndDlg,LOWORD(wParam));
252  break;
253 
254  case SC_CONTEXTHELP:
255  // Not implemented yet
256  break;
257  }
258  break;
259  }
260  return 0;
261 }
262 
263 /* First Applet */
266 {
269  MainDlg,
270  MainPageProc);
271 
272  return (LONG)TRUE;
273 }
274 
275 /* Control Panel Callback */
277 CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
278 {
279  CPLINFO *CPlInfo;
280  DWORD i;
281 
282  UNREFERENCED_PARAMETER(hwndCPl);
283 
284  i = (DWORD)lParam1;
285  switch (uMsg)
286  {
287  case CPL_INIT:
288  return TRUE;
289 
290  case CPL_GETCOUNT:
291  return NUM_APPLETS;
292 
293  case CPL_INQUIRE:
294  CPlInfo = (CPLINFO*)lParam2;
295  CPlInfo->lData = 0;
296  CPlInfo->idIcon = Applets[i].idIcon;
297  CPlInfo->idName = Applets[i].idName;
298  CPlInfo->idInfo = Applets[i].idDescription;
299  break;
300 
301  case CPL_DBLCLK:
302  {
303  MainDlg = hwndCPl;
304  Applets[i].AppletProc();
305  }
306  break;
307  }
308 
309  return FALSE;
310 }
311 
312 BOOL WINAPI
314 {
316 
317  switch (dwReason)
318  {
319  case DLL_PROCESS_ATTACH:
320  case DLL_THREAD_ATTACH:
322  hApplet = hinstDLL;
323  break;
324  }
325 
326  return TRUE;
327 }
#define IDC_CONTROLLER_LIST
Definition: resource.h:19
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IMAGE_ICON
Definition: winuser.h:212
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVCF_WIDTH
Definition: commctrl.h:2583
HINSTANCE hApplet
Definition: joy.c:34
Definition: cpl.h:24
LONG CALLBACK SystemApplet(VOID)
Definition: joy.c:265
#define IDS_STATUS
Definition: resource.h:22
#define LVCF_TEXT
Definition: commctrl.h:2584
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define DLL_THREAD_ATTACH
Definition: compat.h:121
#define IDC_ADVANCED_BUTTON
Definition: resource.h:23
#define IDI_CPLSYSTEM
Definition: resource.h:4
#define IDC_ADD_BUTTON
Definition: resource.h:22
#define LV_COLUMN
Definition: commctrl.h:2543
int idName
Definition: hotplug.h:27
int idIcon
Definition: hotplug.h:26
#define CALLBACK
Definition: compat.h:27
int idInfo
Definition: cpl.h:27
#define IDD_ADD
Definition: resource.h:16
#define ZeroMemory
Definition: winbase.h:1642
#define SM_CYSMICON
Definition: winuser.h:1003
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT_PTR
Definition: typedefs.h:62
#define DWORD
Definition: nt_native.h:44
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
Definition: joy.c:313
CHAR * LPTSTR
Definition: xmlstorage.h:192
static IN DWORD IN LPVOID lpvReserved
VOID AddColumns(HWND hList)
Definition: joy.c:45
int idIcon
Definition: cpl.h:25
#define ICON_SMALL
Definition: tnclass.cpp:48
int idDescription
Definition: hotplug.h:28
#define CPL_DBLCLK
Definition: cpl.h:16
#define LVCF_SUBITEM
Definition: commctrl.h:2585
DWORD dwReason
Definition: misc.cpp:154
#define DialogBox
Definition: winuser.h:5662
HWND MainDlg
Definition: joy.c:35
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2632
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
long LONG
Definition: pedump.c:60
#define SC_CONTEXTHELP
Definition: winuser.h:2579
smooth NULL
Definition: ftsmooth.c:416
INT_PTR CALLBACK MainPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: joy.c:199
LONG_PTR LPARAM
Definition: windef.h:208
#define NUM_APPLETS
Definition: joy.c:31
#define IDS_CPLSYSTEMNAME
Definition: resource.h:23
char TCHAR
Definition: xmlstorage.h:189
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
INT_PTR CALLBACK AddPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: joy.c:153
#define IDD_CUSTOM
Definition: resource.h:9
APPLET_PROC AppletProc
Definition: hotplug.h:29
#define WINAPI
Definition: msvc.h:8
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDD_PROPPAGEMAIN
Definition: resource.h:7
#define CPL_INIT
Definition: cpl.h:12
#define SM_CXSMICON
Definition: winuser.h:1002
#define CPL_INQUIRE
Definition: cpl.h:14
LONG_PTR lData
Definition: cpl.h:28
#define WM_COMMAND
Definition: winuser.h:1722
int idName
Definition: cpl.h:26
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
HWND hList
Definition: livecd.c:10
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
unsigned char dummy
Definition: maze.c:118
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDS_CPLSYSTEMDESCRIPTION
Definition: resource.h:24
unsigned int UINT
Definition: ndis.h:50
LONG CALLBACK CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
Definition: joy.c:277
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
#define SC_CLOSE
Definition: winuser.h:2567
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
INT_PTR CALLBACK CustomPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: joy.c:115
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR CALLBACK AdvancedPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: joy.c:77
#define IDCANCEL
Definition: winuser.h:825
APPLET Applets[NUM_APPLETS]
Definition: joy.c:39
#define IDD_ADVANCED
Definition: resource.h:10
#define WM_SYSCOMMAND
Definition: winuser.h:1723
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define CPL_GETCOUNT
Definition: cpl.h:13
#define LoadString
Definition: winuser.h:5720
#define IDC_CUSTOM_BUTTON
Definition: resource.h:25
#define WM_NOTIFY
Definition: richedit.h:61
#define ICON_BIG
Definition: tnclass.cpp:51
Definition: hotplug.h:24
#define IDS_CONTROLLER
Definition: resource.h:15