Torque3D/Engine/lib/bullet/test/GwenOpenGLTest/Properties.cpp

57 lines
1.3 KiB
C++
Raw Normal View History

2022-05-13 23:42:41 -04:00
#include "UnitTest.h"
#include "Gwen/Controls/Properties.h"
#include "Gwen/Controls/PropertyTree.h"
using namespace Gwen;
class Properties2 : public GUnit
{
public:
GWEN_CONTROL_INLINE(Properties2, GUnit)
2022-05-13 23:42:41 -04:00
{
{
Gwen::Controls::Properties* props = new Gwen::Controls::Properties(this);
2022-05-13 23:42:41 -04:00
props->SetBounds(10, 10, 150, 300);
2022-05-13 23:42:41 -04:00
{
{
Gwen::Controls::PropertyRow* pRow = props->Add(L"First Name");
pRow->onChange.Add(this, &Properties2::OnFirstNameChanged);
2022-05-13 23:42:41 -04:00
}
props->Add(L"Middle Name");
props->Add(L"Last Name");
2022-05-13 23:42:41 -04:00
}
}
{
Gwen::Controls::PropertyTree* ptree = new Gwen::Controls::PropertyTree(this);
ptree->SetBounds(200, 10, 200, 200);
2022-05-13 23:42:41 -04:00
{
Gwen::Controls::Properties* props = ptree->Add(L"Item One");
props->Add(L"Middle Name");
props->Add(L"Last Name");
props->Add(L"Four");
2022-05-13 23:42:41 -04:00
}
{
Gwen::Controls::Properties* props = ptree->Add(L"Item Two");
props->Add(L"More Items");
props->Add(L"To Fill");
props->Add(L"Out Here");
2022-05-13 23:42:41 -04:00
}
ptree->ExpandAll();
}
}
void OnFirstNameChanged(Controls::Base* pControl)
2022-05-13 23:42:41 -04:00
{
Gwen::Controls::PropertyRow* pRow = (Gwen::Controls::PropertyRow*)pControl;
UnitPrint(Utility::Format(L"First Name Changed: %s", pRow->GetProperty()->GetPropertyValue().c_str()));
2022-05-13 23:42:41 -04:00
}
};
DEFINE_UNIT_TEST(Properties2, L"Properties");