mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-11 07:03:33 +02:00
Convert TouchControlVisibilityScreen to use Tabbed...
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "Common/UI/TabHolder.h"
|
||||
#include "Common/System/Display.h"
|
||||
#include "Common/Render/TextureAtlas.h"
|
||||
#include "Common/Data/Text/I18n.h"
|
||||
#include "Common/StringUtils.h"
|
||||
@@ -44,32 +45,38 @@ private:
|
||||
UI::CheckBox *checkbox_;
|
||||
};
|
||||
|
||||
void TouchControlVisibilityScreen::CreateViews() {
|
||||
void TouchControlVisibilityScreen::CreateTabs() {
|
||||
auto co = GetI18NCategory(I18NCat::CONTROLS);
|
||||
|
||||
AddTab("Visibility", co->T("Visibility"), [this](UI::LinearLayout *contents) {
|
||||
CreateVisibilityTab(contents);
|
||||
});
|
||||
}
|
||||
|
||||
void TouchControlVisibilityScreen::CreateVisibilityTab(UI::LinearLayout *vert) {
|
||||
using namespace UI;
|
||||
using namespace CustomKeyData;
|
||||
|
||||
auto di = GetI18NCategory(I18NCat::DIALOG);
|
||||
auto co = GetI18NCategory(I18NCat::CONTROLS);
|
||||
|
||||
root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
const bool portrait = UsePortraitLayout();
|
||||
|
||||
Choice *back = new Choice(di->T("Back"), "", false, new AnchorLayoutParams(leftColumnWidth - 10, WRAP_CONTENT, 10, NONE, NONE, 10));
|
||||
root_->Add(back)->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
||||
Choice *toggleAll = new Choice(di->T("Toggle All"), "", false, new AnchorLayoutParams(leftColumnWidth - 10, WRAP_CONTENT, 10, NONE, NONE, 84));
|
||||
root_->Add(toggleAll)->OnClick.Handle(this, &TouchControlVisibilityScreen::OnToggleAll);
|
||||
|
||||
TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, leftColumnWidth, TabHolderFlags::Default, nullptr, new AnchorLayoutParams(10, 0, 10, 0, false));
|
||||
tabHolder->SetTag("TouchControlVisibility");
|
||||
root_->Add(tabHolder);
|
||||
ScrollView *rightPanel = new ScrollView(ORIENT_VERTICAL);
|
||||
tabHolder->AddTab(co->T("Visibility"), rightPanel);
|
||||
|
||||
LinearLayout *vert = rightPanel->Add(new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT)));
|
||||
vert->SetSpacing(0);
|
||||
|
||||
vert->Add(toggleAll)->OnClick.Add([this](UI::EventParams &e) {
|
||||
// TODO: Is this a meaningful operation to support?
|
||||
for (auto toggle : toggles_) {
|
||||
*toggle.show = nextToggleAll_;
|
||||
}
|
||||
nextToggleAll_ = !nextToggleAll_;
|
||||
});
|
||||
|
||||
vert->Add(new ItemHeader(co->T("Touch Control Visibility")));
|
||||
|
||||
const int cellSize = 380;
|
||||
const int cellSize = portrait ? std::min((g_display.dp_xres / 2 - 10), 290) : 380;
|
||||
|
||||
UI::GridLayoutSettings gridsettings(cellSize, 64, 5);
|
||||
gridsettings.fillCells = true;
|
||||
@@ -170,13 +177,6 @@ void RightAnalogMappingScreen::CreateViews() {
|
||||
rightAnalogPress->SetEnabledPtr(&g_Config.bRightAnalogCustom);
|
||||
}
|
||||
|
||||
void TouchControlVisibilityScreen::OnToggleAll(UI::EventParams &e) {
|
||||
for (auto toggle : toggles_) {
|
||||
*toggle.show = nextToggleAll_;
|
||||
}
|
||||
nextToggleAll_ = !nextToggleAll_;
|
||||
}
|
||||
|
||||
void CheckBoxChoice::HandleClick(UI::EventParams &e) {
|
||||
checkbox_->Toggle();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user