Implemented WM_WININICHANGE forwarding for the date/time picker. Right now, it only has an effect for the built-in styles. The same change for the date/time picker itself will come next.
This commit is contained in:
parent
47f856263c
commit
225248ecb8
|
@ -4,6 +4,7 @@
|
||||||
struct datetimepicker {
|
struct datetimepicker {
|
||||||
uiDateTimePicker d;
|
uiDateTimePicker d;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
void (*baseCommitDestroy)(uiControl *);
|
||||||
};
|
};
|
||||||
|
|
||||||
uiDefineControlType(uiDateTimePicker, uiTypeDateTimePicker, struct datetimepicker)
|
uiDefineControlType(uiDateTimePicker, uiTypeDateTimePicker, struct datetimepicker)
|
||||||
|
@ -47,6 +48,14 @@ static void setDateTimeFormat(HWND hwnd)
|
||||||
|
|
||||||
// control implementation
|
// control implementation
|
||||||
|
|
||||||
|
static void datetimepickerCommitDestroy(uiControl *c)
|
||||||
|
{
|
||||||
|
struct datetimepicker *d = (struct datetimepicker *) c;
|
||||||
|
|
||||||
|
uiWindowsUnregisterReceiveWM_WININICHANGE(d->hwnd);
|
||||||
|
(*(d->baseCommitDestroy))(uiControl(d));
|
||||||
|
}
|
||||||
|
|
||||||
static uintptr_t datetimepickerHandle(uiControl *c)
|
static uintptr_t datetimepickerHandle(uiControl *c)
|
||||||
{
|
{
|
||||||
struct datetimepicker *d = (struct datetimepicker *) c;
|
struct datetimepicker *d = (struct datetimepicker *) c;
|
||||||
|
@ -78,6 +87,13 @@ uiDateTimePicker *finishNewDateTimePicker(DWORD style)
|
||||||
hInstance, NULL,
|
hInstance, NULL,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
|
// automatically update date/time format when user changes locale settings
|
||||||
|
// for the standard styles, this is in the date-time picker itself
|
||||||
|
// for our date/time mode, we do it in a subclass assigned in uiNewDateTimePicker()
|
||||||
|
uiWindowsRegisterReceiveWM_WININICHANGE(d->hwnd);
|
||||||
|
|
||||||
|
d->baseCommitDestroy = uiControl(d)->CommitDestroy;
|
||||||
|
uiControl(d)->CommitDestroy = datetimepickerCommitDestroy;
|
||||||
uiControl(d)->Handle = datetimepickerHandle;
|
uiControl(d)->Handle = datetimepickerHandle;
|
||||||
uiControl(d)->PreferredSize = datetimepickerPreferredSize;
|
uiControl(d)->PreferredSize = datetimepickerPreferredSize;
|
||||||
|
|
||||||
|
|
|
@ -104,13 +104,13 @@ void uiWindowsRegisterReceiveWM_WININICHANGE(HWND hwnd)
|
||||||
HASH_ADD_PTR(wininichanges, hwnd, ch);
|
HASH_ADD_PTR(wininichanges, hwnd, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiWindowsUnregisterReceiveWM_WINICHANGE(HWND hwnd)
|
void uiWindowsUnregisterReceiveWM_WININICHANGE(HWND hwnd)
|
||||||
{
|
{
|
||||||
struct wininichange *ch;
|
struct wininichange *ch;
|
||||||
|
|
||||||
HASH_FIND_PTR(wininichanges, &hwnd, ch);
|
HASH_FIND_PTR(wininichanges, &hwnd, ch);
|
||||||
if (ch == NULL)
|
if (ch == NULL)
|
||||||
complain("window handle %p not registered to receive WM_WININICHANGEs in uiWindowsUnregisterReceiveWM_WINICHANGE()", hwnd);
|
complain("window handle %p not registered to receive WM_WININICHANGEs in uiWindowsUnregisterReceiveWM_WININICHANGE()", hwnd);
|
||||||
HASH_DEL(wininichanges, ch);
|
HASH_DEL(wininichanges, ch);
|
||||||
uiFree(ch);
|
uiFree(ch);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ extern BOOL runWM_COMMAND(WPARAM, LPARAM, LRESULT *);
|
||||||
extern BOOL runWM_NOTIFY(WPARAM, LPARAM, LRESULT *);
|
extern BOOL runWM_NOTIFY(WPARAM, LPARAM, LRESULT *);
|
||||||
extern BOOL runWM_HSCROLL(WPARAM, LPARAM, LRESULT *);
|
extern BOOL runWM_HSCROLL(WPARAM, LPARAM, LRESULT *);
|
||||||
extern void uiWindowsRegisterReceiveWM_WININICHANGE(HWND);
|
extern void uiWindowsRegisterReceiveWM_WININICHANGE(HWND);
|
||||||
extern void uiWindowsUnregisterReceiveWM_WINICHANGE(HWND);
|
extern void uiWindowsUnregisterReceiveWM_WININICHANGE(HWND);
|
||||||
extern void issueWM_WININICHANGE(WPARAM, LPARAM);
|
extern void issueWM_WININICHANGE(WPARAM, LPARAM);
|
||||||
|
|
||||||
// dialoghelper.c
|
// dialoghelper.c
|
||||||
|
|
Loading…
Reference in New Issue