More Windows control work.

This commit is contained in:
Pietro Gagliardi 2015-08-31 12:33:44 -04:00
parent ec4ac0d596
commit 1a39797a14
14 changed files with 33 additions and 23 deletions

View File

@ -173,7 +173,7 @@ static void radiobuttonsAppend(uiRadioButtons *rr, const char *text)
HWND after; HWND after;
wtext = toUTF16(text); wtext = toUTF16(text);
hwnd = uiWindowsUtilCreateControlHWND(0, hwnd = uiWindowsEnsureCreateControlHWND(0,
L"button", wtext, L"button", wtext,
BS_RADIOBUTTON | WS_TABSTOP, BS_RADIOBUTTON | WS_TABSTOP,
hInstance, NULL, hInstance, NULL,

View File

@ -223,7 +223,7 @@ uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
s = (struct spinbox *) uiNewControl(uiTypeSpinbox()); s = (struct spinbox *) uiNewControl(uiTypeSpinbox());
s->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CLIENTEDGE, s->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
L"edit", L"", L"edit", L"",
// don't use ES_NUMBER; it doesn't allow typing in a leading - // don't use ES_NUMBER; it doesn't allow typing in a leading -
ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_TABSTOP, ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_TABSTOP,

View File

@ -43,7 +43,7 @@ static uiCombobox *finishNewCombobox(DWORD style)
c = (uiCombobox *) uiNewControl(uiComboboxType()); c = (uiCombobox *) uiNewControl(uiComboboxType());
c->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CLIENTEDGE, c->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
L"combobox", L"", L"combobox", L"",
style | WS_TABSTOP, style | WS_TABSTOP,
hInstance, NULL, hInstance, NULL,

View File

@ -59,7 +59,7 @@ void uninitContainer(void)
HWND makeContainer(void) HWND makeContainer(void)
{ {
return uiWindowsUtilCreateControlHWND(WS_EX_CONTROLPARENT, return uiWindowsEnsureCreateControlHWND(WS_EX_CONTROLPARENT,
containerClass, L"", containerClass, L"",
0, 0,
hInstance, NULL, hInstance, NULL,

View File

@ -128,7 +128,7 @@ static uiDateTimePicker *finishNewDateTimePicker(DWORD style)
d = (uiDateTimePicker *) uiNewControl(uiDateTimePickerType()); d = (uiDateTimePicker *) uiNewControl(uiDateTimePickerType());
d->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CLIENTEDGE, d->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
DATETIMEPICK_CLASSW, L"", DATETIMEPICK_CLASSW, L"",
style | WS_TABSTOP, style | WS_TABSTOP,
hInstance, NULL, hInstance, NULL,

View File

@ -85,7 +85,7 @@ uiEntry *uiNewEntry(void)
e = (uiEntry *) uiWindowsNewSingleHWNDControl(uiNewControl()); e = (uiEntry *) uiWindowsNewSingleHWNDControl(uiNewControl());
e->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CLIENTEDGE, e->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
L"edit", L"", L"edit", L"",
ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_TABSTOP, ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_TABSTOP,
hInstance, NULL, hInstance, NULL,

View File

@ -126,7 +126,7 @@ uiGroup *uiNewGroup(const char *text)
g = (uiGroup *) uiNewControl(uiGroupType()); g = (uiGroup *) uiNewControl(uiGroupType());
wtext = toUTF16(text); wtext = toUTF16(text);
g->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CONTROLPARENT, g->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CONTROLPARENT,
L"button", wtext, L"button", wtext,
BS_GROUPBOX, BS_GROUPBOX,
hInstance, NULL, hInstance, NULL,

View File

@ -42,7 +42,7 @@ uiLabel *uiNewLabel(const char *text)
l = (uiLabel *) uiNewControl(uiLabelType()); l = (uiLabel *) uiNewControl(uiLabelType());
wtext = toUTF16(text); wtext = toUTF16(text);
l->hwnd = uiWindowsUtilCreateControlHWND(0, l->hwnd = uiWindowsEnsureCreateControlHWND(0,
L"static", wtext, L"static", wtext,
// SS_LEFTNOWORDWRAP clips text past the end; SS_NOPREFIX avoids accelerator translation // 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) // controls are vertically aligned to the top by default (thanks Xeek in irc.freenode.net/#winapi)

View File

@ -46,7 +46,7 @@ uiProgressBar *uiNewProgressBar(void)
p = (uiProgressBar *) uiNewControl(uiProgressBarType()); p = (uiProgressBar *) uiNewControl(uiProgressBarType());
p->hwnd = uiWindowsUtilCreateControlHWND(0, p->hwnd = uiWindowsEnsureCreateControlHWND(0,
PROGRESS_CLASSW, L"", PROGRESS_CLASSW, L"",
PBS_SMOOTH, PBS_SMOOTH,
hInstance, NULL, hInstance, NULL,

View File

@ -13,8 +13,11 @@ struct uiRadioButtons {
static void onDestroy(uiRadioButtons *); static void onDestroy(uiRadioButtons *);
// TODO uiWindowsDefineControlWithOnDestroy(
uiDefineControlType(uiRadioButtons, uiTypeRadioButtons, struct radiobuttons) uiRadioButtons, // type name
uiRadioButtonsType, // type function
onDestroy(this); // on destroy
)
// TODO arrow keys don't work for changing items // TODO arrow keys don't work for changing items
@ -140,7 +143,7 @@ void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)
HWND after; HWND after;
wtext = toUTF16(text); wtext = toUTF16(text);
hwnd = uiWindowsUtilCreateControlHWND(0, hwnd = uiWindowsEnsureCreateControlHWND(0,
L"button", wtext, L"button", wtext,
BS_RADIOBUTTON | WS_TABSTOP, BS_RADIOBUTTON | WS_TABSTOP,
hInstance, NULL, hInstance, NULL,
@ -172,7 +175,8 @@ uiRadioButtons *uiNewRadioButtons(void)
r->hwnds = newPtrArray(); r->hwnds = newPtrArray();
// TODO uiWindowsFinishNewControl(r, uiRadioButtons);
uiControl(r)->Relayout = radiobuttonsRelayout; uiControl(r)->Relayout = radiobuttonsRelayout;
return r; return r;
} }

View File

@ -30,7 +30,7 @@ uiSeparator *uiNewHorizontalSeparator(void)
s = (uiSeparator *) uiNewControl(uiSeparatorType()); s = (uiSeparator *) uiNewControl(uiSeparatorType());
s->hwnd = uiWindowsUtilCreateControlHWND(0, s->hwnd = uiWindowsEnsureCreateControlHWND(0,
L"static", L"", L"static", L"",
SS_ETCHEDHORZ, SS_ETCHEDHORZ,
hInstance, NULL, hInstance, NULL,

View File

@ -61,7 +61,7 @@ uiSlider *uiNewSlider(intmax_t min, intmax_t max)
s = (uiSlider *) uiNewControl(uiSliderType()); s = (uiSlider *) uiNewControl(uiSliderType());
s->hwnd = uiWindowsUtilCreateControlHWND(0, s->hwnd = uiWindowsEnsureCreateControlHWND(0,
TRACKBAR_CLASSW, L"", TRACKBAR_CLASSW, L"",
TBS_HORZ | TBS_TOOLTIPS | TBS_TRANSPARENTBKGND | WS_TABSTOP, TBS_HORZ | TBS_TOOLTIPS | TBS_TRANSPARENTBKGND | WS_TABSTOP,
hInstance, NULL, hInstance, NULL,

View File

@ -12,8 +12,11 @@ struct uiSpinbox {
static void onDestroy(uiSpinbox *); static void onDestroy(uiSpinbox *);
// TODO uiWindowsDefineControlWithOnDestroy(
uiDefineControlType(uiSpinbox, uiTypeSpinbox, struct spinbox) uiSpinbox, // type name
uiSpinboxType, // type function
onDestroy(this); // on destroy
)
// utility functions // utility functions
@ -190,7 +193,7 @@ uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
s = (uiSpinbox *) uiNewControl(uiSpinboxType()); s = (uiSpinbox *) uiNewControl(uiSpinboxType());
s->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CLIENTEDGE, s->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
L"edit", L"", L"edit", L"",
// don't use ES_NUMBER; it doesn't allow typing in a leading - // don't use ES_NUMBER; it doesn't allow typing in a leading -
ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_TABSTOP, ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_TABSTOP,
@ -206,7 +209,7 @@ uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
SendMessageW(s->updown, UDM_SETPOS32, 0, (LPARAM) min); SendMessageW(s->updown, UDM_SETPOS32, 0, (LPARAM) min);
s->inhibitChanged = FALSE; s->inhibitChanged = FALSE;
// TODO uiWindowsFinishNewControl(s, uiSpinbox);
return s; return s;
} }

View File

@ -13,8 +13,11 @@ struct uiTab {
static void onDestroy(uiTab *); static void onDestroy(uiTab *);
// TODO uiWindowsDefineControlWithOnDestroy(
uiDefineControlType(uiTab, uiTypeTab, struct tab) uiTab, // type name
uiTabType, // type function
onDestroy(this); // on destroy
)
// utility functions // utility functions
@ -223,7 +226,7 @@ uiTab *uiNewTab(void)
t = (struct tab *) uiWindowsNewSingleHWNDControl(uiTypeTab()); t = (struct tab *) uiWindowsNewSingleHWNDControl(uiTypeTab());
t->hwnd = uiWindowsUtilCreateControlHWND(0, // don't set WS_EX_CONTROLPARENT yet; we do that dynamically in the message loop (see below) t->hwnd = uiWindowsEnsureCreateControlHWND(0, // don't set WS_EX_CONTROLPARENT yet; we do that dynamically in the message loop (see below)
WC_TABCONTROLW, L"", WC_TABCONTROLW, L"",
// don't give WS_TABSTOP here; we only apply WS_TABSTOP if there are tabs // don't give WS_TABSTOP here; we only apply WS_TABSTOP if there are tabs
TCS_TOOLTIPS, TCS_TOOLTIPS,
@ -234,7 +237,7 @@ uiTab *uiNewTab(void)
t->pages = newPtrArray(); t->pages = newPtrArray();
// TODO uiWindowsFinishNewControl(t, uiTab);
uiControl(t)->ContainerUpdateState = tabContainerUpdateState; uiControl(t)->ContainerUpdateState = tabContainerUpdateState;
uiWindowsControl(t)->Relayout = tabRelayout; uiWindowsControl(t)->Relayout = tabRelayout;