OSCR
Open Source Cartridge Reader
Loading...
Searching...
No Matches
FileBrowser.h
Go to the documentation of this file.
1
5#pragma once
6#ifndef OSCR_FILE_BROWSER_H_
7# define OSCR_FILE_BROWSER_H_
8
9#include "common/OSCR.h"
10#include "common/Util.h"
11#include "ui.h"
12
13namespace OSCR
14{
15 namespace Apps
16 {
30 {
31 public:
39 FileBrowser(__FlashStringHelper const * browserTitle);
40
49 FileBrowser(__FlashStringHelper const * browserTitle, __FlashStringHelper const * path);
50
57 bool openFile(uint8_t entryIndex, OSCR::Storage::File & selectedFile, oflag_t oflag);
58
59 bool getPath(char buffer[], size_t bufferSize = OSCR::Storage::kMaxPathLength);
60 String getPath();
61
62 protected:
64 FsFile dir;
65 FsFile file;
66 BrowserFile files[UI_FILE_BROWSER_FILES_MAX];
67
69 String cwdString = cwd.getPath();
70
71 void setup();
72 void onPageChange();
73 void chdir();
74 void chdir(uint8_t entryIndex);
75 void cwdRefresh();
76 void sort();
77 bool onConfirm();
78 };
79 }
80
81 extern void selectFile(__FlashStringHelper const * title, oflag_t oflag);
82 extern void selectFile(__FlashStringHelper const * title, OSCR::Storage::File & file, oflag_t oflag, bool useShared = true);
83 extern void selectFile(__FlashStringHelper const * title, OSCR::Storage::File & file, oflag_t oflag, char * nameBuff, size_t nameSize, char * pathBuff = nullptr, size_t pathSize = 0);
84 extern void selectFile(__FlashStringHelper const * title, __FlashStringHelper const * path, OSCR::Storage::File & file, oflag_t oflag, bool useShared = true);
85 extern void selectFile(__FlashStringHelper const * title, __FlashStringHelper const * path, OSCR::Storage::File & file, oflag_t oflag, char * nameBuff, size_t nameSize, char * pathBuff = nullptr, size_t pathSize = 0);
86}
87
88#endif /* OSCR_FILE_BROWSER_H_ */
bool openFile(uint8_t entryIndex, OSCR::Storage::File &selectedFile, oflag_t oflag)
Definition FileBrowser.cpp:183
FileBrowser(__FlashStringHelper const *browserTitle, __FlashStringHelper const *path)
FileBrowser(__FlashStringHelper const *browserTitle)
Definition FileBrowser.cpp:96
Definition Storage.h:88
Definition Storage.h:66
Abstract menu renderer class.
Definition interfaces.h:224
Main program.
Definition Storage.h:13
Data struct for the file browser.
Definition Types.h:111