Finished migrating WM_HSCROLLhandlers away from being in the creation parameters.

This commit is contained in:
Pietro Gagliardi 2015-05-21 13:04:57 -04:00
parent cbdaa780ff
commit 23f6c3271c
5 changed files with 2 additions and 25 deletions

View File

@ -22,12 +22,6 @@ struct uiWindowsMakeControlParams {
// Set this to non-FALSE to use the standard control font used by other ui controls.
BOOL useStandardControlFont;
// These are called when the control sends a WM_COMMAND, WM_NOTIFY, or WM_HSCROLL (respectively) to its parent.
// ui redirects the message back and calls these functions.
// Store the result in *lResult and return any non-FALSE value (such as TRUE) to return the given result; return FALSE to pass the notification up to your window procedure.
// Note that these are only issued if they come from the uiControl itself; notifications from children of the uiControl (such as a header control) will be received normally.
BOOL (*onWM_HSCROLL)(uiControl *c, WORD code, LRESULT *lResult);
// This is called when the widget is ready to be destroyed.
void (*onDestroy)(void *data);
void *onDestroyData;

View File

@ -10,11 +10,6 @@ struct separator {
HWND hwnd;
};
static BOOL onWM_HSCROLL(uiControl *c, WORD code, LRESULT *lResult)
{
return FALSE;
}
static void onDestroy(void *data)
{
struct separator *s = (struct separator *) data;
@ -47,7 +42,6 @@ uiSeparator *uiNewHorizontalSeparator(void)
p.hInstance = hInstance;
p.lpParam = NULL;
p.useStandardControlFont = TRUE;
p.onWM_HSCROLL = onWM_HSCROLL;
p.onDestroy = onDestroy;
p.onDestroyData = s;
uiWindowsMakeControl(uiControl(s), &p);

View File

@ -26,6 +26,7 @@ static void onDestroy(void *data)
{
struct slider *s = (struct slider *) data;
uiWindowsUnregisterWM_HSCROLLHandler(s->hwnd);
uiFree(s);
}
@ -84,12 +85,12 @@ uiSlider *uiNewSlider(intmax_t min, intmax_t max)
p.hInstance = hInstance;
p.lpParam = NULL;
p.useStandardControlFont = TRUE;
p.onWM_HSCROLL = onWM_HSCROLL;
p.onDestroy = onDestroy;
p.onDestroyData = s;
uiWindowsMakeControl(uiControl(s), &p);
s->hwnd = (HWND) uiControlHandle(uiControl(s));
uiWindowsRegisterWM_HSCROLLHandler(s->hwnd, onWM_HSCROLL, uiControl(s));
SendMessageW(s->hwnd, TBM_SETRANGEMIN, (WPARAM) TRUE, (LPARAM) min);
SendMessageW(s->hwnd, TBM_SETRANGEMAX, (WPARAM) TRUE, (LPARAM) max);

View File

@ -47,11 +47,6 @@ static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
return TRUE;
}
static BOOL onWM_HSCROLL(uiControl *c, WORD code, LRESULT *lResult)
{
return FALSE;
}
static void onDestroy(void *data)
{
struct spinbox *s = (struct spinbox *) data;
@ -165,7 +160,6 @@ uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
p.hInstance = hInstance;
p.lpParam = NULL;
p.useStandardControlFont = TRUE;
p.onWM_HSCROLL = onWM_HSCROLL;
p.onDestroy = onDestroy;
p.onDestroyData = s;
uiWindowsMakeControl(uiControl(s), &p);

View File

@ -54,11 +54,6 @@ static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult)
return TRUE;
}
static BOOL onWM_HSCROLL(uiControl *c, WORD code, LRESULT *lResult)
{
return FALSE;
}
static void onDestroy(void *data)
{
// TODO
@ -214,7 +209,6 @@ uiTab *uiNewTab(void)
p.hInstance = hInstance;
p.lpParam = NULL;
p.useStandardControlFont = TRUE;
p.onWM_HSCROLL = onWM_HSCROLL;
p.onDestroy = onDestroy;
p.onDestroyData = t;
uiWindowsMakeControl(uiControl(t), &p);