Exemplo n.º 1
0
Gwen::Controls::Base* SettingsPanel::addSlider( Gwen::Controls::Base* pControl , Rectf bounds, string name, float value, float valueMin, float valueMax){
    
    
    Gwen::Controls::Base* cont = new Gwen::Controls::Base( pControl );
    cont->Dock( Gwen::Pos::Top );
    cont->SetMargin( Gwen::Margin(5,7,5,7) );
    cont->SetHeight( 38 );

    int px = 0;//bounds.getX1();
    int py = 0;//bounds.getY1();
    int w = bounds.getWidth();
    
    Gwen::Controls::Base* lbls = new Gwen::Controls::Base( cont );
    lbls->Dock( Gwen::Pos::Top );
    lbls->SetHeight( 20 );
    
    Gwen::Controls::Label* label = new Gwen::Controls::Label( lbls );
    label->Dock( Gwen::Pos::Left );
    label->SetText( name );
    label->SizeToContents();
//    label->SetPos( px, py );
    
    
    Gwen::Controls::Label* labelValue = new Gwen::Controls::Label( lbls );
//    labelValue->SizeToContents();
    labelValue->Dock( Gwen::Pos::Right );
    labelValue->SetWidth(w);
    labelValue->SetAlignment(Gwen::Pos::Right);
//    labelValue->SetPos( px, py );
    labelValue->SetText( toString(value) );
    
    Gwen::Controls::HorizontalSlider* pSlider = new Gwen::Controls::HorizontalSlider( cont );
    labelValue->Dock( Gwen::Pos::Top );
    pSlider->SetPos( px, py + 17 );
    pSlider->SetSize( w, 20 );
    pSlider->SetClampToNotches(false);
    pSlider->SetNotchCount( (valueMax-valueMin)/10 );
    pSlider->SetRange( valueMin, valueMax );
    pSlider->SetFloatValue( value );
    pSlider->SetName(name);
    pSlider->onValueChanged.Add( this, &SettingsPanel::onSliderLaserOutput );
        
    mLabelsMap[pSlider] = labelValue;
    mSliderValueMap[name] = pSlider;
    return pSlider;
}
Exemplo n.º 2
0
Gwen::Controls::Base* SettingsPanel::addProperty( Gwen::Controls::Base* pControl , Rectf bounds, string name, int val){
    
    Gwen::Controls::Base* cont = new Gwen::Controls::Base( pControl );
    Gwen::Controls::Label* pLabelName = new Gwen::Controls::Label( cont );
    Gwen::Controls::Label* pLabelValue = new Gwen::Controls::Label( cont );
    
    cont->Dock( Gwen::Pos::Top );
    cont->SetMargin( Gwen::Margin(5,7,5,7) );
    cont->SetHeight( 20 );
    pLabelName->SetText( name );
    pLabelName->SetAlignment(Gwen::Pos::Left );
    pLabelName->Dock( Gwen::Pos::Left );
    pLabelName->SizeToContents();

    pLabelValue->Dock( Gwen::Pos::Right );
    pLabelValue->SetWidth( 300 );
    pLabelValue->SetText( toString(val) );
    pLabelValue->SetAlignment( Gwen::Pos::Right );
    pLabelValue->SetName( name );

    mLabelsValueMap[name] = pLabelValue;
    return pLabelName;
}
Exemplo n.º 3
0
void	GwenUserInterface::init(int width, int height,struct sth_stash* stash,float retinaScale)
{
	m_data->m_primRenderer = new GLPrimitiveRenderer(width,height);
	m_data->pRenderer = new GwenOpenGL3CoreRenderer(m_data->m_primRenderer,stash,width,height,retinaScale);

	m_data->skin.SetRender( m_data->pRenderer );

	m_data->pCanvas= new Gwen::Controls::Canvas( &m_data->skin );
	m_data->pCanvas->SetSize( width,height);
	m_data->pCanvas->SetDrawBackground( false);
	m_data->pCanvas->SetBackgroundColor( Gwen::Color( 150, 170, 170, 255 ) );

	MyTestMenuBar* menubar = new MyTestMenuBar(m_data->pCanvas);
	Gwen::Controls::StatusBar* bar = new Gwen::Controls::StatusBar(m_data->pCanvas);
	Gwen::Controls::Label* pRight = new Gwen::Controls::Label( bar );
	pRight->SetWidth(200);
	pRight->SetText( L"Label Added to Right" );
	bar->AddControl( pRight, true );

	Gwen::Controls::Label* pLeft = new Gwen::Controls::Label( bar );
	pLeft->SetText( L"Label Added to Left" );
	pLeft->SetWidth(200);
	bar->AddControl( pLeft,false);

	/*Gwen::Controls::GroupBox* box = new Gwen::Controls::GroupBox(m_data->pCanvas);
	box->SetText("text");
	box->SetName("name");
	box->SetHeight(500);
	*/
	Gwen::Controls::ScrollControl* windowLeft= new Gwen::Controls::ScrollControl(m_data->pCanvas);
	windowLeft->Dock(Gwen::Pos::Right);
	windowLeft->SetWidth(150);
	windowLeft->SetHeight(250);
	windowLeft->SetScroll(false,true);

	/*Gwen::Controls::WindowControl* windowLeft = new Gwen::Controls::WindowControl(m_data->pCanvas);
	windowLeft->Dock(Gwen::Pos::Left);
	windowLeft->SetTitle("title");
	windowLeft->SetWidth(150);
	windowLeft->SetClosable(false);
	windowLeft->SetShouldDrawBackground(true);
	windowLeft->SetTabable(true);
	*/

	//windowLeft->SetSkin(
	Gwen::Controls::TabControl* tab = new Gwen::Controls::TabControl(windowLeft);
	
	//tab->SetHeight(300);
	tab->SetWidth(140);
	tab->SetHeight(250);
	//tab->Dock(Gwen::Pos::Left);
	tab->Dock( Gwen::Pos::Fill );
	//tab->SetMargin( Gwen::Margin( 2, 2, 2, 2 ) );

	Gwen::UnicodeString str1(L"Main");
	m_data->m_demoPage = tab->AddPage(str1);

	

	
	Gwen::UnicodeString str2(L"OpenCL");
	tab->AddPage(str2);
	//Gwen::UnicodeString str3(L"page3");
//	tab->AddPage(str3);
	
		
	
	//but->onPress.Add(handler, &MyHander::onButtonA);

	
	
	//box->Dock(Gwen::Pos::Left);

	/*Gwen::Controls::WindowControl* windowBottom = new Gwen::Controls::WindowControl(m_data->pCanvas);
	windowBottom->SetHeight(100);
	windowBottom->Dock(Gwen::Pos::Bottom);
	windowBottom->SetTitle("bottom");
	*/
//	Gwen::Controls::Property::Text* prop = new Gwen::Controls::Property::Text(m_data->pCanvas);
	//prop->Dock(Gwen::Pos::Bottom);
	/*Gwen::Controls::SplitterBar* split = new Gwen::Controls::SplitterBar(m_data->pCanvas);
	split->Dock(Gwen::Pos::Center);
	split->SetHeight(300);
	split->SetWidth(300);
	*/
	/*
	
	
	*/
}