Esempio n. 1
0
uiSpinbox *uiNewSpinbox(int min, int max)
{
	uiSpinbox *s;
	int temp;

	if (min >= max) {
		temp = min;
		min = max;
		max = temp;
	}

	uiWindowsNewControl(uiSpinbox, s);

	s->hwnd = uiWindowsMakeContainer(uiWindowsControl(s), onResize);

	s->edit = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
		L"edit", L"",
		// don't use ES_NUMBER; it doesn't allow typing in a leading -
		ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_TABSTOP,
		hInstance, NULL,
		TRUE);
	uiWindowsEnsureSetParentHWND(s->edit, s->hwnd);

	uiWindowsRegisterWM_COMMANDHandler(s->edit, onWM_COMMAND, uiControl(s));
	uiSpinboxOnChanged(s, defaultOnChanged, NULL);

	recreateUpDown(s);
	s->inhibitChanged = TRUE;
	SendMessageW(s->updown, UDM_SETRANGE32, (WPARAM) min, (LPARAM) max);
	SendMessageW(s->updown, UDM_SETPOS32, 0, (LPARAM) min);
	s->inhibitChanged = FALSE;

	return s;
}
Esempio n. 2
0
void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)
{
	HWND hwnd;
	WCHAR *wtext;
	DWORD groupTabStop;

	// the first radio button gets both WS_GROUP and WS_TABSTOP
	// successive radio buttons get *neither*
	groupTabStop = 0;
	if (r->hwnds->size() == 0)
		groupTabStop = WS_GROUP | WS_TABSTOP;

	wtext = toUTF16(text);
	hwnd = uiWindowsEnsureCreateControlHWND(0,
		L"button", wtext,
		BS_RADIOBUTTON | groupTabStop,
		hInstance, NULL,
		TRUE);
	uiFree(wtext);
	uiWindowsEnsureSetParentHWND(hwnd, r->hwnd);
	uiWindowsRegisterWM_COMMANDHandler(hwnd, onWM_COMMAND, uiControl(r));
	r->hwnds->push_back(hwnd);
	radiobuttonsArrangeChildren(r);
	uiWindowsControlMinimumSizeChanged(uiWindowsControl(r));
}
Esempio n. 3
0
uiImageBox *uiNewImageBox(uiImage* image)
{
	uiImageBox *i;

	uiWindowsNewControl(uiImageBox, i);
	
	i->hwnd = uiWindowsEnsureCreateControlHWND(0,
		L"static", NULL,
		SS_BITMAP | SS_CENTERIMAGE,
		hInstance, NULL,
		TRUE);

	uiImageBoxSetImage(i, image);
	return i;
}
Esempio n. 4
0
uiMultilineEntry *uiNewMultilineEntry(void)
{
	uiMultilineEntry *e;

	uiWindowsNewControl(uiMultilineEntry, e);

	e->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
		L"edit", L"",
		ES_AUTOVSCROLL | ES_LEFT | ES_MULTILINE | ES_NOHIDESEL | ES_WANTRETURN | WS_TABSTOP | WS_VSCROLL,
		hInstance, NULL,
		TRUE);

	uiWindowsRegisterWM_COMMANDHandler(e->hwnd, onWM_COMMAND, uiControl(e));
	uiMultilineEntryOnChanged(e, defaultOnChanged, NULL);

	return e;
}
Esempio n. 5
0
uiEditableCombobox *uiNewEditableCombobox(void)
{
	uiEditableCombobox *c;

	uiWindowsNewControl(uiEditableCombobox, c);

	c->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
		L"combobox", L"",
		CBS_DROPDOWN | WS_TABSTOP,
		hInstance, NULL,
		TRUE);

	uiWindowsRegisterWM_COMMANDHandler(c->hwnd, onWM_COMMAND, uiControl(c));
	uiEditableComboboxOnChanged(c, defaultOnChanged, NULL);

	return c;
}
Esempio n. 6
0
uiCheckbox *uiNewCheckbox(const char *text)
{
	uiCheckbox *c;
	WCHAR *wtext;

	uiWindowsNewControl(uiCheckbox, c);

	wtext = toUTF16(text);
	c->hwnd = uiWindowsEnsureCreateControlHWND(0,
		L"button", wtext,
		BS_CHECKBOX | WS_TABSTOP,
		hInstance, NULL,
		TRUE);
	uiFree(wtext);

	uiWindowsRegisterWM_COMMANDHandler(c->hwnd, onWM_COMMAND, uiControl(c));
	uiCheckboxOnToggled(c, defaultOnToggled, NULL);

	return c;
}
Esempio n. 7
0
uiGroup *uiNewGroup(const char *text)
{
	uiGroup *g;
	WCHAR *wtext;

	uiWindowsNewControl(uiGroup, g);

	wtext = toUTF16(text);
	g->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CONTROLPARENT,
		L"button", wtext,
		BS_GROUPBOX,
		hInstance, NULL,
		TRUE);
	uiFree(wtext);

	if (SetWindowSubclass(g->hwnd, groupSubProc, 0, (DWORD_PTR) g) == FALSE)
		logLastError(L"error subclassing groupbox to handle parent messages");

	return g;
}
Esempio n. 8
0
void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy)
{
	struct formChild fc;
	WCHAR *wlabel;

	fc.c = c;
	wlabel = toUTF16(label);
	fc.label = uiWindowsEnsureCreateControlHWND(0,
		L"STATIC", wlabel,
		SS_LEFT | SS_NOPREFIX,
		hInstance, NULL,
		TRUE);
	uiFree(wlabel);
	uiWindowsEnsureSetParentHWND(fc.label, f->hwnd);
	fc.stretchy = stretchy;
	uiControlSetParent(fc.c, uiControl(f));
	uiWindowsControlSetParentHWND(uiWindowsControl(fc.c), f->hwnd);
	f->controls->push_back(fc);
	formArrangeChildren(f);
	uiWindowsControlMinimumSizeChanged(uiWindowsControl(f));
}
Esempio n. 9
0
uiColorButton *uiNewColorButton(void)
{
	uiColorButton *b;

	uiWindowsNewControl(uiColorButton, b);

	// initial color is black
	b->r = 0.0;
	b->g = 0.0;
	b->b = 0.0;
	b->a = 1.0;

	b->hwnd = uiWindowsEnsureCreateControlHWND(0,
		L"button", L" ",		// TODO; can't use "" TODO
		BS_PUSHBUTTON | WS_TABSTOP,
		hInstance, NULL,
		TRUE);

	uiWindowsRegisterWM_COMMANDHandler(b->hwnd, onWM_COMMAND, uiControl(b));
	uiWindowsRegisterWM_NOTIFYHandler(b->hwnd, onWM_NOTIFY, uiControl(b));
	uiColorButtonOnChanged(b, defaultOnChanged, NULL);

	return b;
}