Esempio n. 1
0
		GWEN_CONTROL_INLINE( LabelMultiline, GUnit )
		{
			Dock( Pos::Fill );
			Gwen::Controls::CrossSplitter* pSplitter = new Gwen::Controls::CrossSplitter( this );
			pSplitter->Dock( Pos::Fill );
			pSplitter->SetMargin( Margin( 10, 10, 10, 10 ) );
			{
				Gwen::Controls::Label* label = new Gwen::Controls::Label( pSplitter );
				label->SetText( "I think we're losing sight of the real issue here, which is: what are we gonna call ourselves?\n\nErm, and I think it comes down to a choice between \"The League Against Salivating Monsters\" or my own personal preference, which is \"The Committee for the Liberation and Integration of Terrifying Organisms and their Rehabilitation Into Society.\" Erm, one drawback with that: the abbreviation is \"CLITORIS.\"" );
				label->SetWrap( true );
				pSplitter->SetPanel( 0, label );
			}
			{
				Gwen::Controls::Label* label = new Gwen::Controls::Label( pSplitter );
				label->SetText( "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ultrices pharetra scelerisque. Ut posuere velit a ligula suscipit ut lobortis ligula congue. Aliquam lacinia cursus est, quis aliquam nisl scelerisque vitae. Nunc porta eros sem, nec rhoncus eros. Integer elementum, quam vitae egestas dictum, mi quam gravida augue, non fringilla lacus nisi sit amet nunc. Maecenas dolor tellus, consequat sed sodales ut, aliquam ac enim. Nulla facilisi. Maecenas eleifend, velit a lobortis vehicula, nunc lacus egestas leo, volutpat egestas augue nulla nec turpis. Aenean convallis diam magna. Duis ac lacinia massa. In id dui vel dui laoreet congue. Aliquam suscipit quam et augue sagittis egestas. Integer posuere arcu sit amet lacus porttitor et malesuada enim mollis. Duis luctus est in purus consectetur sit amet volutpat tortor euismod. Nulla facilisi." );
				label->SetWrap( true );
				pSplitter->SetPanel( 1, label );
			}
			{
				Gwen::Controls::Label* label = new Gwen::Controls::Label( pSplitter );
				label->SetText( "Integer eget rutrum nisi. Ut eget dui et turpis volutpat pulvinar non sed lacus. Proin vestibulum felis nec elit tristique non imperdiet eros pretium. Nullam pulvinar sem eleifend turpis eleifend vel dapibus dui sodales. Curabitur euismod hendrerit felis nec vestibulum. Suspendisse tempus gravida ligula a vestibulum. Phasellus et eros at justo hendrerit cursus. Phasellus rutrum porta diam, in mollis ante aliquam at. Vestibulum interdum ligula at massa auctor scelerisque. Sed at tincidunt risus. Donec ut est dui. Vestibulum blandit urna eu metus malesuada blandit" );
				label->SetWrap( true );
				pSplitter->SetPanel( 2, label );
			}
			{
				Gwen::Controls::Label* label = new Gwen::Controls::Label( pSplitter );
				label->SetText( "Nullam vel risus eget lacus consectetur rutrum. Curabitur eros libero, porta sed commodo vel, euismod non quam. Fusce bibendum posuere metus, nec mollis odio rutrum ac. Cras nec sapien et mauris dapibus pretium id quis dolor. Sed a velit vel tellus viverra sodales. Praesent tempor purus et elit ultrices tristique. Sed in enim nec elit molestie fermentum et quis enim. Nullam varius placerat lacus nec ultrices. Aliquam erat volutpat. Suspendisse potenti. Nullam euismod pulvinar luctus. Vestibulum ut dui nisi, eget tempus est. Vivamus molestie arcu non enim pulvinar sollicitudin. Pellentesque dapibus risus sit amet diam tempor faucibus accumsan ante porta. Phasellus quis facilisis quam. Fusce eget adipiscing magna." );
				label->SetWrap( true );
				pSplitter->SetPanel( 3, label );
			}
		}
