diff --git a/redo/ui_windows.h b/redo/ui_windows.h index 309d1b68..d0699812 100644 --- a/redo/ui_windows.h +++ b/redo/ui_windows.h @@ -17,7 +17,7 @@ _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 void uiWindowsUtilStartZOrder(HWND hwnd, uiControlSysFuncParams *p); +_UI_EXTERN int uiWindowsUtilStartZOrder(HWND hwnd, uiControlSysFuncParams *p); _UI_EXTERN uiControl *uiWindowsNewSingleHWNDControl(uintmax_t type); // This contains the Windows-specific parts of the uiSizing structure. diff --git a/redo/windows/control.c b/redo/windows/control.c index d52afac5..6308d6bf 100644 --- a/redo/windows/control.c +++ b/redo/windows/control.c @@ -8,7 +8,7 @@ HWND uiWindowsUtilCreateControlHWND(DWORD dwExStyle, LPCWSTR lpClassName, LPCWST HWND hwnd; hwnd = CreateWindowExW(dwExStyle, - lpClassName, lpWIndowName, + lpClassName, lpWindowName, dwStyle | WS_CHILD | WS_VISIBLE, 0, 0, // use a nonzero initial size just in case some control breaks with a zero initial size @@ -66,7 +66,7 @@ static uiSizing *singleHWNDSizing(uiControl *c) return uiWindowsSizing(c); } -void uiWIndowsUtilShow(HWND hwnd) +void uiWindowsUtilShow(HWND hwnd) { ShowWindow(hwnd, SW_SHOW); } @@ -86,7 +86,7 @@ static void singleHWNDCommitHide(uiControl *c) uiWindowsUtilHide(HWND(c)); } -void uiWIndowsUtilEnable(HWND hwnd) +void uiWindowsUtilEnable(HWND hwnd) { EnableWindow(hwnd, TRUE); } @@ -128,7 +128,7 @@ static void singleHWNDSysFunc(uiControl *c, uiControlSysFuncParams *p) uiWindowsUtilSysFunc(HWND(c), p); } -void uiWindowsUtilStartZOrder(HWND hwnd, uiControlSysFuncParams *p) +int uiWindowsUtilStartZOrder(HWND hwnd, uiControlSysFuncParams *p) { HWND insertAfter; @@ -137,11 +137,12 @@ void uiWindowsUtilStartZOrder(HWND hwnd, uiControlSysFuncParams *p) if (insertAfter == NULL) logLastError("error getting insert after window in uiWindowsUtilStartZOrder()"); p->InsertAfter = insertAfter; + return 1; } -static void singleHWNDStartZOrder(uiControl *c, uiControlSysFuncParams *p) +static int singleHWNDStartZOrder(uiControl *c, uiControlSysFuncParams *p) { - uiWindowsUtilStartZOrder(HWND(c), p); + return uiWindowsUtilStartZOrder(HWND(c), p); } void setSingleHWNDFuncs(uiControl *c) @@ -151,7 +152,7 @@ void setSingleHWNDFuncs(uiControl *c) uiControl(c)->Resize = singleHWNDResize; uiControl(c)->Sizing = singleHWNDSizing; uiControl(c)->CommitShow = singleHWNDCommitShow; - uiControl(c)->CommitHide = singleHWNDCommitHide + uiControl(c)->CommitHide = singleHWNDCommitHide; uiControl(c)->CommitEnable = singleHWNDCommitEnable; uiControl(c)->CommitDisable = singleHWNDCommitDisable; uiControl(c)->SysFunc = singleHWNDSysFunc; diff --git a/redo/windows/datetimepicker.c b/redo/windows/datetimepicker.c index 4b028600..0aa3e31e 100644 --- a/redo/windows/datetimepicker.c +++ b/redo/windows/datetimepicker.c @@ -32,9 +32,8 @@ static void datetimepickerPreferredSize(uiControl *c, uiSizing *d, intmax_t *wid uiDateTimePicker *finishNewDateTimePicker(DWORD style, WCHAR *format) { struct datetimepicker *d; - uiWindowsMakeControlParams p; - d = (struct datetimepicker *) uiWindowsNewSingleHWNDControluiTypeDateTimePicker()); + d = (struct datetimepicker *) uiWindowsNewSingleHWNDControl(uiTypeDateTimePicker()); d->hwnd = uiWindowsUtilCreateControlHWND(0, // TODO client edge? DATETIMEPICK_CLASSW, L"", diff --git a/redo/windows/entry.c b/redo/windows/entry.c index fdbd7aa9..78e5efeb 100644 --- a/redo/windows/entry.c +++ b/redo/windows/entry.c @@ -103,7 +103,7 @@ uiEntry *uiNewEntry(void) e = (struct entry *) uiWindowsNewSingleHWNDControl(uiTypeEntry()); - e->hwnd = uiWindowsNewSingleHWNDControl(WS_EX_CLIENTEDGE, + e->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CLIENTEDGE, L"edit", L"", ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_TABSTOP, hInstance, NULL, diff --git a/redo/windows/group.c b/redo/windows/group.c index c853cf86..c625fd81 100644 --- a/redo/windows/group.c +++ b/redo/windows/group.c @@ -35,7 +35,7 @@ uiGroup *uiNewGroup(const char *text) g = (struct group *) uiWindowsNewSingleHWNDControl(uiTypeGroup()); wtext = toUTF16(text); - g->hwnd = uiWindowsNewSingleHWNDControl(WS_EX_CONTROLPARENT, + g->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CONTROLPARENT, L"button", wtext, BS_GROUPBOX, hInstance, NULL, diff --git a/redo/windows/label.c b/redo/windows/label.c index 6abd4d59..d629ae1a 100644 --- a/redo/windows/label.c +++ b/redo/windows/label.c @@ -44,7 +44,7 @@ uiLabel *uiNewLabel(const char *text) l = (struct label *) uiWindowsNewSingleHWNDControl(uiTypeLabel()); wtext = toUTF16(text); - l->hwnd = uiWindowsNewSingleHWNDControl(0, + l->hwnd = uiWindowsUtilCreateControlHWND(0, L"static", wtext, // SS_LEFTNOWORDWRAP clips text past the end; SS_NOPREFIX avoids accelerator translation // controls are vertically aligned to the top by default (thanks Xeek in irc.freenode.net/#winapi) diff --git a/redo/windows/progressbar.c b/redo/windows/progressbar.c index f2f78c12..6c5b7678 100644 --- a/redo/windows/progressbar.c +++ b/redo/windows/progressbar.c @@ -41,7 +41,7 @@ uiProgressBar *uiNewProgressBar(void) p = (struct progressbar *) uiWindowsNewSingleHWNDControl(uiTypeProgressBar()); - p->hwnd = uiWindowsNewSingleHWNDControl(0, + p->hwnd = uiWindowsUtilCreateControlHWND(0, PROGRESS_CLASSW, L"", PBS_SMOOTH, hInstance, NULL, diff --git a/redo/windows/separator.c b/redo/windows/separator.c index 5363387d..0282e6ee 100644 --- a/redo/windows/separator.c +++ b/redo/windows/separator.c @@ -35,7 +35,7 @@ uiSeparator *uiNewHorizontalSeparator(void) s = (struct separator *) uiWindowsNewSingleHWNDControl(uiTypeSeparator()); - s->hwnd = uiWindowsNewSingleHWNDControl(0, + s->hwnd = uiWindowsUtilCreateControlHWND(0, L"static", L"", SS_ETCHEDHORZ, hInstance, NULL, diff --git a/redo/windows/slider.c b/redo/windows/slider.c index cf8e1ff8..3c156277 100644 --- a/redo/windows/slider.c +++ b/redo/windows/slider.c @@ -85,7 +85,7 @@ uiSlider *uiNewSlider(intmax_t min, intmax_t max) s = (struct slider *) uiWindowsNewSingleHWNDControl(uiTypeSlider()); - s->hwnd = uiWindowsNewSingleHWNDControl(0, + s->hwnd = uiWindowsUtilCreateControlHWND(0, TRACKBAR_CLASSW, L"", // TODO TBS_TRANSPARENTBKGND when making Vista-only TBS_HORZ | TBS_TOOLTIPS | WS_TABSTOP, diff --git a/redo/windows/spinbox.c b/redo/windows/spinbox.c index 5a564507..99c59908 100644 --- a/redo/windows/spinbox.c +++ b/redo/windows/spinbox.c @@ -164,7 +164,7 @@ uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max) s = (struct spinbox *) uiWindowsNewSingleHWNDControl(uiTypeSpinbox()); - s->hwnd = uiWindowsNewSingleHWNDControl(WS_EX_CLIENTEDGE, + s->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CLIENTEDGE, L"edit", L"", // TODO ES_NUMBER doesn't allow typing in a leading - ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | ES_NUMBER | WS_TABSTOP, diff --git a/redo/windows/tab.c b/redo/windows/tab.c index 87ee1f6f..569a2f67 100644 --- a/redo/windows/tab.c +++ b/redo/windows/tab.c @@ -214,7 +214,7 @@ uiTab *uiNewTab(void) t = (struct tab *) uiWindowsNewSingleHWNDControl(uiTypeTab()); - t->hwnd = uiWindowsNewSingleHWNDControl(0, // don't set WS_EX_CONTROLPARENT yet; we do that dynamically in the message loop (see main_windows.c) + t->hwnd = uiWindowsUtilCreateControlHWND(0, // don't set WS_EX_CONTROLPARENT yet; we do that dynamically in the message loop (see main_windows.c) WC_TABCONTROLW, L"", TCS_TOOLTIPS | WS_TABSTOP, // start with this; we will alternate between this and WS_EX_CONTROLPARENT as needed (see main.c and msgHasTabStops above and the toggling functions below) hInstance, NULL,