From a9425eea7c652a59d043949963e44b174e34deff Mon Sep 17 00:00:00 2001 From: Gericom Date: Sun, 1 Mar 2026 13:43:31 +0100 Subject: [PATCH] Add cheats not found label --- .../views/cheats/CheatsBottomSheetView.cpp | 24 +++++++++++++++---- .../views/cheats/CheatsBottomSheetView.h | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/arm9/source/romBrowser/views/cheats/CheatsBottomSheetView.cpp b/arm9/source/romBrowser/views/cheats/CheatsBottomSheetView.cpp index b34cb7f..98cd9b7 100644 --- a/arm9/source/romBrowser/views/cheats/CheatsBottomSheetView.cpp +++ b/arm9/source/romBrowser/views/cheats/CheatsBottomSheetView.cpp @@ -13,24 +13,30 @@ #include "gui/DescendingStackVramManager.h" #include "CheatsBottomSheetView.h" -#define TITLE_LABEL_X 20 -#define TITLE_LABEL_Y 16 +#define TITLE_LABEL_X 20 +#define TITLE_LABEL_Y 16 -#define LIST_X 16 -#define LIST_Y 36 +#define NO_CHEATS_FOUND_LABEL_X 20 +#define NO_CHEATS_FOUND_LABEL_Y 36 + +#define LIST_X 16 +#define LIST_Y 36 CheatsBottomSheetView::CheatsBottomSheetView(std::unique_ptr viewModel, const MaterialColorScheme* materialColorScheme, const IFontRepository* fontRepository, FocusManager* focusManager) : _viewModel(std::move(viewModel)) - , _titleLabel(128, 16, 25, fontRepository->GetFont(FontType::Medium11)) + , _titleLabel(64, 16, 25, fontRepository->GetFont(FontType::Medium11)) + , _noCheatsFoundLabel(96, 16, 25, fontRepository->GetFont(FontType::Regular10)) , _cheatListRecycler(std::make_unique(LIST_X, LIST_Y, 224, 124, RecyclerView::Mode::VerticalList)) , _materialColorScheme(materialColorScheme) , _fontRepository(fontRepository) , _focusManager(focusManager) { _titleLabel.SetText(u"Cheats"); + _noCheatsFoundLabel.SetText(u"No cheats found."); AddChildTail(&_titleLabel); + AddChildTail(&_noCheatsFoundLabel); AddChildTail(_cheatListRecycler.get()); } @@ -64,6 +70,7 @@ void CheatsBottomSheetView::InitVram(const VramContext& vramContext) void CheatsBottomSheetView::Update() { _titleLabel.SetPosition(TITLE_LABEL_X, _position.y + TITLE_LABEL_Y); + _noCheatsFoundLabel.SetPosition(NO_CHEATS_FOUND_LABEL_X, _position.y + NO_CHEATS_FOUND_LABEL_Y); _cheatListRecycler->SetPosition(LIST_X, _position.y + LIST_Y); if (_viewModel->GetState() == CheatsViewModel::State::DisplayCheats) { @@ -119,6 +126,13 @@ void CheatsBottomSheetView::Draw(GraphicsContext& graphicsContext) _titleLabel.SetBackgroundColor(backColor); _titleLabel.SetForegroundColor(_materialColorScheme->onSurface); _titleLabel.Draw(graphicsContext); + + if (_viewModel->GetState() == CheatsViewModel::State::NoCheats) + { + _noCheatsFoundLabel.SetBackgroundColor(backColor); + _noCheatsFoundLabel.SetForegroundColor(_materialColorScheme->onSurface); + _noCheatsFoundLabel.Draw(graphicsContext); + } } graphicsContext.SetPriority(oldPrio); graphicsContext.ResetClipArea(); diff --git a/arm9/source/romBrowser/views/cheats/CheatsBottomSheetView.h b/arm9/source/romBrowser/views/cheats/CheatsBottomSheetView.h index 163f611..9fc8ee3 100644 --- a/arm9/source/romBrowser/views/cheats/CheatsBottomSheetView.h +++ b/arm9/source/romBrowser/views/cheats/CheatsBottomSheetView.h @@ -40,6 +40,7 @@ public: private: std::unique_ptr _viewModel; Label2DView _titleLabel; + Label2DView _noCheatsFoundLabel; std::unique_ptr _cheatListRecycler; CheatsAdapter* _cheatsAdapter = nullptr; const MaterialColorScheme* _materialColorScheme;