2015-04-28 01:35:07 +00:00
|
|
|
#include "UnitTest.h"
|
|
|
|
#include "Gwen/Controls/TreeControl.h"
|
|
|
|
|
|
|
|
using namespace Gwen;
|
|
|
|
|
|
|
|
using namespace Gwen::Controls;
|
|
|
|
|
|
|
|
class TreeControl2 : public GUnit
|
|
|
|
{
|
2018-09-23 21:17:31 +00:00
|
|
|
public:
|
|
|
|
GWEN_CONTROL_INLINE(TreeControl2, GUnit)
|
2015-04-28 01:35:07 +00:00
|
|
|
{
|
|
|
|
{
|
2018-09-23 21:17:31 +00:00
|
|
|
Gwen::Controls::TreeControl* ctrl = new Gwen::Controls::TreeControl(this);
|
2015-04-28 01:35:07 +00:00
|
|
|
|
|
|
|
ctrl->SetKeyboardInputEnabled(true);
|
2018-09-23 21:17:31 +00:00
|
|
|
ctrl->AddNode(L"Node One");
|
|
|
|
Gwen::Controls::TreeNode* pNode = ctrl->AddNode(L"Node Two");
|
|
|
|
pNode->AddNode(L"Node Two Inside");
|
|
|
|
pNode->AddNode(L"Eyes");
|
2015-04-28 01:35:07 +00:00
|
|
|
pNode->SetSelected(true);
|
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
pNode->AddNode(L"Brown")->AddNode(L"Node Two Inside")->AddNode(L"Eyes")->AddNode(L"Brown");
|
|
|
|
ctrl->AddNode(L"Node Three");
|
2015-04-28 01:35:07 +00:00
|
|
|
ctrl->Focus();
|
|
|
|
ctrl->SetKeyboardInputEnabled(true);
|
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
ctrl->SetBounds(30, 30, 200, 200);
|
2015-04-28 01:35:07 +00:00
|
|
|
ctrl->ExpandAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2018-09-23 21:17:31 +00:00
|
|
|
Gwen::Controls::TreeControl* ctrl = new Gwen::Controls::TreeControl(this);
|
2015-04-28 01:35:07 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
ctrl->AllowMultiSelect(true);
|
2015-04-28 01:35:07 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
ctrl->AddNode(L"Node One");
|
|
|
|
Gwen::Controls::TreeNode* pNode = ctrl->AddNode(L"Node Two");
|
|
|
|
pNode->AddNode(L"Node Two Inside");
|
|
|
|
pNode->AddNode(L"Eyes");
|
|
|
|
Gwen::Controls::TreeNode* pNodeTwo = pNode->AddNode(L"Brown")->AddNode(L"Node Two Inside")->AddNode(L"Eyes");
|
|
|
|
pNodeTwo->AddNode(L"Brown");
|
|
|
|
pNodeTwo->AddNode(L"Green");
|
|
|
|
pNodeTwo->AddNode(L"Slime");
|
|
|
|
pNodeTwo->AddNode(L"Grass");
|
|
|
|
pNodeTwo->AddNode(L"Pipe");
|
2015-04-28 01:35:07 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
ctrl->AddNode(L"Node Three");
|
2015-04-28 01:35:07 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
ctrl->SetBounds(240, 30, 200, 200);
|
2015-04-28 01:35:07 +00:00
|
|
|
ctrl->ExpandAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
DEFINE_UNIT_TEST(TreeControl2, L"TreeControl");
|