PanelListPanel.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "UnitTest.h"
  2. #include "Gwen/Controls/PanelListPanel.h"
  3. #include "Gwen/Controls/StatusBar.h"
  4. #include "Gwen/Utility.h"
  5. using namespace Gwen;
  6. class PanelListPanel : public GUnit
  7. {
  8. public:
  9. GWEN_CONTROL_INLINE( PanelListPanel, GUnit )
  10. {
  11. m_PLP = new Gwen::Controls::PanelListPanel( this );
  12. m_PLP->Dock( Pos::Fill );
  13. m_PLP->SetPadding( Gwen::Padding( 10, 10 ));
  14. m_PLP->SetVertical();
  15. m_PLP->SetSizeToChildren( false );
  16. for ( int i = 0; i < 16; i++)
  17. {
  18. Gwen::String testName = "TEST" + Utility::ToString( i );
  19. Gwen::Controls::Button* testButton = new Gwen::Controls::Button( m_PLP );
  20. testButton->SetText( testName );
  21. }
  22. Gwen::Controls::StatusBar* pStatus = new Gwen::Controls::StatusBar( this );
  23. pStatus->Dock( Pos::Bottom );
  24. {
  25. Gwen::Controls::Button* pButton = new Gwen::Controls::Button( pStatus );
  26. pButton->SetText( "Horizontal" );
  27. pButton->onPress.Add( this, &PanelListPanel::GoHorizontal );
  28. pStatus->AddControl( pButton, false );
  29. }
  30. {
  31. Gwen::Controls::Button* pButton = new Gwen::Controls::Button( pStatus );
  32. pButton->SetText( "Vertical" );
  33. pButton->onPress.Add( this, &PanelListPanel::GoVertical );
  34. pStatus->AddControl( pButton, true );
  35. }
  36. }
  37. void GoVertical( Gwen::Controls::Base* pFromPanel )
  38. {
  39. m_PLP->SetVertical();
  40. }
  41. void GoHorizontal( Gwen::Controls::Base* pFromPanel )
  42. {
  43. m_PLP->SetHorizontal();
  44. }
  45. Gwen::Controls::PanelListPanel* m_PLP;
  46. };
  47. DEFINE_UNIT_TEST( PanelListPanel, L"PanelListPanel" );