ReactOS 0.4.16-dev-199-g898cc56
time.c File Reference
#include "intl.h"
Include dependency graph for time.c:

Go to the source code of this file.

Functions

static BOOL CALLBACK TimeFormatEnumProc (PWSTR lpTimeFormatString)
 
static VOID UpdateTimeSample (HWND hWnd, PGLOBALDATA pGlobalData)
 
static VOID InitTimeFormatCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID InitTimeSeparatorCB (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID InitAmSymbol (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID InitPmSymbol (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static BOOL GetTimeSetting (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
INT_PTR CALLBACK TimePageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

static HWND hwndTimeEnum = NULL
 

Function Documentation

◆ GetTimeSetting()

static BOOL GetTimeSetting ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 160 of file time.c.

163{
164 WCHAR szTimeFormat[MAX_TIMEFORMAT];
165 WCHAR szTimeSep[MAX_TIMESEPARATOR];
166 WCHAR szTimeAM[MAX_TIMEAMSYMBOL];
167 WCHAR szTimePM[MAX_TIMEPMSYMBOL];
168
169 /* Time format */
172 szTimeFormat,
174
175 /* Check the time format */
176 if (szTimeFormat[0] == L'\0')
177 {
178 /* TODO: Show error message */
179
180 return FALSE;
181 }
182
183 /* Time separator */
186 szTimeSep,
188
189 /* Check the time separator */
190 if (szTimeSep[0] == L'\0')
191 {
192 /* TODO: Show error message */
193
194 return FALSE;
195 }
196
197 /* AM symbol */
200 szTimeAM,
202
203 /* PM symbol */
206 szTimePM,
208
209 /* Store settings in global data */
210 wcscpy(pGlobalData->szTimeFormat, szTimeFormat);
211 wcscpy(pGlobalData->szTimeSep, szTimeSep);
212 wcscpy(pGlobalData->szTimeAM, szTimeAM);
213 wcscpy(pGlobalData->szTimePM, szTimePM);
214
215 return TRUE;
216}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDC_TIMEPMSYMBOL
Definition: resource.h:49
#define IDC_TIMEAMSYMBOL
Definition: resource.h:48
#define IDC_TIMESEPARATOR
Definition: resource.h:47
#define IDC_TIMEFORMAT
Definition: resource.h:46
#define MAX_TIMESEPARATOR
Definition: intl.h:39
VOID GetSelectedComboBoxText(HWND hwndDlg, INT nIdDlgItem, PWSTR Buffer, UINT uSize)
Definition: misc.c:176
#define MAX_TIMEPMSYMBOL
Definition: intl.h:41
#define MAX_TIMEAMSYMBOL
Definition: intl.h:40
#define MAX_TIMEFORMAT
Definition: intl.h:38
#define L(x)
Definition: ntvdm.h:50
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
WCHAR szTimePM[MAX_TIMEPMSYMBOL]
Definition: intl.h:93
WCHAR szTimeFormat[MAX_TIMEFORMAT]
Definition: intl.h:90
WCHAR szTimeAM[MAX_TIMEAMSYMBOL]
Definition: intl.h:92
WCHAR szTimeSep[MAX_TIMESEPARATOR]
Definition: intl.h:91
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by TimePageProc().

◆ InitAmSymbol()

static VOID InitAmSymbol ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 97 of file time.c.

100{
101 int nLen;
102
105
106 nLen = wcslen(pGlobalData->szTimeAM);
107
110 0,
111 (LPARAM)pGlobalData->szTimeAM);
112 if (nLen != 0)
113 {
116 0,
117 (LPARAM)L"");
118 }
119
122 0, /* Index */
123 0);
124}
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_SETCURSEL
Definition: winuser.h:1964
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_ADDSTRING
Definition: winuser.h:1939
#define CB_LIMITTEXT
Definition: winuser.h:1961

Referenced by TimePageProc().

◆ InitPmSymbol()

static VOID InitPmSymbol ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 129 of file time.c.

132{
133 int nLen;
134
137
138 nLen = wcslen(pGlobalData->szTimeAM);
139
142 0,
143 (LPARAM)pGlobalData->szTimePM);
144 if (nLen != 0)
145 {
148 0,
149 (LPARAM)L"");
150 }
153 0, /* Index */
154 0);
155}

Referenced by TimePageProc().

◆ InitTimeFormatCB()

static VOID InitTimeFormatCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 56 of file time.c.

