The ZX Ecosystem v5.1.0;_GUI_v3.1.0
Loading...
Searching...
No Matches
ZXDialogsBase.h
Go to the documentation of this file.
1
2/* **************************************************************************/
20#ifndef ZXDIALOGS_BASE
21#define ZXDIALOGS_BASE
22
23
24#include <memory>
26
27namespace zxeco
28{
29
30namespace gui
31{
32
33
34/* ****************************************************************************
35
36 Base Class: Dialog
37
38*******************************************************************************/
39
41class Dialog
42{
43 public:
44
46 static const WinColors & winColorsForDialogs(void);
47
48
50
53 struct Result
54 {
55 enum : int {
65 kNumBaseResults
66 };
67 };
68
69
70 Dialog(ZXEco & zxe, const std::string & title):title_(nonCtrlString(title)),
71 zxe_{zxe}
72 {}
74
77 virtual ~Dialog(void) = default;
79
81 virtual int show(bool center, const CharCursor & corner,
82 const CharArea & dims) = 0;
84
98 protected:
99
100 const std::string title_;
101 ZXEco & zxe_;
104 Window::MngResult openAndInteract(bool closeifout = false,
105 bool center = true,
106 const CharCursor & corner = {0,0},
107 const CharArea & dims = {0,0});
109
124};
125
126
127} // end namespace gui
128} // end namespace zxeco
129
130#endif
131 // ZXDialogsBase
133
134
135
virtual int show(bool center, const CharCursor &corner, const CharArea &dims)=0
Must show the dialog, interact with the user, and close it.
Dialog(ZXEco &zxe, const std::string &title)
Create a dialog with that ecosystem and title.
Definition: ZXDialogsBase.h:70
static const WinColors & winColorsForDialogs(void)
Return the window colors used in all dialogs.
@ kYes
The user clicked on YES.
Definition: ZXDialogsBase.h:58
@ kDesktopClosed
Desktop closed.
Definition: ZXDialogsBase.h:56
@ kSelected
The user clicked to select.
Definition: ZXDialogsBase.h:62
@ kOk
The user clicked on OK.
Definition: ZXDialogsBase.h:57
@ kError
Error processing user's req.
Definition: ZXDialogsBase.h:63
@ kCancel
The user clicked on CANCEL.
Definition: ZXDialogsBase.h:60
@ kNo
The user clicked on NO.
Definition: ZXDialogsBase.h:59
@ kClose
The user clicked on CLOSE.
Definition: ZXDialogsBase.h:61
@ kClickedOutside
The user clicked outside the dialg.
Definition: ZXDialogsBase.h:64
Window::DepthFirstInserter wins_
Note that is not in auto-ID mode.
virtual ~Dialog(void)=default
Just to activate polymorphism in delete.
Window::MngResult openAndInteract(bool closeifout=false, bool center=true, const CharCursor &corner={0, 0}, const CharArea &dims={0, 0})
Open the dialog and interact with the user.
Base class for all dialogs.
Definition: ZXDialogsBase.h:42
Possible results of a dialog after interacting with the user.
Definition: ZXDialogsBase.h:54
Colors used in a GUI window.
Definition: ZXGUIGeneral.h:53
To insert widgets in a window in a depth-first fashion.
Definition: ZXWindows.h:61
MngResult
Possible results of calling the manage() method.
Definition: ZXWindows.h:114
std::string nonCtrlString(const std::string &txt, char who='A')
Return a version of TXT without control codes.
Class that provides access to the entire ecosystem: graphics, keyboard, etc.
Definition: ZXEcosystem.h:59
The main namespace of the library, that spans across all the zx modules.
Definition: ZXChars.h:31