Added onWM_HSCROLL to the Windows control creation parameters since sliders will be using it; also did other assorted preparations for sliders.
This commit is contained in:
parent
180193231d
commit
854f036197
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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()");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue