mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
More topbar styling
This commit is contained in:
1 parent
b946a29fd7
commit
89b3abbe7b
5 files changed
+12
-4
No files matched your search
@@ -745,6 +745,9 @@ public:
|
||||
void SetImageScale(float scale) {
|
||||
imgScale_ = scale;
|
||||
}
|
||||
void SetText(std::string_view text) {
|
||||
text_ = text;
|
||||
}
|
||||
|
||||
protected:
|
||||
void ClickInternal() override;
|
||||
|
||||
@@ -572,7 +572,7 @@ void AnalogCalibrationScreen::CreateViews() {
|
||||
|
||||
LinearLayout *scrollContents = scroll->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(300.0f, WRAP_CONTENT)));
|
||||
|
||||
scrollContents->Add(new ItemHeader(co->T("Analog Settings", "Analog Settings")));
|
||||
scrollContents->Add(new ItemHeader(co->T("Analog Settings")));
|
||||
|
||||
// TODO: Would be nicer if these didn't pop up...
|
||||
scrollContents->Add(new PopupSliderChoiceFloat(&g_Config.fAnalogDeadzone, 0.0f, 0.5f, 0.15f, co->T("Deadzone radius"), 0.01f, screenManager(), "/ 1.0"));
|
||||
|
||||
+6
-1
@@ -4,6 +4,7 @@
|
||||
#include "Common/System/Request.h"
|
||||
#include "Common/System/Display.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/Data/Text/I18n.h"
|
||||
#include "UI/MiscViews.h"
|
||||
|
||||
TextWithImage::TextWithImage(ImageID imageID, std::string_view text, UI::LinearLayoutParams *layoutParams) : UI::LinearLayout(ORIENT_HORIZONTAL, layoutParams) {
|
||||
@@ -37,7 +38,7 @@ CopyableText::CopyableText(ImageID imageID, std::string_view text, UI::LinearLay
|
||||
});
|
||||
}
|
||||
|
||||
TopBar::TopBar(const UIContext &ctx, std::string_view title, UI::LayoutParams *layoutParams) : UI::LinearLayout(ORIENT_HORIZONTAL, layoutParams) {
|
||||
TopBar::TopBar(const UIContext &ctx, bool usePortraitLayout, std::string_view title, UI::LayoutParams *layoutParams) : UI::LinearLayout(ORIENT_HORIZONTAL, layoutParams) {
|
||||
using namespace UI;
|
||||
SetSpacing(10.0f);
|
||||
if (!layoutParams) {
|
||||
@@ -45,10 +46,14 @@ TopBar::TopBar(const UIContext &ctx, std::string_view title, UI::LayoutParams *l
|
||||
layoutParams_->height = 64.0f;
|
||||
}
|
||||
|
||||
auto dlg = GetI18NCategory(I18NCat::DIALOG);
|
||||
backButton_ = Add(new Choice(ImageID("I_NAVIGATE_BACK"), new LinearLayoutParams()));
|
||||
backButton_ ->OnClick.Add([](UI::EventParams &e) {
|
||||
e.bubbleResult = DR_BACK;
|
||||
});
|
||||
if (!usePortraitLayout) {
|
||||
backButton_->SetText(dlg->T("Back"));
|
||||
}
|
||||
|
||||
if (!title.empty()) {
|
||||
TextView *titleView = Add(new TextView(title, ALIGN_VCENTER | FLAG_WRAP_TEXT, false, new LinearLayoutParams(1.0f, G_VCENTER)));
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public:
|
||||
class TopBar : public UI::LinearLayout {
|
||||
public:
|
||||
// The context is needed to get the theme for the background.
|
||||
TopBar(const UIContext &ctx, std::string_view title, UI::LayoutParams *layoutParams = nullptr);
|
||||
TopBar(const UIContext &ctx, bool usePortraitLayout, std::string_view title, UI::LayoutParams *layoutParams = nullptr);
|
||||
UI::View *GetBackButton() const { return backButton_; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -11,7 +11,7 @@ void UISimpleBaseDialogScreen::CreateViews() {
|
||||
const bool portrait = UsePortraitLayout();
|
||||
|
||||
root_ = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
root_->Add(new TopBar(*screenManager()->getUIContext(), GetTitle()));
|
||||
root_->Add(new TopBar(*screenManager()->getUIContext(), portrait, GetTitle()));
|
||||
|
||||
if (canScroll) {
|
||||
ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT, 1.0f));
|
||||
|
||||
Reference in new issue
Block a user