Esempio n. 2
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;
}
Esempio n. 3
0
void CLoadState::AddLabel(std::wstring const & Label, Gwen::Color const & Color)
{
	Gwen::Controls::Label * MediumLabel = new Gwen::Controls::Label(Canvas);
	MediumLabel->SetFont(GUIManager->GetMediumFont());
	MediumLabel->SetText(Label);
	MediumLabel->SetBounds(20 + Indent, LabelHeight, 1024, 300);
	MediumLabel->SetTextColor(Color);

	GUIManager->Draw(true);
	Context->Window->SwapBuffers();

	LabelHeight += 40;
}
Esempio n. 4
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;
}
Esempio n. 5
0
void RichLabel::CreateLabel( const Gwen::UnicodeString & text, const DividedText & txt, int & x, int & y, int & lineheight, bool NoSplit )
{
	//
	// Use default font or is one set?
	//
	Gwen::Font* pFont = GetSkin()->GetDefaultFont();

	if ( txt.font ) { pFont = txt.font; }

	//
	// This string is too long for us, split it up.
	//
	Gwen::Point p = GetSkin()->GetRender()->MeasureText( pFont, text );

	if ( lineheight == -1 )
	{
		lineheight = p.y;
	}

	if ( !NoSplit )
	{
		if ( x + p.x > Width() )
		{
			return SplitLabel( text, pFont, txt, x, y, lineheight );
		}
	}

	//
	// Wrap
	//
	if ( x + p.x >= Width() )
	{
		CreateNewline( x, y, lineheight );
	}

	Gwen::Controls::Label*	pLabel = new Gwen::Controls::Label( this );
	pLabel->SetText( x == 0 ? Gwen::Utility::Strings::TrimLeft<Gwen::UnicodeString> ( text, U" " ) : text );
	pLabel->SetTextColor( txt.color );
	pLabel->SetFont( pFont );
	pLabel->SizeToContents();
	pLabel->SetPos( x, y );
	//lineheight = (lineheight + pLabel->Height()) / 2;
	x += pLabel->Width();

	if ( x >= Width() )
	{
		CreateNewline( x, y, lineheight );
	}
}
Esempio n. 6
0
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();
	}
}
Esempio n. 7
0
	GWEN_CONTROL_INLINE( Label, GUnit )
	{
		{
			Gwen::Controls::Label* label = new Gwen::Controls::Label( this );
			label->SetText( "Garry's Normal Label" );
			label->SizeToContents();
			label->SetPos( 10, 10 );
		}

		{
			Gwen::Controls::Label* label = new Gwen::Controls::Label( this );
			label->SetText( L"Chinese: \u4E45\u6709\u5F52\u5929\u613F \u7EC8\u8FC7\u9B3C\u95E8\u5173" );
			label->SizeToContents();
			label->SetPos( 10, 30 );
		}

		{
			Gwen::Controls::Label* label = new Gwen::Controls::Label( this );
			label->SetText( L"Japanese: \u751F\u3080\u304E\u3000\u751F\u3054\u3081\u3000\u751F\u305F\u307E\u3054" );
			label->SizeToContents();
			label->SetPos( 10, 50 );
		}

		{
			Gwen::Controls::Label* label = new Gwen::Controls::Label( this );
			label->SetText( L"Korean: \uADF9\uC9C0\uD0D0\uD5D8\u3000\uD611\uD68C\uACB0\uC131\u3000\uCCB4\uACC4\uC801\u3000\uC5F0\uAD6C" );
			label->SizeToContents();
			label->SetPos( 10, 70 );
		}

		{
			Gwen::Controls::Label* label = new Gwen::Controls::Label( this );
			label->SetText( L"Hindi: \u092F\u0947 \u0905\u0928\u0941\u091A\u094D\u091B\u0947\u0926 \u0939\u093F\u0928\u094D\u0926\u0940 \u092E\u0947\u0902 \u0939\u0948\u0964" );
			label->SizeToContents();
			label->SetPos( 10, 90 );
		}

		{
			Gwen::Controls::Label* label = new Gwen::Controls::Label( this );
			label->SetText( L"Arabic: \u0627\u0644\u0622\u0646 \u0644\u062D\u0636\u0648\u0631 \u0627\u0644\u0645\u0624\u062A\u0645\u0631 \u0627\u0644\u062F\u0648\u0644\u064A" );
			label->SizeToContents();
			label->SetPos( 10, 110 );
		}

		{
			Gwen::Controls::Label* label = new Gwen::Controls::Label( this );
			label->SetText( L"Wow, Coloured Text" );
			label->SetTextColor( Gwen::Color( 0, 0, 255, 255 ) );
			label->SizeToContents();
			label->SetPos( 10, 130 );
		}

		{
			Gwen::Controls::Label* label = new Gwen::Controls::Label( this );
			label->SetText( L"Coloured Text With Alpha" );
			label->SetTextColor( Gwen::Color( 0, 0, 255, 100 ) );
			label->SizeToContents();
			label->SetPos( 10, 150 );
		}

		{
			//
			// Note that when using a custom font, this font object has to stick around
			// for the lifetime of the label. Rethink, or is that ideal?
			//
			m_Font.facename = L"Comic Sans MS";
			m_Font.size = 25;

			Gwen::Controls::Label* label = new Gwen::Controls::Label( this );
			label->SetText( L"Custom Font (Comic Sans 25)" );
			label->SetFont( &m_Font );
			label->SizeToContents();
			label->SetPos( 10, 170 );
		}

		{
			Gwen::Controls::Label* label = new Gwen::Controls::Label( this );
			label->SetText( L"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n\nLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." );
			label->SizeToContents();
			label->SetBounds( 300, 10, 150, 500 );
		}

	}
		void Label_SetText(Gwen::Controls::Label& label, const std::string& value)
		{
			label.SetText(value);
		}
Esempio n. 9
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);
	*/
	/*
	
	
	*/
}