![]() |
The ZX Ecosystem v5.1.0;_GUI_v3.1.0
|
This module provides the base definitions for the dialogs.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Namespaces | |
namespace | zxeco |
The main namespace of the library, that spans across all the zx modules. | |
namespace | zxeco::gui |
The namespace of the GUI companion sub-library. | |
Classes | |
class | zxeco::gui::Dialog |
Base class for all dialogs. More... | |
struct | zxeco::gui::Dialog::Result |
Possible results of a dialog after interacting with the user. More... | |
class zxeco::gui::Dialog |
Base class for all dialogs.
Definition at line 41 of file ZXDialogsBase.h.
Static Public Member Functions | |
static const WinColors & | winColorsForDialogs (void) |
Return the window colors used in all dialogs. | |
Public Member Functions | |
Dialog (ZXEco &zxe, const std::string &title) | |
Create a dialog with that ecosystem and title. More... | |
virtual | ~Dialog (void)=default |
Just to activate polymorphism in delete. | |
virtual int | show (bool center, const CharCursor &corner, const CharArea &dims)=0 |
Must show the dialog, interact with the user, and close it. More... | |
Protected Member Functions | |
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. More... | |
Protected Attributes | |
const std::string | title_ |
ZXEco & | zxe_ |
Window::DepthFirstInserter | wins_ |
Note that is not in auto-ID mode. More... | |
|
inline |
Create a dialog with that ecosystem and title.
The dialog is created but not populated with widgets, nor opened. The title can be empty to not showing title bar.
Definition at line 70 of file ZXDialogsBase.h.
|
pure virtual |
Must show the dialog, interact with the user, and close it.
Must return an INT that static-cast to Result or to the derived class own result codes. It creates a new window for the dialog that is destroyed after interacting, but the widgets created by the derived class are kept in the private member wins_ and therefore can be opened again in another window (another call to show()).
center | center the dialog on the screen if TRUE, or use as its top-left corner the one given in corner if FALSE. |
corner | is ignored if center == TRUE. |
dims | are forced dimensions for the dialog, instead of using the automatically calculated ones in this class. |
Implemented in zxeco::gui::MessageDialog, zxeco::gui::ExplanationDialog, zxeco::gui::FileDialog, and zxeco::gui::MenuDialog.
|
protected |
Open the dialog and interact with the user.
The WINS_ protected member must be filled with the widgets of the dialog previously; the interaction ends only if the user closes the desktop (Window::MngResult::DESKCLOSE_EVENT) or if some callback attached to the widgets return false (Window::MngResult::FINISHING_CALLBACK).
If CLOSEIFOUT is true, any click out of the dialog window will close it (returning OUT_CLICK).
If CENTER is true, centers the dialog on the screen.
If DIMS is not empty, use them for the window size; otherwise, auto fit the widgets of WINS_ to a suitable size (this does not work well if the widgets contain elements, such as lists, that might occupy more space in smaller areas than in larger areas -due to the appearance of scroll bars-)
|
protected |
Definition at line 99 of file ZXDialogsBase.h.
|
protected |
Definition at line 100 of file ZXDialogsBase.h.
|
protected |
Note that is not in auto-ID mode.
Definition at line 101 of file ZXDialogsBase.h.
struct zxeco::gui::Dialog::Result |
Possible results of a dialog after interacting with the user.
These are the most common buttons to end the interaction with a dialog; the derived class must populate itself with those buttons. For adding new buttons, use your own enumerations that map into int.
Definition at line 53 of file ZXDialogsBase.h.
Public Types | |
enum | : int { kDesktopClosed = 0 , kOk , kYes , kNo , kCancel , kClose , kSelected , kError , kClickedOutside , kNumBaseResults } |
anonymous enum : int |
Definition at line 55 of file ZXDialogsBase.h.