20#ifndef ZXDIALOGS_COMMON
21#define ZXDIALOGS_COMMON
65 static const uint8_t
kYesNo = kYes | kNo;
72 const std::string & msg, uint8_t buttons);
113 const std::string & expl,
115 const uint8_t * udgs =
nullptr);
164 const std::filesystem::path & path = std::filesystem::path{},
165 const std::string & custom =
"",
166 const std::string & initedit =
"",
167 bool automaticoverwrite =
false);
188 const std::filesystem::path &
lastFile(
void)
const noexcept
192 const std::filesystem::path &
lastPath(
void)
const;
199 const bool automaticoverwrite_;
204 std::filesystem::path lastf_;
Base class for all dialogs.
int show(bool center=true, const CharCursor &corner={0, 0}, const CharArea &dims={0, 0})
Show the dialog and get the file selection.
static const uint8_t kOnlyClose
A combination of buttons with only the CLOSE button.
static const uint8_t kYesNo
A combination of buttons with YES + NO buttons.
int show(bool center=true, const CharCursor &corner={0, 0}, const CharArea &dims={0, 0})
Show the dialog, wait for the user and close it again.
Type
Types of file dialogs.
@ kForLoading
To select a file to load.
@ kForCreating
To select a directory to create.
@ kForSaving
To select a file to save.
@ kForOpening
To select a directory to open.
ExplanationDialog(ZXEco &zxe, const std::string &title, const std::string &expl, const CharArea &explarea, const uint8_t *udgs=nullptr)
Constructor with a certain combination of buttons.
const std::filesystem::path & lastPath(void) const
Return the last path set in the file browser or throw if no browser.
FileDialog(ZXEco &zxe, Type t, const std::string &title, const std::filesystem::path &path=std::filesystem::path{}, const std::string &custom="", const std::string &initedit="", bool automaticoverwrite=false)
Create a dialog for that path.
const LabelList & listOptions(void) const noexcept
Return a reference to the list of options.
MenuDialog(ZXEco &zxe, const std::string &title, const Label::Vector &options)
Create the dialog with those options, that are copied internally.
int show(bool center=true, const CharCursor &corner={0, 0}, const CharArea &dims={0, 0})
Show the dialog and get an option.
size_t lastOption(void) const noexcept
Return the last option selected, or a number >= number of options othrw.
int show(const CharCursor &context)
Show the dialog as a context menu, i.e., auto placing and sizing.
static const uint8_t kOnlyOk
A combination of buttons with only the OK button.
static const uint8_t kOkCancel
A combination of buttons with OK + CANCEL buttons.
MessageDialog(ZXEco &zxe, const std::string &title, const std::string &msg, uint8_t buttons)
Constructor with a certain combination of buttons.
int show(bool center=true, const CharCursor &corner={0, 0}, const CharArea &dims={0, 0})
Show the dialog, get the user choice and close it again.
static const CharArea kAreaNotMessage
Height and width occupied by the entire dialog without message or title.
const std::filesystem::path & lastFile(void) const noexcept
< Return the file selected the last time (or empty if none).
A dialog to provide long, non-editable info.
A dialog to let the user select a file or directory in a filesystem.
A dialog to provide information and request some simple user interaction.
std::vector< Label > Vector
A vector of labels.
A list of labels to be displayed vertically, with possible marks on them.
Class that provides access to the entire ecosystem: graphics, keyboard, etc.
The class that provides the main support for managing the ZX screen.
The main namespace of the library, that spans across all the zx modules.