2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 19:07:44 +00:00

New code style refactor

This commit is contained in:
Jack Andersen
2018-12-07 19:30:43 -10:00
parent 41ae32be31
commit 636c82a568
1451 changed files with 171430 additions and 203303 deletions

View File

@@ -2,105 +2,87 @@
#include "CGuiCompoundWidget.hpp"
namespace urde
{
namespace urde {
class CGuiTableGroup : public CGuiCompoundWidget
{
class CGuiTableGroup : public CGuiCompoundWidget {
public:
class CRepeatState
{
float x0_timer = 0.f;
public:
bool Update(float dt, bool state);
};
class CRepeatState {
float x0_timer = 0.f;
enum class TableSelectReturn
{
Changed,
Unchanged,
WrappedAround
};
public:
bool Update(float dt, bool state);
};
enum class TableSelectReturn { Changed, Unchanged, WrappedAround };
private:
CRepeatState xb8_decRepeat;
CRepeatState xbc_incRepeat;
int xc0_elementCount;
int xc4_userSelection;
int xc8_prevUserSelection;
int xcc_defaultUserSelection;
bool xd0_selectWraparound;
bool xd1_vertical = true;
std::function<void(CGuiTableGroup*)> xd4_doMenuAdvance;
std::function<void(CGuiTableGroup*)> xec_doMenuCancel;
std::function<void(CGuiTableGroup*, int)> x104_doMenuSelChange;
CRepeatState xb8_decRepeat;
CRepeatState xbc_incRepeat;
int xc0_elementCount;
int xc4_userSelection;
int xc8_prevUserSelection;
int xcc_defaultUserSelection;
bool xd0_selectWraparound;
bool xd1_vertical = true;
std::function<void(CGuiTableGroup*)> xd4_doMenuAdvance;
std::function<void(CGuiTableGroup*)> xec_doMenuCancel;
std::function<void(CGuiTableGroup*, int)> x104_doMenuSelChange;
bool IsWorkerSelectable(int) const;
void SelectWorker(int);
void DeactivateWorker(CGuiWidget* widget);
void ActivateWorker(CGuiWidget* widget);
bool IsWorkerSelectable(int) const;
void SelectWorker(int);
void DeactivateWorker(CGuiWidget* widget);
void ActivateWorker(CGuiWidget* widget);
TableSelectReturn DecrementSelectedRow();
TableSelectReturn IncrementSelectedRow();
void DoSelectPrevRow();
void DoSelectNextRow();
TableSelectReturn DecrementSelectedRow();
TableSelectReturn IncrementSelectedRow();
void DoSelectPrevRow();
void DoSelectNextRow();
void DoCancel();
void DoAdvance();
bool PreDecrement();
void DoDecrement();
bool PreIncrement();
void DoIncrement();
void DoCancel();
void DoAdvance();
bool PreDecrement();
void DoDecrement();
bool PreIncrement();
void DoIncrement();
public:
CGuiTableGroup(const CGuiWidgetParms& parms, int, int, bool);
FourCC GetWidgetTypeID() const { return FOURCC('TBGP'); }
CGuiTableGroup(const CGuiWidgetParms& parms, int, int, bool);
FourCC GetWidgetTypeID() const { return FOURCC('TBGP'); }
void SetMenuAdvanceCallback(std::function<void(CGuiTableGroup*)>&& cb)
{
xd4_doMenuAdvance = std::move(cb);
void SetMenuAdvanceCallback(std::function<void(CGuiTableGroup*)>&& cb) { xd4_doMenuAdvance = std::move(cb); }
void SetMenuCancelCallback(std::function<void(CGuiTableGroup*)>&& cb) { xec_doMenuCancel = std::move(cb); }
void SetMenuSelectionChangeCallback(std::function<void(CGuiTableGroup*, int)>&& cb) {
x104_doMenuSelChange = std::move(cb);
}
void SetColors(const zeus::CColor& selected, const zeus::CColor& unselected) {
int id = -1;
while (CGuiWidget* worker = GetWorkerWidget(++id)) {
if (id == xc4_userSelection)
worker->SetColor(selected);
else
worker->SetColor(unselected);
}
}
void SetMenuCancelCallback(std::function<void(CGuiTableGroup*)>&& cb)
{
xec_doMenuCancel = std::move(cb);
}
void SetVertical(bool v) { xd1_vertical = v; }
void SetMenuSelectionChangeCallback(std::function<void(CGuiTableGroup*, int)>&& cb)
{
x104_doMenuSelChange = std::move(cb);
}
void SetUserSelection(int sel) {
xc8_prevUserSelection = xc4_userSelection;
xc4_userSelection = sel;
}
void SetColors(const zeus::CColor& selected, const zeus::CColor& unselected)
{
int id = -1;
while (CGuiWidget* worker = GetWorkerWidget(++id))
{
if (id == xc4_userSelection)
worker->SetColor(selected);
else
worker->SetColor(unselected);
}
}
int GetElementCount() const { return xc0_elementCount; }
void SetVertical(bool v) { xd1_vertical = v; }
int GetUserSelection() const { return xc4_userSelection; }
void SetUserSelection(int sel)
{
xc8_prevUserSelection = xc4_userSelection;
xc4_userSelection = sel;
}
void ProcessUserInput(const CFinalInput& input);
int GetElementCount() const { return xc0_elementCount; }
bool AddWorkerWidget(CGuiWidget* worker) { return true; }
int GetUserSelection() const { return xc4_userSelection; }
void ProcessUserInput(const CFinalInput& input);
bool AddWorkerWidget(CGuiWidget* worker) { return true; }
static std::shared_ptr<CGuiWidget> Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp);
static std::shared_ptr<CGuiWidget> Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp);
};
}
} // namespace urde