void GwenParameterInterface::registerSliderFloatParameter(SliderParams& params) { Gwen::Controls::TextBox* label = new Gwen::Controls::TextBox(m_gwenInternalData->m_demoPage->GetPage()); m_paramInternalData->m_textLabels.push_back(label); //m_data->m_myControls.push_back(label); label->SetText( params.m_name); label->SetPos( 10, 10 + 25 ); label->SetWidth(110); label->SetPos(10,m_gwenInternalData->m_curYposition); m_gwenInternalData->m_curYposition+=22; Gwen::Controls::HorizontalSlider* pSlider = new Gwen::Controls::HorizontalSlider( m_gwenInternalData->m_demoPage->GetPage()); m_paramInternalData->m_sliders.push_back(pSlider); //m_data->m_myControls.push_back(pSlider); pSlider->SetPos( 10, m_gwenInternalData->m_curYposition ); pSlider->SetSize( 100, 20 ); pSlider->SetRange( params.m_minVal, params.m_maxVal); pSlider->SetNotchCount(20);//float(params.m_maxVal-params.m_minVal)/100.f); pSlider->SetClampToNotches( params.m_clampToNotches ); pSlider->SetValue( *params.m_paramValuePointer);//dimensions[i] ); char labelName[1024]; sprintf(labelName,"%s",params.m_name);//axisNames[0]); MySliderEventHandler<btScalar>* handler = new MySliderEventHandler<btScalar>(labelName,label,pSlider,params.m_paramValuePointer); m_paramInternalData->m_sliderEventHandlers.push_back(handler); pSlider->onValueChanged.Add( handler, &MySliderEventHandler<btScalar>::SliderMoved ); handler->SliderMoved(pSlider); float v = pSlider->GetValue(); m_gwenInternalData->m_curYposition+=22; }
GWEN_CONTROL_INLINE( Slider, GUnit ) { { Gwen::Controls::HorizontalSlider* pSlider = new Gwen::Controls::HorizontalSlider( this ); pSlider->SetPos( 10, 10 ); pSlider->SetSize( 150, 20 ); pSlider->SetRange( 0, 100 ); pSlider->SetValue( 25 ); pSlider->onValueChanged.Add( this, &Slider::SliderMoved ); } { Gwen::Controls::HorizontalSlider* pSlider = new Gwen::Controls::HorizontalSlider( this ); pSlider->SetPos( 10, 40 ); pSlider->SetSize( 150, 20 ); pSlider->SetRange( 0, 100 ); pSlider->SetValue( 20 ); pSlider->SetNotchCount( 10 ); pSlider->SetClampToNotches( true ); pSlider->onValueChanged.Add( this, &Slider::SliderMoved ); } { Gwen::Controls::VerticalSlider* pSlider = new Gwen::Controls::VerticalSlider( this ); pSlider->SetPos( 160, 10 ); pSlider->SetSize( 20, 200 ); pSlider->SetRange( 0, 100 ); pSlider->SetValue( 25 ); pSlider->onValueChanged.Add( this, &Slider::SliderMoved ); } { Gwen::Controls::VerticalSlider* pSlider = new Gwen::Controls::VerticalSlider( this ); pSlider->SetPos( 190, 10 ); pSlider->SetSize( 20, 200 ); pSlider->SetRange( 0, 100 ); pSlider->SetValue( 20 ); pSlider->SetNotchCount( 10 ); pSlider->SetClampToNotches( true ); pSlider->onValueChanged.Add( this, &Slider::SliderMoved ); } }
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" ); }