OSCR
Open Source Cartridge Reader
Loading...
Searching...
No Matches
OSCR::Apps::FileBrowser Class Reference

An interface for handling choosing a file. More...

#include <apps/FileBrowser.h>

Inheritance diagram for OSCR::Apps::FileBrowser:
OSCR::UI::MenuRenderer

Public Member Functions

 FileBrowser (__FlashStringHelper const *browserTitle)
 FileBrowser (__FlashStringHelper const *browserTitle, __FlashStringHelper const *path)
bool openFile (uint8_t entryIndex, OSCR::Storage::File &selectedFile, oflag_t oflag)
bool getPath (char buffer[], size_t bufferSize=OSCR::Storage::kMaxPathLength)
String getPath ()
Public Member Functions inherited from OSCR::UI::MenuRenderer
 MenuRenderer (char const *menuTitle)
 MenuRenderer (char const *menuTitle, uint16_t entryCount)
 MenuRenderer (__FlashStringHelper const *menuTitle)
 MenuRenderer (__FlashStringHelper const *menuTitle, uint16_t entryCount)
uint16_t getPage ()
uint16_t getPageCount ()
bool isLast ()
uint16_t getPageEntryCount ()
uint16_t getPageEntryOffset ()
uint16_t getEntryIndex ()
void gotoPage (uint16_t page)
void navNext ()
void navPrev ()
void nextPage ()
void prevPage ()
void render ()
uint16_t select ()

Protected Member Functions

void setup ()
void onPageChange ()
void chdir ()
void chdir (uint8_t entryIndex)
void cwdRefresh ()
void sort ()
bool onConfirm ()
Protected Member Functions inherited from OSCR::UI::MenuRenderer
void navigate (NavDir direction)
void onSelectionChange ()

Protected Attributes

FsFile dir
FsFile file
BrowserFile files [UI_FILE_BROWSER_FILES_MAX]
OSCR::Storage::Path cwd = OSCR::Storage::Path()
String cwdString = cwd.getPath()
Protected Attributes inherited from OSCR::UI::MenuRenderer
char title [30] = {}
uint16_t count
uint16_t totalPages
uint16_t pageEntriesLast
uint16_t currentPage = 1
uint16_t selection = 0
bool rendered = false
char pageEntries [((uint8_t) 32)][((uint8_t) 31)]

Detailed Description

An interface for handling choosing a file.

Create a file browser interface.

Note
Available memory on embedded microcontrollers is limited. You should consider using OSCR::UI::menu() instead of implementing this class directly.

Constructor & Destructor Documentation

◆ FileBrowser() [1/2]

OSCR::Apps::FileBrowser::FileBrowser ( __FlashStringHelper const * browserTitle)

Create a file browser interface for a path.

Parameters
browserTitleA flash string to use for the menu title.
Todo
Actually use the path parameter.

◆ FileBrowser() [2/2]

OSCR::Apps::FileBrowser::FileBrowser ( __FlashStringHelper const * browserTitle,
__FlashStringHelper const * path )

Create a file browser interface for a path.

Parameters
browserTitleA flash string to use for the menu title.
pathDirectory path to start in.
Todo
Actually use the path parameter.

Member Function Documentation

◆ onConfirm()

bool OSCR::Apps::FileBrowser::onConfirm ( )
protectedvirtual

◆ onPageChange()

void OSCR::Apps::FileBrowser::onPageChange ( )
protectedvirtual

◆ openFile()

bool OSCR::Apps::FileBrowser::openFile ( uint8_t entryIndex,
OSCR::Storage::File & selectedFile,
oflag_t oflag )

Get the file represented by a specific index.

Parameters
entryIndexIndex of the desired file.
selectedFileVariable to store the file in.

◆ setup()

void OSCR::Apps::FileBrowser::setup ( )
protectedvirtual

The documentation for this class was generated from the following files:
  • C:/Developer/Projects/OSCR/oscr-firmware/include/apps/FileBrowser.h
  • apps/FileBrowser.cpp