コード例 #1
0
ファイル: spinbox.cpp プロジェクト: Alcaro/RetroArch
static void uiSpinboxDestroy(uiControl *c)
{
	uiSpinbox *s = uiSpinbox(c);

	uiWindowsUnregisterWM_COMMANDHandler(s->edit);
	uiWindowsEnsureDestroyWindow(s->updown);
	uiWindowsEnsureDestroyWindow(s->edit);
	uiWindowsEnsureDestroyWindow(s->hwnd);
	uiFreeControl(uiControl(s));
}
コード例 #2
0
ファイル: radiobuttons.cpp プロジェクト: 123vipulj/libui
static void uiRadioButtonsDestroy(uiControl *c)
{
	uiRadioButtons *r = uiRadioButtons(c);

	for (const HWND &hwnd : *(r->hwnds)) {
		uiWindowsUnregisterWM_COMMANDHandler(hwnd);
		uiWindowsEnsureDestroyWindow(hwnd);
	}
	delete r->hwnds;
	uiWindowsEnsureDestroyWindow(r->hwnd);
	uiFreeControl(uiControl(r));
}
コード例 #3
0
ファイル: form.cpp プロジェクト: StapleButter/melonDS
static void uiFormDestroy(uiControl *c)
{
	uiForm *f = uiForm(c);

	for (const struct formChild &fc : *(f->controls)) {
		uiControlSetParent(fc.c, NULL);
		uiControlDestroy(fc.c);
		uiWindowsEnsureDestroyWindow(fc.label);
	}
	delete f->controls;
	uiWindowsEnsureDestroyWindow(f->hwnd);
	uiFreeControl(uiControl(f));
}
コード例 #4
0
ファイル: spinbox.cpp プロジェクト: Alcaro/RetroArch
// an up-down control will only properly position itself the first time
// stupidly, there are no messages to force a size calculation, nor can I seem to reset the buddy window to force a new position
// alas, we have to make a new up/down control each time :(
static void recreateUpDown(uiSpinbox *s)
{
	BOOL preserve = FALSE;
	int current;
	// Microsoft's commctrl.h says to use this type
	INT min, max;

	if (s->updown != NULL) {
		preserve = TRUE;
		current = value(s);
		SendMessageW(s->updown, UDM_GETRANGE32, (WPARAM) (&min), (LPARAM) (&max));
		uiWindowsEnsureDestroyWindow(s->updown);
	}
	s->inhibitChanged = TRUE;
	s->updown = CreateWindowExW(0,
		UPDOWN_CLASSW, L"",
		// no WS_VISIBLE; we set visibility ourselves
		// up-down control should not be a tab stop
		WS_CHILD | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_HOTTRACK | UDS_NOTHOUSANDS | UDS_SETBUDDYINT,
		// this is important; it's necessary for autosizing to work
		0, 0, 0, 0,
		s->hwnd, NULL, hInstance, NULL);
	if (s->updown == NULL)
		logLastError(L"error creating updown");
	SendMessageW(s->updown, UDM_SETBUDDY, (WPARAM) (s->edit), 0);
	if (preserve) {
		SendMessageW(s->updown, UDM_SETRANGE32, (WPARAM) min, (LPARAM) max);
		SendMessageW(s->updown, UDM_SETPOS32, 0, (LPARAM) current);
	}
	// preserve the Z-order
	spinboxArrangeChildren(s);
	// TODO properly show/enable
	ShowWindow(s->updown, SW_SHOW);
	s->inhibitChanged = FALSE;
}
コード例 #5
0
ファイル: multilineentry.cpp プロジェクト: 123vipulj/libui
static void uiMultilineEntryDestroy(uiControl *c)
{
	uiMultilineEntry *e = uiMultilineEntry(c);

	uiWindowsUnregisterWM_COMMANDHandler(e->hwnd);
	uiWindowsEnsureDestroyWindow(e->hwnd);
	uiFreeControl(uiControl(e));
}
コード例 #6
0
ファイル: imagebox.cpp プロジェクト: mdombroski/libui
static void uiImageBoxDestroy(uiControl *c)
{
	uiImageBox *b = uiImageBox(c);
	
	uiImageBoxSetImage(b, NULL);
	uiWindowsEnsureDestroyWindow(b->hwnd);
	uiFreeControl(uiControl(b));
}
コード例 #7
0
ファイル: editablecombo.cpp プロジェクト: NoSuchProcess/libui
void uiEditableComboboxDestroy(uiControl *cc)
{
	uiEditableCombobox *c = uiEditableCombobox(cc);

	uiWindowsUnregisterWM_COMMANDHandler(c->hwnd);
	uiWindowsEnsureDestroyWindow(c->hwnd);
	uiFreeControl(uiControl(c));
}
コード例 #8
0
ファイル: colorbutton.cpp プロジェクト: 123vipulj/libui
static void uiColorButtonDestroy(uiControl *c)
{
	uiColorButton *b = uiColorButton(c);

	uiWindowsUnregisterWM_COMMANDHandler(b->hwnd);
	uiWindowsUnregisterWM_NOTIFYHandler(b->hwnd);
	uiWindowsEnsureDestroyWindow(b->hwnd);
	uiFreeControl(uiControl(b));
}
コード例 #9
0
ファイル: group.cpp プロジェクト: Alcaro/RetroArch
static void uiGroupDestroy(uiControl *c)
{
	uiGroup *g = uiGroup(c);

	if (g->child != NULL) {
		uiControlSetParent(g->child, NULL);
		uiControlDestroy(g->child);
	}
	uiWindowsEnsureDestroyWindow(g->hwnd);
	uiFreeControl(uiControl(g));
}
コード例 #10
0
ファイル: colordialog.cpp プロジェクト: StapleButter/melonDS
// TODO extract into d2dscratch.cpp, use in font dialog
HWND replaceWithD2DScratch(HWND parent, int id, SUBCLASSPROC subproc, void *data)
{
	HWND replace;
	RECT r;

	replace = getDlgItem(parent, id);
	uiWindowsEnsureGetWindowRect(replace, &r);
	mapWindowRect(NULL, parent, &r);
	uiWindowsEnsureDestroyWindow(replace);
	return newD2DScratch(parent, &r, (HMENU) id, subproc, (DWORD_PTR) data);
	// TODO preserve Z-order
}
コード例 #11
0
ファイル: form.cpp プロジェクト: StapleButter/melonDS
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));
}
コード例 #12
0
ファイル: window.cpp プロジェクト: 08opt/libui
static void uiWindowDestroy(uiControl *c)
{
	uiWindow *w = uiWindow(c);

	// first hide ourselves
	ShowWindow(w->hwnd, SW_HIDE);
	// now destroy the child
	if (w->child != NULL) {
		uiControlSetParent(w->child, NULL);
		uiControlDestroy(w->child);
	}
	// now free the menubar, if any
	if (w->menubar != NULL)
		freeMenubar(w->menubar);
	// and finally free ourselves
	windows.erase(w);
	uiWindowsEnsureDestroyWindow(w->hwnd);
	uiFreeControl(uiControl(w));
}
コード例 #13
0
ファイル: fontdialog.cpp プロジェクト: Alcaro/RetroArch
static struct fontDialog *beginFontDialog(HWND hwnd, LPARAM lParam)
{
	struct fontDialog *f;
	UINT32 i, nFamilies;
	IDWriteFontFamily *family;
	WCHAR *wname;
	LRESULT pos;
	HWND samplePlacement;
	HRESULT hr;

