Direct2DWindow() :GuiWindow(GetCurrentTheme()->CreateWindowStyle()) { SetText(L"Rendering.RawAPI.Direct2D"); SetClientSize(Size(640, 480)); GetBoundsComposition()->SetPreferredMinSize(Size(640, 480)); MoveToScreenCenter(); { GuiDirect2DElement* element=GuiDirect2DElement::Create(); element->Rendering.AttachMethod(this, &Direct2DWindow::element_Rendering); element->BeforeRenderTargetChanged.AttachMethod(this, &Direct2DWindow::element_BeforeRenderTargetChanged); element->AfterRenderTargetChanged.AttachMethod(this, &Direct2DWindow::element_AfterRenderTargetChanged); GuiBoundsComposition* composition=new GuiBoundsComposition; composition->SetAlignmentToParent(Margin(0, 0, 0, 0)); composition->SetOwnedElement(element); GetContainerComposition()->AddChild(composition); } }
void GuiComboBoxListControl::InstallStyleController(vint itemIndex) { if (itemBindingView != nullptr && itemStyleProvider) { if (itemIndex != -1) { auto item = itemBindingView->GetBindingValue(itemIndex); if (!item.IsNull()) { itemStyleController = itemStyleProvider->CreateItemStyle(item); if (itemStyleController) { itemStyleController->SetText(GetText()); itemStyleController->SetFont(GetFont()); itemStyleController->SetVisuallyEnabled(GetVisuallyEnabled()); auto composition = itemStyleController->GetBoundsComposition(); composition->SetAlignmentToParent(Margin(0, 0, 0, 0)); GetContainerComposition()->AddChild(composition); } } } } }
bool GuiControl::AddChild(GuiControl* control) { return GetContainerComposition()->AddChild(control->GetBoundsComposition()); }