diff --git a/redo/ui_windows.h b/redo/ui_windows.h index 9a969e6a..88543d6b 100644 --- a/redo/ui_windows.h +++ b/redo/ui_windows.h @@ -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; diff --git a/redo/windows/separator.c b/redo/windows/separator.c index e41c3221..d6f89136 100644 --- a/redo/windows/separator.c +++ b/redo/windows/separator.c @@ -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); diff --git a/redo/windows/slider.c b/redo/windows/slider.c index 2bc040d3..151cb5b6 100644 --- a/redo/windows/slider.c +++ b/redo/windows/slider.c @@ -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); diff --git a/redo/windows/spinbox.c b/redo/windows/spinbox.c index 814192fe..4fc7b310 100644 --- a/redo/windows/spinbox.c +++ b/redo/windows/spinbox.c @@ -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); diff --git a/redo/windows/tab.c b/redo/windows/tab.c index 9e71aafd..3eefa75f 100644 --- a/redo/windows/tab.c +++ b/redo/windows/tab.c @@ -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);