mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-13 09:39:33 +01:00
Make round corners propagate properly into viewgroups
This commit is contained in:
1 parent
af13eb38e0
commit
2646314c92
15 files changed
+33
-27
No files matched your search
@@ -240,7 +240,7 @@ void PopupScreen::CreateViews() {
|
||||
|
||||
box_->SetRoundCorners(RoundCorners::All);
|
||||
// Rounds the top of the header and the bottom of the last view, to match the box.
|
||||
box_->ApplyRoundCorners(RoundCorners::All);
|
||||
box_->SetRoundCorners(RoundCorners::All);
|
||||
}
|
||||
|
||||
void MessagePopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
@@ -692,7 +692,7 @@ void SliderPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
if (!negativeLabel_.empty())
|
||||
vert->Add(new CheckBox(&disabled_, negativeLabel_));
|
||||
|
||||
lin->ApplyRoundCorners();
|
||||
lin->SetRoundCorners();
|
||||
|
||||
if (IsFocusMovementEnabled())
|
||||
UI::SetFocusedView(slider_, FocusFlags::CAUSE_SCREEN_CHANGE);
|
||||
@@ -738,7 +738,7 @@ void SliderFloatPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
});
|
||||
reset->SetRoundCorners();
|
||||
}
|
||||
lin->ApplyRoundCorners();
|
||||
lin->SetRoundCorners();
|
||||
|
||||
// slider_ = parent->Add(new SliderFloat(&sliderValue_, minValue_, maxValue_, new LinearLayoutParams(UI::Margins(10, 5))));
|
||||
if (IsFocusMovementEnabled())
|
||||
|
||||
@@ -674,7 +674,7 @@ void ListView::CreateAllItems() {
|
||||
OnItemCallback(i, e);
|
||||
});
|
||||
}
|
||||
linLayout_->ApplyRoundCorners();
|
||||
linLayout_->SetRoundCorners();
|
||||
}
|
||||
|
||||
void ListView::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) {
|
||||
|
||||
@@ -86,7 +86,7 @@ void TabHolder::AddTabContents(std::string_view title, ImageID imageId, ViewGrou
|
||||
} else {
|
||||
tabStrip_->AddChoice(title);
|
||||
}
|
||||
tabStrip_->ApplyRoundCorners(orientation_ == Orientation::ORIENT_HORIZONTAL ? RoundCorners::Left : RoundCorners::Top);
|
||||
tabStrip_->SetRoundCorners(orientation_ == Orientation::ORIENT_HORIZONTAL ? RoundCorners::Left : RoundCorners::Top);
|
||||
|
||||
contents_->Add(tabContents);
|
||||
if (tabs_.size() > 1)
|
||||
@@ -108,7 +108,7 @@ void TabHolder::AddTabDeferred(std::string_view title, ImageID imageId, std::fun
|
||||
} else {
|
||||
tabStrip_->AddChoice(title);
|
||||
}
|
||||
tabStrip_->ApplyRoundCorners(orientation_ == Orientation::ORIENT_HORIZONTAL ? RoundCorners::Left : RoundCorners::Top);
|
||||
tabStrip_->SetRoundCorners(orientation_ == Orientation::ORIENT_HORIZONTAL ? RoundCorners::Left : RoundCorners::Top);
|
||||
|
||||
tabTweens_.push_back(nullptr);
|
||||
createFuncs_.push_back(createCb);
|
||||
|
||||
@@ -878,6 +878,7 @@ protected:
|
||||
|
||||
class InfoItem : public Item {
|
||||
public:
|
||||
// If you pass an empty string for rightText, it will be left blank.
|
||||
InfoItem(std::string_view text, std::string_view rightText, LayoutParams *layoutParams = nullptr);
|
||||
InfoItem(std::string_view text, int rightValue, LayoutParams *layoutParams = nullptr);
|
||||
|
||||
|
||||
@@ -852,7 +852,7 @@ void LinearLayout::Layout() {
|
||||
|
||||
// Applies rounding to the corners of the child views, based on their position in the layout and the orientation. Masked by the outerCorners.
|
||||
// Ignores invisible views.
|
||||
void LinearLayout::ApplyRoundCorners(RoundCorners outerCorners) {
|
||||
void LinearLayout::SetRoundCorners(RoundCorners outerCorners) {
|
||||
// Easy case first: There's spacing, just apply round corners to all subviews.
|
||||
if (spacing_ > 0.0f) {
|
||||
for (View *view : views_) {
|
||||
@@ -916,7 +916,7 @@ void ChoiceGroup::Draw(UIContext &dc) {
|
||||
|
||||
// Maybe we should require the user to Finish() the ChoiceGroup instead of running this every frame.
|
||||
// At least it's not recursive.
|
||||
ApplyRoundCorners(RoundCorners::All);
|
||||
SetRoundCorners(RoundCorners::All);
|
||||
|
||||
// Draw a roundrect as background.
|
||||
LinearLayout::Draw(dc);
|
||||
|
||||
@@ -232,9 +232,9 @@ public:
|
||||
contentGravity_ = gravity;
|
||||
}
|
||||
|
||||
// Applies rounding to the corners of the child views, based on their position in the layout and the orientation. Masked by the outerCorners.
|
||||
// Override, applies rounding to the corners of the child views, based on their position in the layout and the orientation. Masked by the outerCorners.
|
||||
// Note that if the view's spacing is not 0.0f, all views will get the rounded corners since they will appear separate.
|
||||
void ApplyRoundCorners(RoundCorners outerCorners = RoundCorners::All);
|
||||
void SetRoundCorners(RoundCorners outerCorners = RoundCorners::All) override;
|
||||
|
||||
std::string DescribeLog() const override { return (orientation_ == ORIENT_HORIZONTAL ? "LinearLayoutHoriz: " : "LinearLayoutVert: ") + View::DescribeLog(); }
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ void DisplayLayoutScreen::CreateViews() {
|
||||
mode_->SetSelection(0, false);
|
||||
// The game goes to another output, like a TV, which doesn't use this layout.
|
||||
mode_->SetEnabled(screenManager()->FindOutput(OutputRole::Game) == nullptr);
|
||||
mode_->ApplyRoundCorners();
|
||||
mode_->SetRoundCorners();
|
||||
bottomControls->Add(mode_);
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ void DisplayLayoutScreen::CreateViews() {
|
||||
return g_Config.bStereoRendering && multiViewSupported;
|
||||
};
|
||||
|
||||
leftColumn->ApplyRoundCorners();
|
||||
leftColumn->SetRoundCorners();
|
||||
|
||||
leftColumn->Add(new ItemHeader(gr->T("Postprocessing shaders")));
|
||||
|
||||
|
||||
+1
-1
@@ -516,7 +516,7 @@ void GameBrowser::Refresh() {
|
||||
layoutChoice->AddChoice(ImageID("I_GRID"));
|
||||
layoutChoice->AddChoice(ImageID("I_LARGE_LIST"));
|
||||
layoutChoice->SetSelection((int)lastViewMode_, false);
|
||||
layoutChoice->ApplyRoundCorners();
|
||||
layoutChoice->SetRoundCorners();
|
||||
layoutChoice->OnChoice.Handle(this, &GameBrowser::LayoutChange);
|
||||
if (!isRecent) {
|
||||
Choice *rotateChoice = topBar->Add(new Choice(ImageID("I_ROTATE_LEFT"), new LayoutParams(64.0f, 64.0f)));
|
||||
|
||||
+1
-1
@@ -386,7 +386,7 @@ void MainScreen::CreateMainButtons(UI::LinearLayout *parent, bool portrait) {
|
||||
gold->SetImageScale(0.6f); // for the left icon.
|
||||
gold->SetShine(true);
|
||||
}
|
||||
parent->ApplyRoundCorners();
|
||||
parent->SetRoundCorners();
|
||||
return;
|
||||
} else {
|
||||
ChoiceGroupList *buttons = parent->Add(new ChoiceGroupList());
|
||||
|
||||
+4
-4
@@ -602,8 +602,8 @@ void CreditsScreen::CreateDialogViews(UI::ViewGroup *parent) {
|
||||
right->Add(new Spacer(0.0f, new LinearLayoutParams(1.0f)));
|
||||
}
|
||||
|
||||
left->ApplyRoundCorners();
|
||||
right->ApplyRoundCorners();
|
||||
left->SetRoundCorners();
|
||||
right->SetRoundCorners();
|
||||
|
||||
int rightYOffset = 0;
|
||||
if (!System_GetPropertyBool(SYSPROP_APP_GOLD)) {
|
||||
@@ -641,8 +641,8 @@ void CreditsScreen::CreateDialogViews(UI::ViewGroup *parent) {
|
||||
});
|
||||
}
|
||||
|
||||
left->ApplyRoundCorners();
|
||||
right->ApplyRoundCorners();
|
||||
left->SetRoundCorners();
|
||||
right->SetRoundCorners();
|
||||
}
|
||||
|
||||
void CreditsScreen::update() {
|
||||
|
||||
@@ -142,6 +142,7 @@
|
||||
#include "UI/DiscordIntegration.h"
|
||||
#include "UI/EmuScreen.h"
|
||||
#include "UI/FirmwareScreen.h"
|
||||
#include "UI/DriverManagerScreen.h"
|
||||
#include "UI/GameInfoCache.h"
|
||||
#include "UI/GameSettingsScreen.h"
|
||||
#include "UI/GPUDriverTestScreen.h"
|
||||
@@ -921,6 +922,9 @@ void NativeInit(int argc, const char *argv[], const CommandLineOptions &cmdLineO
|
||||
} else if (equals(cmdLineOptions.startScreen.value(), "credits")) {
|
||||
g_screenManager->switchScreen(new MainScreen());
|
||||
g_screenManager->push(new CreditsScreen());
|
||||
} else if (equals(cmdLineOptions.startScreen.value(), "driver")) {
|
||||
g_screenManager->switchScreen(new MainScreen());
|
||||
g_screenManager->push(new DriverManagerScreen(Path()));
|
||||
} else {
|
||||
WARN_LOG(Log::System, "Unknown start screen '%s'", cmdLineOptions.startScreen.value().c_str());
|
||||
g_screenManager->switchScreen(new LogoScreen(AfterLogoScreen::DEFAULT));
|
||||
|
||||
+3
-3
@@ -526,7 +526,7 @@ void GamePauseScreen::CreateSavestateControls(UI::LinearLayout *leftColumnItems,
|
||||
if (buttonRow->GetNumSubviews() == 0) {
|
||||
delete buttonRow;
|
||||
} else {
|
||||
buttonRow->ApplyRoundCorners();
|
||||
buttonRow->SetRoundCorners();
|
||||
*extraRow = buttonRow;
|
||||
}
|
||||
}
|
||||
@@ -666,7 +666,7 @@ void GamePauseScreen::CreateViews() {
|
||||
horiz->Add(new Choice(di->T("More info"), ImageID("I_LINK_OUT_QUESTION"), new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT)))->OnClick.Add([](UI::EventParams &e) {
|
||||
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/docs/troubleshooting/save-state-time-warps");
|
||||
});
|
||||
horiz->ApplyRoundCorners();
|
||||
horiz->SetRoundCorners();
|
||||
}
|
||||
LinearLayout *extraRow = nullptr;
|
||||
CreateSavestateControls(saveDataScrollItems, &extraRow);
|
||||
@@ -854,7 +854,7 @@ void GamePauseScreen::CreateViews() {
|
||||
});
|
||||
}
|
||||
|
||||
middleColumn->ApplyRoundCorners();
|
||||
middleColumn->SetRoundCorners();
|
||||
} else {
|
||||
playButton_ = nullptr;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
constexpr double MAX_AUDIO_DURATION_SECONDS = 5.0;
|
||||
AudioFileChooser::AudioFileChooser(RequesterToken token, std::string *value, std::string_view title, UI::UISound sound, UI::LayoutParams *layoutParams) : UI::LinearLayout(ORIENT_HORIZONTAL, layoutParams), sound_(sound) {
|
||||
using namespace UI;
|
||||
SetSpacing(2.0f);
|
||||
SetSpacing(0.0f);
|
||||
if (!layoutParams) {
|
||||
layoutParams_->width = FILL_PARENT;
|
||||
layoutParams_->height = ITEM_HEIGHT;
|
||||
@@ -455,6 +455,7 @@ void RetroAchievementsSettingsScreen::CreateAccountTab(UI::ViewGroup *viewGroup)
|
||||
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://retroachievements.org/createaccount.php");
|
||||
});
|
||||
regLink->SetIconRight(ImageID("I_LINK_OUT"));
|
||||
regLink->SetRoundCorners();
|
||||
}
|
||||
|
||||
using namespace UI;
|
||||
|
||||
@@ -193,7 +193,7 @@ void SavedataPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
System_ShowFileInFolder(savePath_);
|
||||
});
|
||||
}
|
||||
buttonRow->ApplyRoundCorners();
|
||||
buttonRow->SetRoundCorners();
|
||||
parent->Add(buttonRow);
|
||||
}
|
||||
|
||||
@@ -624,7 +624,7 @@ void SavedataScreen::CreateSavedataTab(UI::ViewGroup *savedata) {
|
||||
sortOption_ = SavedataSortOption(e.a);
|
||||
dataBrowser_->SetSortOption(sortOption_);
|
||||
});
|
||||
sortStrip->ApplyRoundCorners();
|
||||
sortStrip->SetRoundCorners();
|
||||
savedata->Add(sortStrip);
|
||||
|
||||
dataBrowser_ = savedata->Add(new SavedataBrowser(savedata_dir, new LayoutParams(FILL_PARENT, FILL_PARENT)));
|
||||
@@ -650,7 +650,7 @@ void SavedataScreen::CreateSavestateTab(UI::ViewGroup *savestate) {
|
||||
sortOption_ = SavedataSortOption(e.a);
|
||||
stateBrowser_->SetSortOption(sortOption_);
|
||||
});
|
||||
sortStrip->ApplyRoundCorners();
|
||||
sortStrip->SetRoundCorners();
|
||||
savestate->Add(sortStrip);
|
||||
|
||||
stateBrowser_ = savestate->Add(new SavedataBrowser(savestate_dir));
|
||||
|
||||
@@ -665,7 +665,7 @@ void TouchControlLayoutScreen::CreateViews() {
|
||||
layoutView_->mode_ = mode;
|
||||
}
|
||||
});
|
||||
mode_->ApplyRoundCorners();
|
||||
mode_->SetRoundCorners();
|
||||
|
||||
leftColumn->Add(mode_);
|
||||
leftColumn->Add(new Choice(co->T("Customize")))->OnClick.Add([this](UI::EventParams &e) {
|
||||
@@ -680,7 +680,7 @@ void TouchControlLayoutScreen::CreateViews() {
|
||||
leftColumn->Add(new Choice(di->T("Reset")))->OnClick.Handle(this, &TouchControlLayoutScreen::OnReset);
|
||||
leftColumn->Add(new Choice(di->T("Back"), ImageID("I_NAVIGATE_BACK")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
||||
|
||||
leftColumn->ApplyRoundCorners();
|
||||
leftColumn->SetRoundCorners();
|
||||
|
||||
leftColumnScroll->SetShadows(false);
|
||||
|
||||
|
||||
Reference in new issue
Block a user