Пример #1
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));
}
Пример #2
0
void uiWindowsControlContinueMinimumSizeChanged(uiWindowsControl *c)
{
	uiControl *parent;

	parent = uiControlParent(uiControl(c));
	if (parent != NULL)
		uiWindowsControlMinimumSizeChanged(uiWindowsControl(parent));
}
Пример #3
0
void uiFormDelete(uiForm *f, int index)
{
	struct formChild fc;

	fc = (*(f->controls))[index];
	uiControlSetParent(fc.c, NULL);
	uiWindowsControlSetParentHWND(uiWindowsControl(fc.c), NULL);
	uiWindowsEnsureDestroyWindow(fc.label);
	f->controls->erase(f->controls->begin() + index);
	formArrangeChildren(f);
	uiWindowsControlMinimumSizeChanged(uiWindowsControl(f));
}
Пример #4
0
void uiGroupSetChild(uiGroup *g, uiControl *child)
{
	if (g->child != NULL) {
		uiControlSetParent(g->child, NULL);
		uiWindowsControlSetParentHWND(uiWindowsControl(g->child), NULL);
	}
	g->child = child;
	if (g->child != NULL) {
		uiControlSetParent(g->child, uiControl(g));
		uiWindowsControlSetParentHWND(uiWindowsControl(g->child), g->hwnd);
		uiWindowsControlAssignSoleControlIDZOrder(uiWindowsControl(g->child));
		uiWindowsControlMinimumSizeChanged(uiWindowsControl(g));
	}
}
Пример #5
0
static void uiWindowShow(uiControl *c)
{
	uiWindow *w = uiWindow(c);

	w->visible = 1;
	// just in case the window's minimum size wasn't recalculated already
	ensureMinimumWindowSize(w);
	if (w->shownOnce) {
		ShowWindow(w->hwnd, SW_SHOW);
		return;
	}
	w->shownOnce = TRUE;
	// make sure the child is the correct size
	uiWindowsControlMinimumSizeChanged(uiWindowsControl(w));
	ShowWindow(w->hwnd, nCmdShow);
	if (UpdateWindow(w->hwnd) == 0)
		logLastError(L"error calling UpdateWindow() after showing uiWindow for the first time");
}
Пример #6
0
void uiImageBoxSetImage(uiImageBox *i, uiImage *image)
{
	HBITMAP bmp = uiImageGetHBITMAP(image);

	// it is a responsibility of the programmer to delete the old bitmap
	HBITMAP old = (HBITMAP) SendMessage(i->hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) bmp);
	if (old && old != bmp)
	{
		DeleteObject(old);
	}

	// sometimes an internal copy is made and bmp must be deleted
	HBITMAP copy = (HBITMAP) SendMessage(i->hwnd, STM_GETIMAGE, IMAGE_BITMAP, 0);
	if (copy && bmp && copy != bmp)
	{
		DeleteObject(bmp);
	}

	// changing the bitmap might necessitate a change in size
	uiWindowsControlMinimumSizeChanged(uiWindowsControl(i));
}
Пример #7
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));
}
Пример #8
0
void uiFormSetPadded(uiForm *f, int padded)
{
	f->padded = padded;
	uiWindowsControlMinimumSizeChanged(uiWindowsControl(f));
}
Пример #9
0
static void uiFormChildVisibilityChanged(uiWindowsControl *c)
{
	// TODO eliminate the redundancy
	uiWindowsControlMinimumSizeChanged(c);
}
Пример #10
0
void uiCheckboxSetText(uiCheckbox *c, const char *text)
{
	uiWindowsSetWindowText(c->hwnd, text);
	// changing the text might necessitate a change in the checkbox's size
	uiWindowsControlMinimumSizeChanged(uiWindowsControl(c));
}
Пример #11
0
void uiGroupSetMargined(uiGroup *g, int margined)
{
	g->margined = margined;
	uiWindowsControlMinimumSizeChanged(uiWindowsControl(g));
}
Пример #12
0
void uiGroupSetTitle(uiGroup *g, const char *text)
{
	uiWindowsSetWindowText(g->hwnd, text);
	// changing the text might necessitate a change in the groupbox's size
	uiWindowsControlMinimumSizeChanged(uiWindowsControl(g));
}