59{
60 /* Get the time format */
63
64 /* Add available time formats to the list */
67
70 -1,
71 (LPARAM)pGlobalData->szTimeFormat);
72}
static BOOL CALLBACK TimeFormatEnumProc(PWSTR lpTimeFormatString)
Definition: time.c:32
static HWND hwndTimeEnum
Definition: time.c:29
BOOL WINAPI EnumTimeFormatsW(TIMEFMT_ENUMPROCW proc, LCID lcid, DWORD flags)
Definition: lcformat.c:2157
LCID UserLCID
Definition: intl.h:113
#define CB_SELECTSTRING
Definition: winuser.h:1963
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)

Referenced by TimePageProc().

◆ InitTimeSeparatorCB()

static VOID InitTimeSeparatorCB ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 76 of file time.c.

79{
82
85 0,
86 (LPARAM)pGlobalData->szTimeSep);
87
90 0, /* Index */
91 0);
92}

Referenced by TimePageProc().

◆ TimeFormatEnumProc()

static BOOL CALLBACK TimeFormatEnumProc ( PWSTR  lpTimeFormatString)
static

Definition at line 32 of file time.c.

33{
36 0,
37 (LPARAM)lpTimeFormatString);
38
39 return TRUE;
40}
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by InitTimeFormatCB().

◆ TimePageProc()

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

Definition at line 220 of file time.c.

224{
225 PGLOBALDATA pGlobalData;
226
227 pGlobalData = (PGLOBALDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
228
229 switch (uMsg)
230 {
231 case WM_INITDIALOG:
232 pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
233 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
234
235 /* Get the time format */
236 InitTimeFormatCB(hwndDlg, pGlobalData);
237
238 /* Get the time separator */
239 InitTimeSeparatorCB(hwndDlg, pGlobalData);
240
241 /* Get the AM symbol */
242 InitAmSymbol(hwndDlg, pGlobalData);
243
244 /* Get the PM symbol */
245 InitPmSymbol(hwndDlg, pGlobalData);
246
247 /* Update the time format sample */
248 UpdateTimeSample(hwndDlg, pGlobalData);
249 break;
250
251 case WM_COMMAND:
252 switch (LOWORD(wParam))
253 {
254 case IDC_TIMEFORMAT:
256 case IDC_TIMEAMSYMBOL:
257 case IDC_TIMEPMSYMBOL:
258 if (HIWORD(wParam) == CBN_SELCHANGE ||
260 {
261 /* Enable the Apply button */
262 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
263 }
264 break;
265 }
266 break;
267
268 case WM_NOTIFY:
269 if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
270 {
271 if (GetTimeSetting(hwndDlg, pGlobalData))
272 {
273 pGlobalData->bUserLocaleChanged = TRUE;
274 UpdateTimeSample(hwndDlg, pGlobalData);
275 }
276 }
277 break;
278 }
279
280 return FALSE;
281}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static BOOL GetTimeSetting(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: time.c:160
static VOID InitAmSymbol(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: time.c:97
static VOID InitTimeFormatCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: time.c:56
static VOID InitTimeSeparatorCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: time.c:76
static VOID UpdateTimeSample(HWND hWnd, PGLOBALDATA pGlobalData)
Definition: time.c:43
static VOID InitPmSymbol(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: time.c:129
struct _GLOBALDATA * PGLOBALDATA
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSN_APPLY
Definition: prsht.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define WM_NOTIFY
Definition: richedit.h:61
BOOL bUserLocaleChanged
Definition: intl.h:115
Definition: inflate.c:139
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define HIWORD(l)
Definition: typedefs.h:247
#define DWLP_USER
Definition: winuser.h:875
#define WM_COMMAND
Definition: winuser.h:1743
#define WM_INITDIALOG
Definition: winuser.h:1742
#define CBN_SELCHANGE
Definition: winuser.h:1982
HWND WINAPI GetParent(_In_ HWND)
#define CBN_EDITCHANGE
Definition: winuser.h:1978

Referenced by CustomizeLocalePropertySheet().

◆ UpdateTimeSample()

static VOID UpdateTimeSample ( HWND  hWnd,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 43 of file time.c.

44{
46
47 GetTimeFormatW(pGlobalData->UserLCID, 0, NULL,
48 pGlobalData->szTimeFormat, szBuffer,
51}
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
#define IDC_TIMESAMPLE
Definition: resource.h:45
#define MAX_SAMPLES_STR_SIZE
Definition: intl.h:24
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1093
#define WM_SETTEXT
Definition: winuser.h:1620

Referenced by TimePageProc().

Variable Documentation

◆ hwndTimeEnum

HWND hwndTimeEnum = NULL
static

Definition at line 29 of file time.c.

Referenced by InitTimeFormatCB(), and TimeFormatEnumProc().