ReactOS  0.4.14-dev-1007-g90d795b
display.c File Reference
#include "access.h"
#include <wingdi.h>
Include dependency graph for display.c:

Go to the source code of this file.

Macros

#define ID_BLINK_TIMER   346
 

Functions

static VOID FillColorSchemeComboBox (HWND hwnd)
 
INT_PTR CALLBACK HighContrastDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK DisplayPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Macro Definition Documentation

◆ ID_BLINK_TIMER

#define ID_BLINK_TIMER   346

Definition at line 14 of file display.c.

Function Documentation

◆ DisplayPageProc()

INT_PTR CALLBACK DisplayPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 127 of file display.c.

131 {
132  PGLOBAL_DATA pGlobalData;
133  LPPSHNOTIFY lppsn;
134  INT i;
135 
136  pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
137 
138  switch (uMsg)
139  {
140  case WM_INITDIALOG:
141  pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
142  if (pGlobalData == NULL)
143  return FALSE;
144 
145  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
146 
147  pGlobalData->fShowCaret = TRUE;
148  GetWindowRect(GetDlgItem(hwndDlg, IDC_CURSOR_WIDTH_TEXT), &pGlobalData->rcCaret);
149  ScreenToClient(hwndDlg, (LPPOINT)&pGlobalData->rcCaret.left);
150  ScreenToClient(hwndDlg, (LPPOINT)&pGlobalData->rcCaret.right);
151  CopyRect(&pGlobalData->rcOldCaret, &pGlobalData->rcCaret);
152 
153  pGlobalData->rcCaret.right = pGlobalData->rcCaret.left + pGlobalData->uCaretWidth;
154 
155  /* Set the checkbox */
156  CheckDlgButton(hwndDlg,
159 
161  SendDlgItemMessage(hwndDlg, IDC_CURSOR_BLINK_TRACK, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(12 - (pGlobalData->uCaretBlinkTime / 100)));
162 
165 
166  /* Start the blink timer */
167  SetTimer(hwndDlg, ID_BLINK_TIMER, pGlobalData->uCaretBlinkTime, NULL);
168  return TRUE;
169 
170  case WM_COMMAND:
171  switch (LOWORD(wParam))
172  {
173  case IDC_CONTRAST_BOX:
174  pGlobalData->highContrast.dwFlags ^= HCF_HIGHCONTRASTON;
175  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
176  break;
177 
178  case IDC_CONTRAST_BUTTON:
181  hwndDlg,
183  (LPARAM)pGlobalData))
184  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
185  break;
186 
187  default:
188  break;
189  }
190  break;
191 
192  case WM_HSCROLL:
193  switch (GetWindowLongPtr((HWND) lParam, GWL_ID))
194  {
197  pGlobalData->uCaretBlinkTime = (12 - (UINT)i) * 100;
198  KillTimer(hwndDlg, ID_BLINK_TIMER);
199  SetTimer(hwndDlg, ID_BLINK_TIMER, pGlobalData->uCaretBlinkTime, NULL);
200  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
201  break;
202 
205  pGlobalData->uCaretWidth = (UINT)i + 1;
206  pGlobalData->rcCaret.right = pGlobalData->rcCaret.left + pGlobalData->uCaretWidth;
207  if (pGlobalData->fShowCaret)
208  {
209  HDC hDC = GetDC(hwndDlg);
210  HBRUSH hBrush = GetSysColorBrush(COLOR_BTNTEXT);
211  FillRect(hDC, &pGlobalData->rcCaret, hBrush);
212  DeleteObject(hBrush);
213  ReleaseDC(hwndDlg, hDC);
214  }
215  else
216  {
217  InvalidateRect(hwndDlg, &pGlobalData->rcOldCaret, TRUE);
218  }
219  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
220  break;
221  }
222  break;
223 
224  case WM_TIMER:
225  if (wParam == ID_BLINK_TIMER)
226  {
227  if (pGlobalData->fShowCaret)
228  {
229  HDC hDC = GetDC(hwndDlg);
230  HBRUSH hBrush = GetSysColorBrush(COLOR_BTNTEXT);
231  FillRect(hDC, &pGlobalData->rcCaret, hBrush);
232  DeleteObject(hBrush);
233  ReleaseDC(hwndDlg, hDC);
234  }
235  else
236  {
237  InvalidateRect(hwndDlg, &pGlobalData->rcOldCaret, TRUE);
238  }
239 
240  pGlobalData->fShowCaret = !pGlobalData->fShowCaret;
241  }
242  break;
243 
244  case WM_NOTIFY:
245  lppsn = (LPPSHNOTIFY)lParam;
246  if (lppsn->hdr.code == PSN_APPLY)
247  {
248  SetCaretBlinkTime(pGlobalData->uCaretBlinkTime);
249  SystemParametersInfo(SPI_SETCARETWIDTH,
250  0,
251  IntToPtr(pGlobalData->uCaretWidth),
253  SystemParametersInfo(SPI_SETHIGHCONTRAST,
254  sizeof(HIGHCONTRAST),
255  &pGlobalData->highContrast,
257  return TRUE;
258  }
259  break;
260 
261  case WM_DESTROY:
262  KillTimer(hwndDlg, ID_BLINK_TIMER);
263  break;
264  }
265 
266  return FALSE;
267 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define TRUE
Definition: types.h:120
struct _PSHNOTIFY * LPPSHNOTIFY
HDC WINAPI GetDC(_In_opt_ HWND)
#define GWL_ID
Definition: winuser.h:853
static HDC
Definition: imagelist.c:92
#define TBM_SETRANGE
Definition: commctrl.h:2033
#define SystemParametersInfo
Definition: winuser.h:5833
#define IDC_CONTRAST_BUTTON
Definition: resource.h:48
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define TBM_SETPOS
Definition: commctrl.h:2032
HINSTANCE hApplet
Definition: access.c:17
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5817
#define PSN_APPLY
Definition: prsht.h:117
LONG left
Definition: windef.h:306
#define IDC_CONTRAST_BOX
Definition: resource.h:47
RECT rcCaret
Definition: access.h:46
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:57
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
UINT code
Definition: winuser.h:3134
#define HCF_HIGHCONTRASTON
Definition: winuser.h:2116
NMHDR hdr
Definition: prsht.h:330
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 TBM_GETPOS
Definition: commctrl.h:2027
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define LPPROPSHEETPAGE
Definition: prsht.h:390
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_DESTROY
Definition: winuser.h:1591
#define IntToPtr(i)
Definition: basetsd.h:89
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define WM_TIMER
Definition: winuser.h:1724
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define DialogBoxParam
Definition: winuser.h:5739
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define IDC_CURSOR_BLINK_TRACK
Definition: resource.h:89
BOOL fShowCaret
Definition: access.h:45
#define DWLP_USER
Definition: winuser.h:866
INT_PTR CALLBACK HighContrastDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: display.c:59
#define WM_COMMAND
Definition: winuser.h:1722
#define BST_UNCHECKED
Definition: winuser.h:199
RECT rcOldCaret
Definition: access.h:47
#define IDD_CONTRASTOPTIONS
Definition: resource.h:18
static HDC hDC
Definition: 3dtext.c:33
#define IDC_CURSOR_WIDTH_TRACK
Definition: resource.h:90
HWND WINAPI GetParent(_In_ HWND)
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1553
UINT uCaretBlinkTime
Definition: access.h:43
HIGHCONTRAST highContrast
Definition: access.h:42
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define WM_HSCROLL
Definition: winuser.h:1725
#define SPIF_SENDCHANGE
Definition: winuser.h:1554
BOOL WINAPI SetCaretBlinkTime(_In_ UINT)
#define ID_BLINK_TIMER
Definition: display.c:14
#define BST_CHECKED
Definition: winuser.h:197
struct _GLOBAL_DATA * PGLOBAL_DATA
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define COLOR_BTNTEXT
Definition: winuser.h:923
#define GetWindowLongPtr
Definition: treelist.c:73
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
UINT uCaretWidth
Definition: access.h:44
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define IDC_CURSOR_WIDTH_TEXT
Definition: resource.h:91
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by SystemApplet().

◆ FillColorSchemeComboBox()

static VOID FillColorSchemeComboBox ( HWND  hwnd)
static

Definition at line 17 of file display.c.

18 {
19  TCHAR szValue[128];
20  DWORD dwDisposition;
22  HKEY hKey;
23  LONG lError;
24  INT i;
25 
27  _T("Control Panel\\Appearance\\Schemes"),
28  0,
29  NULL,
32  NULL,
33  &hKey,
34  &dwDisposition);
35  if (lError != ERROR_SUCCESS)
36  return;
37 
38  for (i = 0; ; i++)
39  {
40  dwLength = 128;
41  lError = RegEnumValue(hKey,
42  i,
43  szValue,
44  &dwLength, NULL, NULL, NULL, NULL);
45  if (lError == ERROR_NO_MORE_ITEMS)
46  break;
47 
50  0,
51  (LPARAM)szValue);
52  }
53 
54  RegCloseKey(hKey);
55 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define HKEY_CURRENT_USER
Definition: winreg.h:11
int32_t INT
Definition: typedefs.h:57
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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define CB_ADDSTRING
Definition: winuser.h:1918
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
static DWORD DWORD * dwLength
Definition: fusion.c:85
unsigned long DWORD
Definition: ntddk_ex.h:95
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define KEY_EXECUTE
Definition: nt_native.h:1037
#define SendMessage
Definition: winuser.h:5818
#define RegEnumValue
Definition: winreg.h:511
#define RegCreateKeyEx
Definition: winreg.h:501
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019

Referenced by HighContrastDlgProc().

◆ HighContrastDlgProc()

INT_PTR CALLBACK HighContrastDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 59 of file display.c.

63 {
64  PGLOBAL_DATA pGlobalData;
65 
66  pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
67 
68  switch (uMsg)
69  {
70  case WM_INITDIALOG:
71  pGlobalData = (PGLOBAL_DATA)lParam;
72  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
73 
74  CheckDlgButton(hwndDlg,
77 
79 
80  SendDlgItemMessage(hwndDlg,
83  (WPARAM)-1,
84  (LPARAM)pGlobalData->highContrast.lpszDefaultScheme);
85  break;
86 
87  case WM_COMMAND:
88  switch (LOWORD(wParam))
89  {
91  pGlobalData->highContrast.dwFlags ^= HCF_HOTKEYACTIVE;
92  break;
93 
94  case IDC_CONTRAST_COMBO:
95  if (HIWORD(wParam) == CBN_SELCHANGE)
96  {
97  INT nSel;
98 
99  nSel = SendDlgItemMessage(hwndDlg, IDC_CONTRAST_COMBO,
100  CB_GETCURSEL, 0, 0);
102  CB_GETLBTEXT, nSel,
103  (LPARAM)pGlobalData->highContrast.lpszDefaultScheme);
104  }
105  break;
106 
107  case IDOK:
108  EndDialog(hwndDlg, TRUE);
109  break;
110 
111  case IDCANCEL:
112  EndDialog(hwndDlg, FALSE);
113  break;
114 
115  default:
116  break;
117  }
118  break;
119  }
120 
121  return FALSE;
122 }
LPSTR lpszDefaultScheme
Definition: winuser.h:3341
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define CB_GETLBTEXT
Definition: winuser.h:1934
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5817
int32_t INT
Definition: typedefs.h:57
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1925
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define DWLP_USER
Definition: winuser.h:866
#define CB_SELECTSTRING
Definition: winuser.h:1942
#define IDC_CONTRAST_COMBO
Definition: resource.h:88
#define WM_COMMAND
Definition: winuser.h:1722
#define BST_UNCHECKED
Definition: winuser.h:199
HIGHCONTRAST highContrast
Definition: access.h:42
static VOID FillColorSchemeComboBox(HWND hwnd)
Definition: display.c:17
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define HCF_HOTKEYACTIVE
Definition: winuser.h:2118
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define BST_CHECKED
Definition: winuser.h:197
#define IDC_CONTRAST_ACTIVATE_CHECK
Definition: resource.h:87
struct _GLOBAL_DATA * PGLOBAL_DATA
#define HIWORD(l)
Definition: typedefs.h:247
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by DisplayPageProc().