GWEN_CONTROL_INLINE( Checkbox, GUnit ) { Gwen::Controls::CheckBox* check = new Gwen::Controls::CheckBox( this ); check->SetPos( 10, 10 ); check->onChecked.Add( this, &Checkbox::OnChecked ); check->onUnChecked.Add( this, &Checkbox::OnUnchecked ); check->onCheckChanged.Add( this, &Checkbox::OnCheckChanged ); Gwen::Controls::CheckBoxWithLabel* labeled = new Gwen::Controls::CheckBoxWithLabel( this ); labeled->SetPos( 10, 10 ); labeled->Label()->SetText( "Labeled CheckBox" ); labeled->Checkbox()->onChecked.Add( this, &Checkbox::OnChecked ); labeled->Checkbox()->onUnChecked.Add( this, &Checkbox::OnUnchecked ); labeled->Checkbox()->onCheckChanged.Add( this, &Checkbox::OnCheckChanged ); Gwen::Align::PlaceBelow( labeled, check, 10 ); }
Gwen::Controls::Base* SettingsPanel::addCheckBox( Gwen::Controls::Base* pControl , Rectf bounds, string name, bool selected){ Gwen::Controls::CheckBoxWithLabel* labeled = new Gwen::Controls::CheckBoxWithLabel( pControl ); // int px = bounds.getX1(); // int py = bounds.getY1(); // int w = bounds.getWidth(); // labeled->SetName( name ); // labeled->SetPos( px, py ); labeled->Dock( Gwen::Pos::Top ); labeled->SetMargin( Gwen::Margin(5,7,5,7) ); labeled->SetHeight( 20 ); labeled->Label()->SetText( name ); // labeled->Label()->SetName( name ); labeled->Checkbox()->SetChecked(selected); labeled->Checkbox()->SetName( name ); labeled->Checkbox()->onCheckChanged.Add( this, &SettingsPanel::onCheckBoxLaserOutput ); mSliderValueMap[name] = labeled; return labeled; }
GWEN_CONTROL_INLINE( Checkbox, GUnit ) { Gwen::Controls::CheckBox* check = new Gwen::Controls::CheckBox( this ); check->SetPos( 10, 10 ); check->onChecked.Add( this, &Checkbox::OnChecked ); check->onUnChecked.Add( this, &Checkbox::OnUnchecked ); check->onCheckChanged.Add( this, &Checkbox::OnCheckChanged ); Gwen::Controls::CheckBoxWithLabel* labeled = new Gwen::Controls::CheckBoxWithLabel( this ); labeled->SetPos( 10, 30 ); labeled->Label()->SetText( "Labeled CheckBox" ); labeled->Checkbox()->onChecked.Add( this, &Checkbox::OnChecked ); labeled->Checkbox()->onUnChecked.Add( this, &Checkbox::OnUnchecked ); labeled->Checkbox()->onCheckChanged.Add( this, &Checkbox::OnCheckChanged ); { Gwen::Controls::CheckBox* check = new Gwen::Controls::CheckBox( this ); check->SetPos( 10, 54 ); check->SetDisabled( true ); } }
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" ); }