2019-09-22 21:52:05 +00:00
|
|
|
#include "Runtime/GuiSys/CGuiGroup.hpp"
|
2016-03-11 00:23:16 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2016-03-11 00:23:16 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CGuiGroup::LoadWidgetFnMap() {}
|
2016-03-11 00:23:16 +00:00
|
|
|
|
2016-03-16 03:37:51 +00:00
|
|
|
CGuiGroup::CGuiGroup(const CGuiWidgetParms& parms, int defaultWorker, bool b)
|
2018-12-08 05:30:43 +00:00
|
|
|
: CGuiCompoundWidget(parms), xbc_selectedWorker(defaultWorker), xc0_b(b) {}
|
|
|
|
|
|
|
|
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) {
|
|
|
|
sel->SetIsActive(false);
|
|
|
|
child->SetIsActive(true);
|
|
|
|
}
|
|
|
|
if (setVisible) {
|
|
|
|
sel->SetVisibility(false, ETraversalMode::Single);
|
|
|
|
child->SetVisibility(true, ETraversalMode::Single);
|
|
|
|
}
|
|
|
|
break;
|
2016-03-16 03:37:51 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
child = static_cast<CGuiWidget*>(child->GetNextSibling());
|
|
|
|
}
|
2016-03-16 03:37:51 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CGuiWidget* CGuiGroup::GetSelectedWidget() { return GetWorkerWidget(xbc_selectedWorker); }
|
2016-03-16 03:37:51 +00:00
|
|
|
|
2019-08-14 10:04:11 +00:00
|
|
|
const CGuiWidget* CGuiGroup::GetSelectedWidget() const { return GetWorkerWidget(xbc_selectedWorker); }
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CGuiGroup::AddWorkerWidget(CGuiWidget* worker) {
|
|
|
|
++xb8_workerCount;
|
|
|
|
return true;
|
2016-03-16 03:37:51 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CGuiGroup::OnActiveChange() {
|
|
|
|
CGuiWidget* sel = GetSelectedWidget();
|
|
|
|
if (sel)
|
|
|
|
sel->SetIsActive(true);
|
2016-03-16 03:37:51 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
std::shared_ptr<CGuiWidget> CGuiGroup::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) {
|
|
|
|
CGuiWidgetParms parms = ReadWidgetHeader(frame, in);
|
2022-02-18 07:37:54 +00:00
|
|
|
s16 defaultWorker = in.ReadInt16();
|
|
|
|
bool b = in.ReadBool();
|
2018-12-08 05:30:43 +00:00
|
|
|
std::shared_ptr<CGuiWidget> ret = std::make_shared<CGuiGroup>(parms, defaultWorker, b);
|
|
|
|
ret->ParseBaseInfo(frame, in, parms);
|
|
|
|
return ret;
|
2016-03-16 03:37:51 +00:00
|
|
|
}
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|