Skip to content

Commit

Permalink
add localepanel
Browse files Browse the repository at this point in the history
  • Loading branch information
rjkiv committed Jun 15, 2024
1 parent fb7324f commit b65766d
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/SZBE69_B8/objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"system/track/TrackWidget.cpp": "NonMatching",
"system/track/TrackWidgetImp.cpp": "NonMatching",

"system/ui/LocalePanel.cpp": "NonMatching",
"system/ui/PanelDir.cpp": "NonMatching",
"system/ui/Screenshot.cpp": "NonMatching",
"system/ui/ScrollSelect.cpp": "NonMatching",
Expand Down
23 changes: 23 additions & 0 deletions src/system/ui/LocalePanel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "ui/LocalePanel.h"
#include "ui/UIListLabel.h"
#include "ui/UILabel.h"

void LocalePanel::Text(int i, int j, UIListLabel* listlabel, UILabel* label) const {
Entry* entry = (Entry*)&mEntries[j];
if(listlabel->Matches("heading")){
label->SetEditText(entry->mHeading.c_str());
}
else if(listlabel->Matches("label")){
label->SetEditText(entry->mLabel.c_str());
}
else if(listlabel->Matches("token")){
label->SetEditText(entry->mToken.Str());
}
else if(listlabel->Matches("string")){
label->SetEditText(entry->mString.c_str());
}
}

int LocalePanel::NumData() const { return mEntries.size(); }

bool LocalePanel::IsActive(int i) const { return !mEntries[i].mLabel.empty(); }
31 changes: 31 additions & 0 deletions src/system/ui/LocalePanel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#ifndef UI_LOCALEPANEL_H
#define UI_LOCALEPANEL_H
#include "ui/UIPanel.h"
#include "ui/UIListProvider.h"

class LocalePanel : public UIPanel, public UIListProvider {
public:
class Entry { // size 0x28
public:
Entry(){}
String mHeading; // 0x0 - heading?
String mLabel; // 0xc - label?
Symbol mToken; // 0x18 - token?
String mString; // 0x20 - string?
};

LocalePanel(){}
OBJ_CLASSNAME(LocalePanel);
OBJ_SET_TYPE(LocalePanel);
virtual DataNode Handle(DataArray*, bool);
virtual ~LocalePanel(){}
virtual void Enter();
virtual void Text(int, int, UIListLabel*, UILabel*) const;
virtual int NumData() const;
virtual bool IsActive(int) const;
virtual float GapSize(int, int, int, int) const;

std::vector<Entry> mEntries;
};

#endif

0 comments on commit b65766d

Please sign in to comment.