Laid the foundation for proper tab navigation in uiTabs.
This commit is contained in:
parent
ab3fea8cd7
commit
c5e5fbd909
|
@ -56,6 +56,7 @@ extern void uiWindowsControlSetText(uiControl *, const char *);
|
||||||
|
|
||||||
struct uiControlSysFuncParams {
|
struct uiControlSysFuncParams {
|
||||||
int Func;
|
int Func;
|
||||||
|
BOOL HasTabStops;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -63,6 +64,11 @@ enum {
|
||||||
// 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.
|
// 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,
|
uiWindowsSysFuncContainerEnable,
|
||||||
uiWindowsSysFuncContainerDisable,
|
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 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,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -118,6 +118,10 @@ static void singleSysFunc(uiControl *c, uiControlSysFuncParams *p)
|
||||||
s->containerDisabled = 1;
|
s->containerDisabled = 1;
|
||||||
EnableWindow(s->hwnd, FALSE);
|
EnableWindow(s->hwnd, FALSE);
|
||||||
return;
|
return;
|
||||||
|
case uiWindowsSysFuncHasTabStops:
|
||||||
|
if ((getStyle(s->hwnd) & WS_TABSTOP) != 0)
|
||||||
|
p->HasTabStops = TRUE;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
complain("unknown p->Func %d in singleSysFunc()", p->Func);
|
complain("unknown p->Func %d in singleSysFunc()", p->Func);
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,14 @@ static void tabSysFunc(uiControl *c, uiControlSysFuncParams *p)
|
||||||
struct tabPage *page;
|
struct tabPage *page;
|
||||||
uintmax_t i;
|
uintmax_t i;
|
||||||
|
|
||||||
|
// we handle tab stops specially
|
||||||
|
if (p->Func == uiWindowsSysFuncHasTabStops) {
|
||||||
|
// if there are no tabs, it is not a tab stop
|
||||||
|
if (t->pages->len != 0)
|
||||||
|
p->HasTabStops = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// otherwise distribute it throughout all pages
|
||||||
(*(t->baseSysFunc))(uiControl(t), p);
|
(*(t->baseSysFunc))(uiControl(t), p);
|
||||||
for (i = 0; i < t->pages->len; i++) {
|
for (i = 0; i < t->pages->len; i++) {
|
||||||
page = ptrArrayIndex(t->pages, struct tabPage *, i);
|
page = ptrArrayIndex(t->pages, struct tabPage *, i);
|
||||||
|
@ -324,7 +332,7 @@ uiTab *uiNewTab(void)
|
||||||
p.dwExStyle = 0; // don't set WS_EX_CONTROLPARENT yet; we do that dynamically in the message loop (see main_windows.c)
|
p.dwExStyle = 0; // don't set WS_EX_CONTROLPARENT yet; we do that dynamically in the message loop (see main_windows.c)
|
||||||
p.lpClassName = WC_TABCONTROLW;
|
p.lpClassName = WC_TABCONTROLW;
|
||||||
p.lpWindowName = L"";
|
p.lpWindowName = L"";
|
||||||
p.dwStyle = TCS_TOOLTIPS | WS_TABSTOP;
|
p.dwStyle = TCS_TOOLTIPS | WS_TABSTOP; // start with this; we will alternate between this and WS_EX_CONTROLPARENT as needed (see main.c and msgHasTabStops above)
|
||||||
p.hInstance = hInstance;
|
p.hInstance = hInstance;
|
||||||
p.useStandardControlFont = TRUE;
|
p.useStandardControlFont = TRUE;
|
||||||
p.onWM_COMMAND = onWM_COMMAND;
|
p.onWM_COMMAND = onWM_COMMAND;
|
||||||
|
|
|
@ -52,6 +52,10 @@ extern HBRUSH hollowBrush;
|
||||||
// util.c
|
// util.c
|
||||||
extern int windowClassOf(HWND, ...);
|
extern int windowClassOf(HWND, ...);
|
||||||
extern void mapWindowRect(HWND, HWND, RECT *);
|
extern void mapWindowRect(HWND, HWND, RECT *);
|
||||||
|
extern DWORD getStyle(HWND);
|
||||||
|
extern void setStyle(HWND, DWORD);
|
||||||
|
extern DWORD getExStyle(HWND);
|
||||||
|
extern void setExStyle(HWND, DWORD);
|
||||||
|
|
||||||
// text.c
|
// text.c
|
||||||
extern WCHAR *toUTF16(const char *);
|
extern WCHAR *toUTF16(const char *);
|
||||||
|
|
|
@ -95,3 +95,23 @@ void mapWindowRect(HWND from, HWND to, RECT *r)
|
||||||
logLastError("error calling MapWindowRect() in mapWindowRect()");
|
logLastError("error calling MapWindowRect() in mapWindowRect()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DWORD getStyle(HWND hwnd)
|
||||||
|
{
|
||||||
|
return (DWORD) GetWindowLongPtrW(hwnd, GWL_STYLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setStyle(HWND hwnd, DWORD style)
|
||||||
|
{
|
||||||
|
SetWindowLongPtrW(hwnd, GWL_STYLE, (LONG_PTR) style);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD getExStyle(HWND hwnd)
|
||||||
|
{
|
||||||
|
return (DWORD) GetWindowLongPtrW(hwnd, GWL_EXSTYLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setExStyle(HWND hwnd, DWORD exstyle)
|
||||||
|
{
|
||||||
|
SetWindowLongPtrW(hwnd, GWL_EXSTYLE, (LONG_PTR) exstyle);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue