summaryrefslogtreecommitdiff
path: root/lib/nes/app/ui/screen-browser.hh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nes/app/ui/screen-browser.hh')
-rw-r--r--lib/nes/app/ui/screen-browser.hh26
1 files changed, 20 insertions, 6 deletions
diff --git a/lib/nes/app/ui/screen-browser.hh b/lib/nes/app/ui/screen-browser.hh
index eb66266..7a711c5 100644
--- a/lib/nes/app/ui/screen-browser.hh
+++ b/lib/nes/app/ui/screen-browser.hh
@@ -2,6 +2,7 @@
#include "nes/app/ui/screen.hh"
#include "nes/app/ui/selection.hh"
+#include "nes/app/file-browser.hh"
namespace nes::app
{
@@ -10,21 +11,34 @@ namespace nes::app
/// An interface which allows the user to browse the filesystem for a game.
class screen_browser final : public screen
{
- class selection_impl final : public selection<i32, 5>
+ struct item
{
+ bool is_parent{ false };
+ file_browser::item data{ file_browser::item_type::directory, "" };
+ };
+
+ class selection_impl final : public selection<item, 8>
+ {
+ file_browser& file_browser_;
+
public:
- using selection::selection;
+ explicit selection_impl(file_browser& file_browser)
+ : selection{ 2, 5, 28 }
+ , file_browser_{ file_browser }
+ {
+ }
protected:
- auto render_item(renderer&, i32 const&, i32 x, i32 y, u32 width, color) const -> void override;
- auto load_page(i32(&)[5], u32 page) -> u32 override;
+ auto render_item(renderer&, item const&, i32 x, i32 y, u32 width, color) const -> void override;
+ auto load_page(item(&)[8], u32 page) -> u32 override;
};
input_device_keyboard& keyboard_;
- selection_impl selection_{ 2, 5, 28 };
+ file_browser& file_browser_;
+ selection_impl selection_;
public:
- explicit screen_browser(input_device_keyboard&);
+ explicit screen_browser(input_device_keyboard&, file_browser&);
auto render(renderer&) -> void override;
auto process_events() -> action override;