2016-03-11 00:23:16 +00:00
|
|
|
#include "CGuiGroup.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
|
|
|
void CGuiGroup::LoadWidgetFnMap()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-03-16 03:37:51 +00:00
|
|
|
CGuiGroup::CGuiGroup(const CGuiWidgetParms& parms, int defaultWorker, bool b)
|
2017-01-14 04:16:10 +00:00
|
|
|
: CGuiCompoundWidget(parms), xbc_selectedWorker(defaultWorker), xc0_b(b)
|
2016-03-16 03:37:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGuiGroup::SelectWorkerWidget(int workerId, bool setActive, bool setVisible)
|
|
|
|
{
|
|
|
|
CGuiWidget* child = static_cast<CGuiWidget*>(GetChildObject());
|
|
|
|
while (child)
|
|
|
|
{
|
|
|
|
if (child->GetWorkerId() == workerId)
|
|
|
|
{
|
|
|
|
CGuiWidget* sel = GetSelectedWidget();
|
|
|
|
if (setActive)
|
|
|
|
{
|
2016-12-15 22:37:34 +00:00
|
|
|
sel->SetIsActive(false);
|
|
|
|
child->SetIsActive(true);
|
2016-03-16 03:37:51 +00:00
|
|
|
}
|
|
|
|
if (setVisible)
|
|
|
|
{
|
|
|
|
sel->SetVisibility(false, ETraversalMode::Single);
|
|
|
|
child->SetVisibility(true, ETraversalMode::Single);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
child = static_cast<CGuiWidget*>(child->GetNextSibling());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CGuiWidget* CGuiGroup::GetSelectedWidget()
|
|
|
|
{
|
2017-01-14 04:16:10 +00:00
|
|
|
return GetWorkerWidget(xbc_selectedWorker);
|
2016-03-16 03:37:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CGuiGroup::AddWorkerWidget(CGuiWidget* worker)
|
|
|
|
{
|
2017-01-14 04:16:10 +00:00
|
|
|
++xb8_workerCount;
|
2016-03-16 03:37:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-12-15 22:37:34 +00:00
|
|
|
void CGuiGroup::OnActiveChange()
|
2016-03-16 03:37:51 +00:00
|
|
|
{
|
|
|
|
CGuiWidget* sel = GetSelectedWidget();
|
|
|
|
if (sel)
|
2016-12-15 22:37:34 +00:00
|
|
|
sel->SetIsActive(true);
|
2016-03-16 03:37:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CGuiGroup* CGuiGroup::Create(CGuiFrame* frame, CInputStream& in, bool flag)
|
|
|
|
{
|
|
|
|
CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag);
|
|
|
|
s16 defaultWorker = in.readInt16Big();
|
|
|
|
bool b = in.readBool();
|
|
|
|
CGuiGroup* ret = new CGuiGroup(parms, defaultWorker, b);
|
|
|
|
ret->ParseBaseInfo(frame, in, parms);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-03-11 00:23:16 +00:00
|
|
|
}
|