	f = uiNew(struct fontDialog);
	f->hwnd = hwnd;
	f->params = (struct fontDialogParams *) lParam;

	f->familyCombobox = getDlgItem(f->hwnd, rcFontFamilyCombobox);
	f->styleCombobox = getDlgItem(f->hwnd, rcFontStyleCombobox);
	f->sizeCombobox = getDlgItem(f->hwnd, rcFontSizeCombobox);

	f->fc = loadFontCollection();
	nFamilies = f->fc->fonts->GetFontFamilyCount();
	for (i = 0; i < nFamilies; i++) {
		hr = f->fc->fonts->GetFontFamily(i, &family);
		if (hr != S_OK)
			logHRESULT(L"error getting font family", hr);
		wname = fontCollectionFamilyName(f->fc, family);
		pos = cbAddString(f->familyCombobox, wname);
		uiFree(wname);
		cbSetItemData(f->familyCombobox, (WPARAM) pos, (LPARAM) family);
	}

	for (i = 0; defaultSizes[i].text != NULL; i++)
		cbInsertString(f->sizeCombobox, defaultSizes[i].text, (WPARAM) i);

	samplePlacement = getDlgItem(f->hwnd, rcFontSamplePlacement);
	uiWindowsEnsureGetWindowRect(samplePlacement, &(f->sampleRect));
	mapWindowRect(NULL, f->hwnd, &(f->sampleRect));
	uiWindowsEnsureDestroyWindow(samplePlacement);
	f->sampleBox = newD2DScratch(f->hwnd, &(f->sampleRect), (HMENU) rcFontSamplePlacement, fontDialogSampleSubProc, (DWORD_PTR) f);

	setupInitialFontDialogState(f);
	return f;
}