Added an HWND parameter to all the event handlers. This is needed for radio buttons.
This commit is contained in:
parent
23f6c3271c
commit
a0dbad7c2a
|
@ -8,7 +8,7 @@ struct button {
|
|||
void *onClickedData;
|
||||
};
|
||||
|
||||
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
|
||||
static BOOL onWM_COMMAND(uiControl *c, HWND hwnd, WORD code, LRESULT *lResult)
|
||||
{
|
||||
struct button *b = (struct button *) c;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ struct checkbox {
|
|||
void *onToggledData;
|
||||
};
|
||||
|
||||
static BOOL onWM_COMMAND(uiControl *cc, WORD code, LRESULT *lResult)
|
||||
static BOOL onWM_COMMAND(uiControl *cc, HWND hwnd, WORD code, LRESULT *lResult)
|
||||
{
|
||||
struct checkbox *c = (struct checkbox *) cc;
|
||||
WPARAM check;
|
||||
|
|
|
@ -9,7 +9,7 @@ struct entry {
|
|||
BOOL inhibitChanged;
|
||||
};
|
||||
|
||||
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
|
||||
static BOOL onWM_COMMAND(uiControl *c, HWND hwnd, WORD code, LRESULT *lResult)
|
||||
{
|
||||
struct entry *e = (struct entry *) c;
|
||||
|
||||
|
|
|
@ -5,21 +5,21 @@
|
|||
|
||||
struct commandHandler {
|
||||
HWND hwnd;
|
||||
BOOL (*handler)(uiControl *, WORD, LRESULT *);
|
||||
BOOL (*handler)(uiControl *, HWND, WORD, LRESULT *);
|
||||
uiControl *c;
|
||||
UT_hash_handle hh;
|
||||
};
|
||||
|
||||
struct notifyHandler {
|
||||
HWND hwnd;
|
||||
BOOL (*handler)(uiControl *, NMHDR *, LRESULT *);
|
||||
BOOL (*handler)(uiControl *, HWND, NMHDR *, LRESULT *);
|
||||
uiControl *c;
|
||||
UT_hash_handle hh;
|
||||
};
|
||||
|
||||
struct hscrollHandler {
|
||||
HWND hwnd;
|
||||
BOOL (*handler)(uiControl *, WORD, LRESULT *);
|
||||
BOOL (*handler)(uiControl *, HWND, WORD, LRESULT *);
|
||||
uiControl *c;
|
||||
UT_hash_handle hh;
|
||||
};
|
||||
|
@ -41,9 +41,9 @@ struct hscrollHandler *hscrollHandlers = NULL;
|
|||
ch->c = c; \
|
||||
HASH_ADD_PTR(message ## Handlers, hwnd, ch); \
|
||||
}
|
||||
REGFN(WM_COMMAND, command, (uiControl *, WORD, LRESULT *))
|
||||
REGFN(WM_NOTIFY, notify, (uiControl *, NMHDR *, LRESULT *))
|
||||
REGFN(WM_HSCROLL, hscroll, (uiControl *, WORD, LRESULT *))
|
||||
REGFN(WM_COMMAND, command, (uiControl *, HWND, WORD, LRESULT *))
|
||||
REGFN(WM_NOTIFY, notify, (uiControl *, HWND, NMHDR *, LRESULT *))
|
||||
REGFN(WM_HSCROLL, hscroll, (uiControl *, HWND, WORD, LRESULT *))
|
||||
|
||||
#define UNREGFN(WM_MESSAGE, message) \
|
||||
void uiWindowsUnregister ## WM_MESSAGE ## Handler(HWND hwnd) \
|
||||
|
@ -59,7 +59,7 @@ UNREGFN(WM_COMMAND, command)
|
|||
UNREGFN(WM_NOTIFY, notify)
|
||||
UNREGFN(WM_HSCROLL, hscroll)
|
||||
|
||||
#define RUNFN(WM_MESSAGE, message, gethwnd, arg2) \
|
||||
#define RUNFN(WM_MESSAGE, message, gethwnd, arg3) \
|
||||
BOOL run ## WM_MESSAGE(WPARAM wParam, LPARAM lParam, LRESULT *lResult) \
|
||||
{ \
|
||||
HWND control; \
|
||||
|
@ -70,7 +70,7 @@ UNREGFN(WM_HSCROLL, hscroll)
|
|||
if (control != NULL && IsChild(utilWindow, control) == 0) { \
|
||||
HASH_FIND_PTR(message ## Handlers, &control, ch); \
|
||||
if (ch != NULL) \
|
||||
return (*(ch->handler))(ch->c, arg2, lResult); \
|
||||
return (*(ch->handler))(ch->c, control, arg3, lResult); \
|
||||
/* not registered; fall out to return FALSE */ \
|
||||
} \
|
||||
return FALSE; \
|
||||
|
|
|
@ -13,7 +13,7 @@ struct slider {
|
|||
void *onChangedData;
|
||||
};
|
||||
|
||||
static BOOL onWM_HSCROLL(uiControl *c, WORD code, LRESULT *lResult)
|
||||
static BOOL onWM_HSCROLL(uiControl *c, HWND hwnd, WORD code, LRESULT *lResult)
|
||||
{
|
||||
struct slider *s = (struct slider *) c;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ static intmax_t value(struct spinbox *s)
|
|||
|
||||
// control implementation
|
||||
|
||||
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
|
||||
static BOOL onWM_COMMAND(uiControl *c, HWND hwnd, WORD code, LRESULT *lResult)
|
||||
{
|
||||
struct spinbox *s = (struct spinbox *) c;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ static void showHidePage(struct tab *t, LRESULT which, int hide)
|
|||
|
||||
// control implementation
|
||||
|
||||
static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult)
|
||||
static BOOL onWM_NOTIFY(uiControl *c, HWND hwnd, NMHDR *nm, LRESULT *lResult)
|
||||
{
|
||||
struct tab *t = (struct tab *) c;
|
||||
|
||||
|
|
|
@ -111,9 +111,9 @@ extern void tabLeaveTabNavigation(HWND);
|
|||
|
||||
// events.c
|
||||
// TODO split the uiWindows ones to ui_windows.h
|
||||
extern void uiWindowsRegisterWM_COMMANDHandler(HWND, BOOL (*)(uiControl *, WORD, LRESULT *), uiControl *);
|
||||
extern void uiWindowsRegisterWM_NOTIFYHandler(HWND, BOOL (*)(uiControl *, NMHDR *, LRESULT *), uiControl *);
|
||||
extern void uiWindowsRegisterWM_HSCROLLHandler(HWND, BOOL (*)(uiControl *, WORD, LRESULT *), uiControl *);
|
||||
extern void uiWindowsRegisterWM_COMMANDHandler(HWND, BOOL (*)(uiControl *, HWND, WORD, LRESULT *), uiControl *);
|
||||
extern void uiWindowsRegisterWM_NOTIFYHandler(HWND, BOOL (*)(uiControl *, HWND, NMHDR *, LRESULT *), uiControl *);
|
||||
extern void uiWindowsRegisterWM_HSCROLLHandler(HWND, BOOL (*)(uiControl *, HWND, WORD, LRESULT *), uiControl *);
|
||||
extern void uiWindowsUnregisterWM_COMMANDHandler(HWND);
|
||||
extern void uiWindowsUnregisterWM_NOTIFYHandler(HWND);
|
||||
extern void uiWindowsUnregisterWM_HSCROLLHandler(HWND);
|
||||
|
|
Loading…
Reference in New Issue