Exemplo n.º 1
0
		GWEN_CONTROL_INLINE( Button, GUnit )
		{
			// Normal button
			Controls::Button* pButtonA = new Controls::Button( this );
			pButtonA->SetText( L"Event Tester" );
			pButtonA->onPress.Add( this, &Button::onButtonA );
			{
				Controls::Button* pButtonA = new Controls::Button( this );
				pButtonA->SetBounds( 200, 30, 300, 200 );
				pButtonA->SetText( L"Event Tester" );
				pButtonA->onPress.Add( this, &Button::onButtonA );
			}
			// Unicode test
			Controls::Button* pButtonB = new Controls::Button( this );
			pButtonB->SetText( L"\u0417\u0430\u043C\u0435\u0436\u043D\u0430\u044F \u043C\u043E\u0432\u0430" );
			Gwen::Align::PlaceBelow( pButtonB, pButtonA, 10 );
			// Image with text
			Controls::Button* pButtonC = new Controls::Button( this );
			pButtonC->SetText( L"Image Button" );
			pButtonC->SetImage( L"test16.png" );
			Gwen::Align::PlaceBelow( pButtonC, pButtonB, 10 );
			// Just image
			Controls::Button* pButtonD = new Controls::Button( this );
			pButtonD->SetText( L"" );
			pButtonD->SetImage( L"test16.png" );
			pButtonD->SetSize( 20, 20 );
			Gwen::Align::PlaceBelow( pButtonD, pButtonC, 10 );
			// Toggle button
			Controls::Button* pButtonE = new Controls::Button( this );
			pButtonE->SetText( L"Toggle Me" );
			pButtonE->SetIsToggle( true );
			pButtonE->onToggle.Add( this, &Button::OnToggle );
			pButtonE->onToggleOn.Add( this, &Button::OnToggleOn );
			pButtonE->onToggleOff.Add( this, &Button::OnToggleOff );
			Gwen::Align::PlaceBelow( pButtonE, pButtonD, 10 );
			// Disabled Button
			Controls::Button* pButtonF = new Controls::Button( this );
			pButtonF->SetText( L"Disabled :D" );
			pButtonF->SetDisabled( true );
			Gwen::Align::PlaceBelow( pButtonF, pButtonE, 10 );
			// Tooltip Button
			Controls::Button* pButtonG = new Controls::Button( this );
			pButtonG->SetText( L"With Tooltip" );
			pButtonG->SetToolTip( "This is a tooltip!" );
			Gwen::Align::PlaceBelow( pButtonG, pButtonF, 10 );
		}
Exemplo n.º 2
0
	GWEN_CONTROL_INLINE( ScrollControl, GUnit )
	{

		{
			Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this );
			pCtrl->SetBounds( 10, 10, 100, 100 );

			Controls::Button* pTestButton = new Controls::Button( pCtrl );
			pTestButton->SetText( L"Twice As Big" );
			pTestButton->SetBounds( 0, 0, 200, 200 );
		}

		{
			Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this );
			pCtrl->SetBounds( 110, 10, 100, 100 );

			Controls::Button* pTestButton = new Controls::Button( pCtrl );
			pTestButton->SetText( L"Same Size" );
			pTestButton->SetBounds( 0, 0, 100, 100 );
		}

		{
			Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this );
			pCtrl->SetBounds( 210, 10, 100, 100 );

			Controls::Button* pTestButton = new Controls::Button( pCtrl );
			pTestButton->SetText( L"Wide" );
			pTestButton->SetBounds( 0, 0, 200, 50 );
		}

		{
			Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this );
			pCtrl->SetBounds( 310, 10, 100, 100 );

			Controls::Button* pTestButton = new Controls::Button( pCtrl );
			pTestButton->SetText( L"Tall" );
			pTestButton->SetBounds( 0, 0, 50, 200 );
		}

		{
			Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this );
			pCtrl->SetBounds( 410, 10, 100, 100 );
			pCtrl->SetScroll( false, true );

			Controls::Button* pTestButton = new Controls::Button( pCtrl );
			pTestButton->SetText( L"Vertical" );
			pTestButton->SetBounds( 0, 0, 200, 200 );
		}

		{
			Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this );
			pCtrl->SetBounds( 510, 10, 100, 100 );
			pCtrl->SetScroll( true, false );

			Controls::Button* pTestButton = new Controls::Button( pCtrl );
			pTestButton->SetText( L"Horinzontal" );
			pTestButton->SetBounds( 0, 0, 200, 200 );
		}

		// Bottom Row

		{
			Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this );
			pCtrl->SetBounds( 10, 110, 100, 100 );
			pCtrl->SetAutoHideBars( true );

			Controls::Button* pTestButton = new Controls::Button( pCtrl );
			pTestButton->SetText( L"Twice As Big" );
			pTestButton->SetBounds( 0, 0, 200, 200 );
		}

		{
			Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this );
			pCtrl->SetBounds( 110, 110, 100, 100 );
			pCtrl->SetAutoHideBars( true );

			Controls::Button* pTestButton = new Controls::Button( pCtrl );
			pTestButton->SetText( L"Same Size" );
			pTestButton->SetBounds( 0, 0, 100, 100 );
		}

		{
			Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this );
			pCtrl->SetBounds( 210, 110, 100, 100 );
			pCtrl->SetAutoHideBars( true );

			Controls::Button* pTestButton = new Controls::Button( pCtrl );
			pTestButton->SetText( L"Wide" );
			pTestButton->SetBounds( 0, 0, 200, 50 );
		}

		{
			Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this );
			pCtrl->SetBounds( 310, 110, 100, 100 );
			pCtrl->SetAutoHideBars( true );

			Controls::Button* pTestButton = new Controls::Button( pCtrl );
			pTestButton->SetText( L"Tall" );
			pTestButton->SetBounds( 0, 0, 50, 200 );
		}

		{
			Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this );
			pCtrl->SetBounds( 410, 110, 100, 100 );
			pCtrl->SetAutoHideBars( true );
			pCtrl->SetScroll( false, true );

			Controls::Button* pTestButton = new Controls::Button( pCtrl );
			pTestButton->SetText( L"Vertical" );
			pTestButton->SetBounds( 0, 0, 200, 200 );
		}

		{
			Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this );
			pCtrl->SetBounds( 510, 110, 100, 100 );
			pCtrl->SetAutoHideBars( true );
			pCtrl->SetScroll( true, false );

			Controls::Button* pTestButton = new Controls::Button( pCtrl );
			pTestButton->SetText( L"Horinzontal" );
			pTestButton->SetBounds( 0, 0, 200, 200 );
		}
	}