diff --git a/redo/ui_windows.h b/redo/ui_windows.h index 685c26e3..262577e4 100644 --- a/redo/ui_windows.h +++ b/redo/ui_windows.h @@ -22,12 +22,13 @@ 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 or WM_NOTIFY (respectively) to its parent. + // 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_COMMAND)(uiControl *c, WORD code, LRESULT *lResult); BOOL (*onWM_NOTIFY)(uiControl *c, NMHDR *nm, LRESULT *lResult); + BOOL (*onWM_HSCROLL)(uiControl *c, WORD code, LRESULT *lResult); // This is called when the widget is ready to be destroyed. void (*onDestroy)(void *data); diff --git a/redo/windows/button.c b/redo/windows/button.c index 3cfb8627..2cdc4532 100644 --- a/redo/windows/button.c +++ b/redo/windows/button.c @@ -24,6 +24,11 @@ static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult) return FALSE; } +static BOOL onWM_HSCROLL(uiControl *c, WORD code, LRESULT *lResult) +{ + return FALSE; +} + static void onDestroy(void *data) { struct button *b = (struct button *) data; @@ -97,6 +102,7 @@ uiButton *uiNewButton(const char *text) p.useStandardControlFont = TRUE; p.onWM_COMMAND = onWM_COMMAND; p.onWM_NOTIFY = onWM_NOTIFY; + p.onWM_HSCROLL = onWM_HSCROLL; p.onDestroy = onDestroy; p.onDestroyData = b; uiWindowsMakeControl(uiControl(b), &p); diff --git a/redo/windows/checkbox.c b/redo/windows/checkbox.c index 64adf361..74f0986e 100644 --- a/redo/windows/checkbox.c +++ b/redo/windows/checkbox.c @@ -32,6 +32,11 @@ static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult) return FALSE; } +static BOOL onWM_HSCROLL(uiControl *c, WORD code, LRESULT *lResult) +{ + return FALSE; +} + static void onDestroy(void *data) { struct checkbox *c = (struct checkbox *) data; @@ -112,6 +117,7 @@ uiCheckbox *uiNewCheckbox(const char *text) p.useStandardControlFont = TRUE; p.onWM_COMMAND = onWM_COMMAND; p.onWM_NOTIFY = onWM_NOTIFY; + p.onWM_HSCROLL = onWM_HSCROLL; p.onDestroy = onDestroy; p.onDestroyData = c; uiWindowsMakeControl(uiControl(c), &p); diff --git a/redo/windows/container.c b/redo/windows/container.c index e20d3336..60a589c1 100644 --- a/redo/windows/container.c +++ b/redo/windows/container.c @@ -68,6 +68,11 @@ static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult) return FALSE; } +static BOOL onWM_HSCROLL(uiControl *c, WORD code, LRESULT *lResult) +{ + return FALSE; +} + static void onDestroy(void *data) { // do nothing @@ -86,6 +91,7 @@ void uiMakeContainer(uiControl *c) p.useStandardControlFont = TRUE; p.onWM_COMMAND = onWM_COMMAND; p.onWM_NOTIFY = onWM_NOTIFY; + p.onWM_HSCROLL = onWM_HSCROLL; p.onDestroy = onDestroy; p.onDestroyData = NULL; uiWindowsMakeControl(c, &p); diff --git a/redo/windows/control.c b/redo/windows/control.c index 07bd8abd..22937bf8 100644 --- a/redo/windows/control.c +++ b/redo/windows/control.c @@ -6,6 +6,7 @@ struct singleHWND { HWND hwnd; BOOL (*onWM_COMMAND)(uiControl *, WORD, LRESULT *); BOOL (*onWM_NOTIFY)(uiControl *, NMHDR *, LRESULT *); + BOOL (*onWM_HSCROLL)(uiControl *, WORD, LRESULT *); void (*onDestroy)(void *); void *onDestroyData; }; @@ -117,6 +118,10 @@ static LRESULT CALLBACK singleSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, if ((*(s->onWM_NOTIFY))(s->c, (NMHDR *) lParam, &lResult) != FALSE) return lResult; break; + case msgHSCROLL: + if ((*(s->onWM_HSCROLL))(s->c, LOWORD(wParam), &lResult) != FALSE) + return lResult; + break; case WM_NCDESTROY: if (RemoveWindowSubclass(hwnd, singleSubclassProc, uIdSubclass) == FALSE) logLastError("error removing Windows control subclass in singleSubclassProc()"); diff --git a/redo/windows/entry.c b/redo/windows/entry.c index 2ce435cb..ae4c2571 100644 --- a/redo/windows/entry.c +++ b/redo/windows/entry.c @@ -27,6 +27,11 @@ static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult) return FALSE; } +static BOOL onWM_HSCROLL(uiControl *c, WORD code, LRESULT *lResult) +{ + return FALSE; +} + static void onDestroy(void *data) { struct entry *e = (struct entry *) data; @@ -108,6 +113,7 @@ uiEntry *uiNewEntry(void) p.useStandardControlFont = TRUE; p.onWM_COMMAND = onWM_COMMAND; p.onWM_NOTIFY = onWM_NOTIFY; + p.onWM_HSCROLL = onWM_HSCROLL; p.onDestroy = onDestroy; p.onDestroyData = e; uiWindowsMakeControl(uiControl(e), &p); diff --git a/redo/windows/group.c b/redo/windows/group.c index d867b831..4017cc70 100644 --- a/redo/windows/group.c +++ b/redo/windows/group.c @@ -16,6 +16,11 @@ static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult) return FALSE; } +static BOOL onWM_HSCROLL(uiControl *c, WORD code, LRESULT *lResult) +{ + return FALSE; +} + static void onDestroy(void *data) { // TODO @@ -52,6 +57,7 @@ uiGroup *uiNewGroup(const char *text) p.useStandardControlFont = TRUE; p.onWM_COMMAND = onWM_COMMAND; p.onWM_NOTIFY = onWM_NOTIFY; + p.onWM_HSCROLL = onWM_HSCROLL; p.onDestroy = onDestroy; p.onDestroyData = g; uiWindowsMakeControl(uiControl(g), &p); diff --git a/redo/windows/init.c b/redo/windows/init.c index 815d75bb..94b31aad 100644 --- a/redo/windows/init.c +++ b/redo/windows/init.c @@ -78,6 +78,7 @@ uiInitOptions options; ICC_TAB_CLASSES | /* tabs */ \ ICC_LISTVIEW_CLASSES | /* table headers */ \ ICC_UPDOWN_CLASS | /* spinboxes */ \ + ICC_BAR_CLASSES | /* trackbar */ \ 0) const char *uiInit(uiInitOptions *o) diff --git a/redo/windows/label.c b/redo/windows/label.c index fdd40c7d..c9230048 100644 --- a/redo/windows/label.c +++ b/redo/windows/label.c @@ -16,6 +16,11 @@ static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult) return FALSE; } +static BOOL onWM_HSCROLL(uiControl *c, WORD code, LRESULT *lResult) +{ + return FALSE; +} + static void onDestroy(void *data) { struct label *l = (struct label *) data; @@ -65,6 +70,7 @@ uiLabel *uiNewLabel(const char *text) p.useStandardControlFont = TRUE; p.onWM_COMMAND = onWM_COMMAND; p.onWM_NOTIFY = onWM_NOTIFY; + p.onWM_HSCROLL = onWM_HSCROLL; p.onDestroy = onDestroy; p.onDestroyData = l; uiWindowsMakeControl(uiControl(l), &p); diff --git a/redo/windows/parent.c b/redo/windows/parent.c index c7d13e83..0f29766a 100644 --- a/redo/windows/parent.c +++ b/redo/windows/parent.c @@ -127,6 +127,14 @@ BOOL handleParentMessages(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LR return TRUE; } break; + case WM_HSCROLL: + // same as WM_COMMAND + control = (HWND) lParam; + if (control != NULL && IsChild(utilWindow, control) == 0) { + *lResult = SendMessageW(control, msgHSCROLL, wParam, lParam); + return TRUE; + } + break; case WM_CTLCOLORSTATIC: case WM_CTLCOLORBTN: if (parentBrush != NULL) diff --git a/redo/windows/progressbar.c b/redo/windows/progressbar.c index cce0f1e5..09b6dd1d 100644 --- a/redo/windows/progressbar.c +++ b/redo/windows/progressbar.c @@ -16,6 +16,11 @@ static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult) return FALSE; } +static BOOL onWM_HSCROLL(uiControl *c, WORD code, LRESULT *lResult) +{ + return FALSE; +} + static void onDestroy(void *data) { struct progressbar *p = (struct progressbar *) data; @@ -60,6 +65,7 @@ uiProgressBar *uiNewProgressBar(void) p.useStandardControlFont = FALSE; p.onWM_COMMAND = onWM_COMMAND; p.onWM_NOTIFY = onWM_NOTIFY; + p.onWM_HSCROLL = onWM_HSCROLL; p.onDestroy = onDestroy; p.onDestroyData = pbar; uiWindowsMakeControl(uiControl(pbar), &p); diff --git a/redo/windows/spinbox.c b/redo/windows/spinbox.c index a4b04ee5..462a1ac2 100644 --- a/redo/windows/spinbox.c +++ b/redo/windows/spinbox.c @@ -52,6 +52,11 @@ static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult) return FALSE; } +static BOOL onWM_HSCROLL(uiControl *c, WORD code, LRESULT *lResult) +{ + return FALSE; +} + static void onDestroy(void *data) { struct spinbox *s = (struct spinbox *) data; @@ -146,6 +151,7 @@ uiSpinbox *uiNewSpinbox(void) p.useStandardControlFont = TRUE; p.onWM_COMMAND = onWM_COMMAND; p.onWM_NOTIFY = onWM_NOTIFY; + 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 1dc7ae3b..30cce370 100644 --- a/redo/windows/tab.c +++ b/redo/windows/tab.c @@ -59,6 +59,11 @@ 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 @@ -215,6 +220,7 @@ uiTab *uiNewTab(void) p.useStandardControlFont = TRUE; p.onWM_COMMAND = onWM_COMMAND; p.onWM_NOTIFY = onWM_NOTIFY; + p.onWM_HSCROLL = onWM_HSCROLL; p.onDestroy = onDestroy; p.onDestroyData = t; uiWindowsMakeControl(uiControl(t), &p); diff --git a/redo/windows/uipriv_windows.h b/redo/windows/uipriv_windows.h index 1ab47804..4a976765 100644 --- a/redo/windows/uipriv_windows.h +++ b/redo/windows/uipriv_windows.h @@ -34,6 +34,7 @@ enum { // redirected WM_COMMAND and WM_NOTIFY msgCOMMAND = WM_APP + 0x40, // start offset just to be safe msgNOTIFY, + msgHSCROLL, msgHasTabStops, msgConsoleEndSession, };