Cleaned up some control ID stuff.
This commit is contained in:
parent
8b42c22caf
commit
56853c5d86
|
@ -221,6 +221,9 @@ _UI_EXTERN HWND uiWindowsMakeContainer(void (*onResize)(void *data), void *data)
|
|||
// TODO document
|
||||
_UI_EXTERN void uiWindowsControlNotifyMinimumSizeChanged(uiWindowsControl *);
|
||||
|
||||
// TODO document
|
||||
_UI_EXTERN void uiWindowsControlAssignSoleControlIDZOrder(uiWindowsControl *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -21,10 +21,9 @@ void uiWindowsControlChildMinimumSizeChanged(uiWIndowsControl *c)
|
|||
(*(c->ChildMinimumSizeChanged))(c);
|
||||
}
|
||||
|
||||
// TODO get the correct argument names from existing implemenations for here and ui_windows.h
|
||||
void uiWindowsControlAssignControlIDZOrder(uiWindowsControl *c, LONG_PTR *cid, HWND *zorder)
|
||||
void uiWindowsControlAssignControlIDZOrder(uiWindowsControl *c, LONG_PTR *controlID, HWND *insertAfter)
|
||||
{
|
||||
(*(c->AssignControlIDZorder))(c, cID, zorder);
|
||||
(*(c->AssignControlIDZorder))(c, controlID, insertAfter);
|
||||
}
|
||||
|
||||
HWND uiWindowsEnsureCreateControlHWND(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, HINSTANCE hInstance, LPVOID lpParam, BOOL useStandardControlFont)
|
||||
|
@ -66,3 +65,13 @@ void uiWindowsControlNotifyMinimumSizeChanged(uiWindowsControl *c)
|
|||
if (parent != NULL)
|
||||
uiWindowsControlChildMinimumSizeChanged(uiWindowsControl(parent));
|
||||
}
|
||||
|
||||
void uiWindowsControlAssignSoleControlIDZOrder(uiWindowsControl *c)
|
||||
{
|
||||
LONG_PTR controlID;
|
||||
HWND insertAfter;
|
||||
|
||||
controlID = 100;
|
||||
insertAfter = NULL;
|
||||
uiWindowsControlAssignControlIDZorder(c, &controlID, &insertAfter);
|
||||
}
|
||||
|
|
|
@ -184,9 +184,8 @@ uiWindowsDefaultAssignControlIDZorder(uiTab)
|
|||
|
||||
static void tabArrangePages(uiTab *t)
|
||||
{
|
||||
// TODO what should these be called and what should their initial values be? also update box, group, and window
|
||||
LONG_PTR cID = 100;
|
||||
HWND after = NULL;
|
||||
LONG_PTR controlID = 100;
|
||||
HWND insertAfter = NULL;
|
||||
|
||||
// TODO is this first or last?
|
||||
uiWindowsEnsureAssignControlIDZOrder(t->tabHWND, &cid, &after);
|
||||
|
|
|
@ -275,9 +275,6 @@ void uiWindowOnClosing(uiWindow *w, int (*f)(uiWindow *, void *), void *data)
|
|||
|
||||
void uiWindowSetChild(uiWindow *w, uiControl *child)
|
||||
{
|
||||
LONG_PTR id;
|
||||
HWND dummy;
|
||||
|
||||
if (w->child != NULL) {
|
||||
uiControlSetParent(w->child, NULL);
|
||||
uiWindowsControlSetParentHWND(uiWindowsControl(w->child), NULL);
|
||||
|
@ -286,9 +283,7 @@ void uiWindowSetChild(uiWindow *w, uiControl *child)
|
|||
if (w->child != NULL) {
|
||||
uiControlSetParent(w->child, uiControl(w));
|
||||
uiWindowsControlSetParentHWND(uiWindowsControl(w->child), w->hwnd);
|
||||
id = 100;
|
||||
dummy = NULL;
|
||||
uiWindowsControlAssignControlIDZOrder(uiWindowsControl(w->child), &id, &dummy);
|
||||
uiWindowsControlAssignSoleControlIDZOrder(uiWindowsControl(w->child));
|
||||
windowRelayout(w);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,10 +15,12 @@ void uiWindowsEnsureSetParentHWND(HWND hwnd, HWND parent)
|
|||
logLastError(L"error setting window parent");
|
||||
}
|
||||
|
||||
void uiWindowsEnsureAssignControlIDZOrder(HWND hwnd, LONG_PTR controlID, HWND insertAfter)
|
||||
void uiWindowsEnsureAssignControlIDZOrder(HWND hwnd, LONG_PTR *controlID, HWND *insertAfter)
|
||||
{
|
||||
SetWindowLongPtrW(hwnd, GWLP_ID, controlID);
|
||||
setWindowInsertAfter(hwnd, insertAfter);
|
||||
SetWindowLongPtrW(hwnd, GWLP_ID, *controlID);
|
||||
(*controlID)++;
|
||||
setWindowInsertAfter(hwnd, *insertAfter);
|
||||
*insertAfter = hwnd;
|
||||
}
|
||||
|
||||
void uiWindowsEnsureMoveWindowDuringResize(HWND hwnd, intmax_t x, intmax_t y, intmax_t width, intmax_t height)
|
||||
|
|
Loading…
Reference in New Issue