Use I_FOLDER_PINNED

This commit is contained in:
Henrik Rydgård committed 2025-10-07 16:02:26 -06:00
1 parent 26a9b5d95f
commit 3917753d2e
1 file changed
+12 -4
+12 -4
View File
@@ -447,10 +447,15 @@ public:
return absolute_;
}
void SetPinned(bool pin) {
pinned_ = pin;
}
private:
Path path_;
bool gridStyle_;
bool absolute_;
bool pinned_ = false;
};
void DirButton::Draw(UIContext &dc) {
@@ -465,7 +470,7 @@ void DirButton::Draw(UIContext &dc) {
std::string_view text(GetText());
ImageID image = ImageID("I_FOLDER");
ImageID image = ImageID(pinned_ ? "I_FOLDER_PINNED" : "I_FOLDER");
if (text == "..") {
image = ImageID("I_UP_DIRECTORY");
}
@@ -481,7 +486,7 @@ void DirButton::Draw(UIContext &dc) {
if (compact) {
// No icon, except "up"
dc.PushScissor(bounds_);
if (image == ImageID("I_FOLDER")) {
if (image == ImageID("I_FOLDER") || image == ImageID("I_FOLDER_PINNED")) {
dc.DrawText(text, bounds_.x + 5, bounds_.centerY(), style.fgColor, ALIGN_VCENTER);
} else {
dc.Draw()->DrawImage(image, bounds_.centerX(), bounds_.centerY(), gridStyle_ ? g_Config.fGameGridScale : 1.0, style.fgColor, ALIGN_CENTER);
@@ -912,9 +917,12 @@ void GameBrowser::Refresh() {
// Add any pinned paths before other directories.
auto pinnedPaths = GetPinnedPaths();
for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) {
gameList_->Add(new DirButton(*it, GetBaseName((*it).ToString()), *gridStyle_, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT)))->
OnClick.Handle(this, &GameBrowser::NavigateClick);
DirButton *pinnedDir = gameList_->Add(new DirButton(*it, GetBaseName((*it).ToString()), *gridStyle_, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT)));
pinnedDir->OnClick.Handle(this, &GameBrowser::NavigateClick);
pinnedDir->SetPinned(true);
}
// Add a separator?
}
if (listingPending_) {