void CustomControlWindowApp::addControls() { Gwen::Controls::Button *btn = new Gwen::Controls::Button( mCanvas ); btn->SetBounds( getWindowCenter().x - 40, getWindowCenter().y - 20, 80, 40 ); btn->SetText( "Click Me" ); btn->onPress.Add( this, &CustomControlWindowApp::buttonPressed ); btn->AddAccelerator( "x" ); }
void CLoadState::Begin() { // Load References SingletonPointer<CMainState> MainState; SingletonPointer<CMainMenuState> MenuState; Canvas = GUIManager->GetCanvas(); // Init Canvas Canvas->SetBackgroundColor(Gwen::Color(32, 48, 48)); Canvas->SetDrawBackground(true); // Top Label Gwen::Controls::Label * BigLabel = new Gwen::Controls::Label(Canvas); BigLabel->SetFont(GUIManager->GetLargeFont()); BigLabel->SetText(L"Loading..."); BigLabel->SetBounds(10, 10, 1590, 300); BigLabel->SetTextColor(Gwen::Color(255, 255, 255, 84)); GUIManager->Draw(0, true); Context->Window->SwapBuffers(); AddLabel(L"Initializing System..."); CGUIEventManager * Forwarder = new CGUIEventManager(GUIManager->GetCanvas(), Context->Window); AddLabel(L"Loading Scene Shaders..."); LoadShaders(); AddLabel(L"Loading Scene Objects..."); LoadScene(); AddLabel(L"Menu is Starting..."); if (GetConfirmation) { Gwen::Controls::Button * Button = new Gwen::Controls::Button(GUIManager->GetCanvas()); Button->SetBounds(250, 650, 250, 35); Button->SetText(L"Continue"); Button->onPress.Add(& Handler, & CLoadStateEventHandler::OnFinish); } else { OnFinish(); } }
CGUIControlPanelWidget::CGUIControlPanelWidget() { Window = new Gwen::Controls::WindowControl(GUIManager->GetCanvas()); Window->SetDeleteOnClose(false); Window->SetBounds(30, 600, 660 + 30 + 165 + 165, 85); Window->SetTitle("Control Panel"); Window->SetClosable(false); Gwen::Controls::Button * EnableButton = new Gwen::Controls::Button(Window); EnableButton->SetBounds(15, 10, 150, 35); EnableButton->SetText("Volume Controls"); EnableButton->onPress.Add(this, & CGUIControlPanelWidget::OnToggleVolume); EnableButton = new Gwen::Controls::Button(Window); EnableButton->SetBounds(180, 10, 150, 35); EnableButton->SetText("Terrain Controls"); EnableButton->onPress.Add(this, & CGUIControlPanelWidget::OnToggleTerrain); EnableButton = new Gwen::Controls::Button(Window); EnableButton->SetBounds(345, 10, 150, 35); EnableButton->SetText("Glyph Controls"); EnableButton->onPress.Add(this, & CGUIControlPanelWidget::OnToggleGlyph); EnableButton = new Gwen::Controls::Button(Window); EnableButton->SetBounds(510, 10, 150, 35); EnableButton->SetText("Scene Controls"); EnableButton->onPress.Add(this, & CGUIControlPanelWidget::OnToggleScene); EnableButton = new Gwen::Controls::Button(Window); EnableButton->SetBounds(675, 10, 150, 35); EnableButton->SetText("Shark Controls"); EnableButton->onPress.Add(this, &CGUIControlPanelWidget::OnToggleShark); EnableButton = new Gwen::Controls::Button(Window); EnableButton->SetBounds(840, 10, 150, 35); EnableButton->SetText("Graph Display"); EnableButton->onPress.Add(this, &CGUIControlPanelWidget::OnToggleGraph); }
MyWindow ( Gwen::Controls::Base* pParent) : Gwen::Controls::WindowControl( pParent ) { SetTitle( L"FEM Settings" ); SetSize( 200, 300 ); this->Dock( Gwen::Pos::Left ); m_TextOutput = new Gwen::Controls::ListBox( this ); m_TextOutput->Dock( Gwen::Pos::Bottom ); m_TextOutput->SetHeight( 100 ); { Gwen::Controls::GroupBox* pGroup = new Gwen::Controls::GroupBox( this ); pGroup->SetPos(5, 5); pGroup->SetSize(170, 45); // pGroup->Dock( Gwen::Pos::Fill ); pGroup->SetText( "Young modulus" ); Gwen::Controls::HorizontalSlider* pSlider = new Gwen::Controls::HorizontalSlider( pGroup ); pSlider->SetPos( 5, 10 ); pSlider->SetSize( 130, 20 ); pSlider->SetRange( 0, 100 ); pSlider->SetValue( 25 ); pSlider->onValueChanged.Add( this, &MyWindow::SliderMoved); } Gwen::Controls::CheckBoxWithLabel* labeled = new Gwen::Controls::CheckBoxWithLabel( this ); labeled->SetPos( 10, 55); labeled->Checkbox()->SetChecked(true); labeled->Label()->SetText( "Stifness warping" ); // labeled->Checkbox()->onChecked.Add( handler, &MyHander::OnCheckedStiffnessWarping ); // labeled->Checkbox()->onUnChecked.Add( handler, &MyHander::OnUncheckedStiffnessWarping ); labeled->Checkbox()->onCheckChanged.Add( this, &MyWindow::OnCheckChangedStiffnessWarping ); // Gwen::Align::PlaceBelow( labeled, check, 10 ); if (0) { Gwen::Controls::GroupBox* pGroup = new Gwen::Controls::GroupBox( this ); pGroup->SetPos(5, 55); pGroup->SetSize(170, 45); // pGroup->Dock( Gwen::Pos::Fill ); pGroup->SetText( "Gravity" ); Gwen::Controls::HorizontalSlider* pSlider = new Gwen::Controls::HorizontalSlider( pGroup); pSlider->SetPos( 5, 10 ); pSlider->SetSize( 130, 20 ); pSlider->SetRange( 0, 100 ); pSlider->SetValue( 25 ); pSlider->SetNotchCount( 10 ); pSlider->SetClampToNotches( true ); // pSlider->onValueChanged.Add( this, &Slider::SliderMoved ); } Gwen::Controls::Button* pButton = new Gwen::Controls::Button( this ); pButton->onPress.Add(this, &MyWindow::onButtonA); pButton->SetBounds( 5, 110, 170, 45); pButton->SetText( "Toggle simulation" ); }