TreeControl.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "UnitTest.h"
  2. #include "Gwen/Controls/TreeControl.h"
  3. using namespace Gwen;
  4. using namespace Gwen::Controls;
  5. class TreeControl2 : public GUnit
  6. {
  7. public:
  8. GWEN_CONTROL_INLINE( TreeControl2, GUnit )
  9. {
  10. {
  11. Gwen::Controls::TreeControl* ctrl = new Gwen::Controls::TreeControl( this );
  12. ctrl->SetKeyboardInputEnabled(true);
  13. ctrl->AddNode( L"Node One" );
  14. Gwen::Controls::TreeNode* pNode = ctrl->AddNode( L"Node Two" );
  15. pNode->AddNode( L"Node Two Inside" );
  16. pNode->AddNode( L"Eyes" );
  17. pNode->SetSelected(true);
  18. pNode->AddNode( L"Brown" )->AddNode( L"Node Two Inside" )->AddNode( L"Eyes" )->AddNode( L"Brown" );
  19. ctrl->AddNode( L"Node Three" );
  20. ctrl->Focus();
  21. ctrl->SetKeyboardInputEnabled(true);
  22. ctrl->SetBounds( 30, 30, 200, 200 );
  23. ctrl->ExpandAll();
  24. }
  25. {
  26. Gwen::Controls::TreeControl* ctrl = new Gwen::Controls::TreeControl( this );
  27. ctrl->AllowMultiSelect( true );
  28. ctrl->AddNode( L"Node One" );
  29. Gwen::Controls::TreeNode* pNode = ctrl->AddNode( L"Node Two" );
  30. pNode->AddNode( L"Node Two Inside" );
  31. pNode->AddNode( L"Eyes" );
  32. Gwen::Controls::TreeNode* pNodeTwo = pNode->AddNode( L"Brown" )->AddNode( L"Node Two Inside" )->AddNode( L"Eyes" );
  33. pNodeTwo->AddNode( L"Brown" );
  34. pNodeTwo->AddNode( L"Green" );
  35. pNodeTwo->AddNode( L"Slime" );
  36. pNodeTwo->AddNode( L"Grass" );
  37. pNodeTwo->AddNode( L"Pipe" );
  38. ctrl->AddNode( L"Node Three" );
  39. ctrl->SetBounds( 240, 30, 200, 200 );
  40. ctrl->ExpandAll();
  41. }
  42. }
  43. };
  44. DEFINE_UNIT_TEST( TreeControl2, L"TreeControl" );