More SysFunc migration-away.
This commit is contained in:
parent
9b7a771768
commit
b65292da46
|
@ -16,8 +16,9 @@ _UI_EXTERN void uiWIndowsUtilShow(HWND hwnd);
|
|||
_UI_EXTERN void uiWindowsUtilHide(HWND hwnd);
|
||||
_UI_EXTERN void uiWIndowsUtilEnable(HWND hwnd);
|
||||
_UI_EXTERN void uiWindowsUtilDisable(HWND hwnd);
|
||||
_UI_EXTERN void uiWindowsUtilSysFunc(HWND hwnd, uiControlSysFuncParams *p);
|
||||
_UI_EXTERN int uiWindowsUtilStartZOrder(HWND hwnd, uiControlSysFuncParams *p);
|
||||
_UI_EXTERN uintptr_t uiWindowsUtilStartZOrder(HWND hwnd);
|
||||
_UI_EXTERN uintptr_t uiWindowsUtilSetZOrder(HWND hwnd, uintptr_t insertAfter);
|
||||
_UI_EXTERN int uiWindowsUtilHasTabStops(HWND hwnd);
|
||||
_UI_EXTERN uiControl *uiWindowsNewSingleHWNDControl(uintmax_t type);
|
||||
|
||||
// This contains the Windows-specific parts of the uiSizing structure.
|
||||
|
@ -45,25 +46,4 @@ _UI_EXTERN intmax_t uiWindowsWindowTextWidth(HWND hwnd);
|
|||
_UI_EXTERN char *uiWindowsControlText(uiControl *);
|
||||
_UI_EXTERN void uiWindowsControlSetText(uiControl *, const char *);
|
||||
|
||||
struct uiControlSysFuncParams {
|
||||
int Func;
|
||||
BOOL HasTabStops;
|
||||
HWND InsertAfter;
|
||||
};
|
||||
|
||||
enum {
|
||||
// These should enable and disable the uiControl while preserving the user enable/disable setting.
|
||||
// These are needed because while disabling a parent window does cause children to stop receiving events, they are not shown as disabled, which is not what we want.
|
||||
uiWindowsSysFuncContainerEnable,
|
||||
uiWindowsSysFuncContainerDisable,
|
||||
// This is interpreted by controls that are tab stops; the control should set HasTabStops to TRUE if so, and *LEAVE IT ALONE* if not.
|
||||
// You only need this if implementing your own uiControl.
|
||||
// Controls created with uiWindowsMakeControl() check for the window being enabled and the presence of WS_TABSTOP.
|
||||
// The name is "has tab stops" because it is used by uiTabs to say "does the current tab page have tab stops?".
|
||||
uiWindowsSysFuncHasTabStops,
|
||||
// This tells the current control to set its Z order to be after the control in the InsertAfter field.
|
||||
// You should also set your own handle to the InsertAfter field for the next control.
|
||||
uiWindowsSysFuncSetZOrder,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -106,29 +106,7 @@ static void singleHWNDCommitDisable(uiControl *c)
|
|||
uiWindowsUtilDisable(HWND(c));
|
||||
}
|
||||
|
||||
void uiWindowsUtilSysFunc(HWND hwnd, uiControlSysFuncParams *p)
|
||||
{
|
||||
switch (p->Func) {
|
||||
case uiControlSysFuncNop:
|
||||
return;
|
||||
case uiWindowsSysFuncHasTabStops:
|
||||
if ((getStyle(hwnd) & WS_TABSTOP) != 0)
|
||||
p->HasTabStops = TRUE;
|
||||
return;
|
||||
case uiWindowsSysFuncSetZOrder:
|
||||
setWindowInsertAfter(hwnd, p->InsertAfter);
|
||||
p->InsertAfter = hwnd;
|
||||
return;
|
||||
}
|
||||
complain("unknown uiControlSysFunc() function %d in uiWindowsUtilSysFunc()", p->Func);
|
||||
}
|
||||
|
||||
static void singleHWNDSysFunc(uiControl *c, uiControlSysFuncParams *p)
|
||||
{
|
||||
uiWindowsUtilSysFunc(HWND(c), p);
|
||||
}
|
||||
|
||||
int uiWindowsUtilStartZOrder(HWND hwnd, uiControlSysFuncParams *p)
|
||||
uintptr_t uiWindowsUtilStartZOrder(HWND hwnd)
|
||||
{
|
||||
HWND insertAfter;
|
||||
|
||||
|
@ -136,13 +114,33 @@ int uiWindowsUtilStartZOrder(HWND hwnd, uiControlSysFuncParams *p)
|
|||
insertAfter = GetWindow(hwnd, GW_HWNDPREV);
|
||||
if (insertAfter == NULL)
|
||||
logLastError("error getting insert after window in uiWindowsUtilStartZOrder()");
|
||||
p->InsertAfter = insertAfter;
|
||||
return 1;
|
||||
return (uintptr_t) insertAfter;
|
||||
}
|
||||
|
||||
static int singleHWNDStartZOrder(uiControl *c, uiControlSysFuncParams *p)
|
||||
static uintptr_t singleHWNDStartZOrder(uiControl *c)
|
||||
{
|
||||
return uiWindowsUtilStartZOrder(HWND(c), p);
|
||||
return uiWindowsUtilStartZOrder(HWND(c));
|
||||
}
|
||||
|
||||
uintptr_t uiWindowsUtilSetZOrder(HWND hwnd, uintptr_t insertAfter)
|
||||
{
|
||||
setWindowInsertAfter(hwnd, (HWND) insertAfter);
|
||||
return (uintptr_t) hwnd;
|
||||
}
|
||||
|
||||
static uintptr_t singleHWNDSetZOrder(uiControl *c, uintptr_t insertAfter)
|
||||
{
|
||||
return uiWindowsUtilSetZOrder(HWND(c), insertAfter);
|
||||
}
|
||||
|
||||
int uiWindowsUtilHasTabStops(HWND hwnd)
|
||||
{
|
||||
return (getStyle(hwnd) & WS_TABSTOP) != 0;
|
||||
}
|
||||
|
||||
static int singleHWNDHasTabStops(uiControl *c)
|
||||
{
|
||||
return uiWindowsUtilHasTabStops(HWND(c));
|
||||
}
|
||||
|
||||
void setSingleHWNDFuncs(uiControl *c)
|
||||
|
@ -155,8 +153,9 @@ void setSingleHWNDFuncs(uiControl *c)
|
|||
uiControl(c)->CommitHide = singleHWNDCommitHide;
|
||||
uiControl(c)->CommitEnable = singleHWNDCommitEnable;
|
||||
uiControl(c)->CommitDisable = singleHWNDCommitDisable;
|
||||
uiControl(c)->SysFunc = singleHWNDSysFunc;
|
||||
uiControl(c)->StartZOrder = singleHWNDStartZOrder;
|
||||
uiControl(c)->SetZOrder = singleHWNDSetZOrder;
|
||||
uiControl(c)->HasTabStops = singleHWNDHasTabStops;
|
||||
}
|
||||
|
||||
uiControl *uiWindowsNewSingleHWNDControl(uintmax_t type)
|
||||
|
|
Loading…
Reference in New Issue