Main class to show messages to the user. More...
#include <message.hpp>
Classes | |
struct | tbutton_status |
Public Types | |
enum | tbutton_id { left_1 = 0, cancel, ok, right_1, count } |
enum | tbutton_style { auto_close, ok_button, close_button, ok_cancel_buttons, cancel_button, yes_no_buttons } |
Selects the style of the buttons to be shown. More... | |
Public Member Functions | |
tmessage (const std::string &title, const std::string &message, const bool auto_close, const bool message_use_markup) | |
void | set_button_caption (const tbutton_id button, const std::string &caption) |
void | set_button_visible (const tbutton_id button, const twidget::tvisible::scoped_enum visible) |
void | set_button_retval (const tbutton_id button, const int retval) |
void | set_title (const std::string &title) |
void | set_image (const std::string &image) |
void | set_message (const std::string &message) |
void | set_auto_close (const bool auto_close) |
Public Member Functions inherited from gui2::tdialog | |
tdialog () | |
virtual | ~tdialog () |
bool | show (CVideo &video, const unsigned auto_close_time=0) |
Shows the window. More... | |
int | get_retval () const |
void | set_always_save_fields (const bool always_save_fields) |
void | set_restore (const bool restore) |
Protected Member Functions | |
void | pre_show (twindow &window) |
Inherited from tdialog. More... | |
void | post_show (twindow &window) |
Inherited from tdialog. More... | |
Protected Member Functions inherited from gui2::tdialog | |
tfield_bool * | register_bool (const std::string &id, const bool mandatory, const std::function< bool()> &callback_load_value=std::function< bool()>(), const std::function< void(const bool)> &callback_save_value=std::function< void(const bool)>(), const std::function< void(twidget &)> &callback_change=std::function< void(twidget &)>()) |
Creates a new boolean field. More... | |
tfield_bool * | register_bool (const std::string &id, const bool mandatory, bool &linked_variable, const std::function< void(twidget &)> &callback_change=std::function< void(twidget &)>()) |
Creates a new boolean field. More... | |
tfield_integer * | register_integer (const std::string &id, const bool mandatory, const std::function< int()> &callback_load_value=std::function< int()>(), const std::function< void(const int)> &callback_save_value=std::function< void(const int)>()) |
Creates a new integer field. More... | |
tfield_integer * | register_integer (const std::string &id, const bool mandatory, int &linked_variable) |
Creates a new integer field. More... | |
tfield_text * | register_text (const std::string &id, const bool mandatory, const std::function< std::string()> &callback_load_value=std::function< std::string()>(), const std::function< void(const std::string &)> &callback_save_value=std::function< void(const std::string &)>(), const bool capture_focus=false) |
Creates a new text field. More... | |
tfield_text * | register_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false) |
Creates a new text field. More... | |
tfield_label * | register_label (const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false) |
Registers a new control as a label. More... | |
tfield_label * | register_image (const std::string &id, const bool mandatory, const std::string &filename) |
Registers a new control as image. More... | |
Private Member Functions | |
virtual const std::string & | window_id () const |
Inherited from tdialog, implemented by REGISTER_DIALOG. More... | |
Private Attributes | |
std::string | title_ |
The title for the dialog. More... | |
std::string | image_ |
The image which is shown in the dialog. More... | |
std::string | message_ |
The message to show to the user. More... | |
bool | auto_close_ |
Does the window need to use click_dismiss when the dialog doesn't need a scrollbar. More... | |
bool | message_use_markup_ |
Whether to enable formatting markup for the dialog message. More... | |
std::vector< tbutton_status > | buttons_ |
Holds a pointer to the buttons. More... | |
Friends | |
struct | tmessage_implementation |
Main class to show messages to the user.
It can be used to show a message or ask a result from the user. For the most common usage cases there are helper functions defined.
Definition at line 32 of file message.hpp.
Enumerator | |
---|---|
left_1 | |
cancel | |
ok | |
right_1 | |
count |
Definition at line 50 of file message.hpp.
Selects the style of the buttons to be shown.
These values are not directly implemented in this class but are used by our helper functions.
Definition at line 64 of file message.hpp.
|
inline |
Definition at line 37 of file message.hpp.
Inherited from tdialog.
Reimplemented from gui2::tdialog.
Definition at line 101 of file message.cpp.
References buttons_.
Inherited from tdialog.
Reimplemented from gui2::tdialog.
Definition at line 65 of file message.cpp.
References auto_close_, buttons_, cancel, image_, gui2::tmessage_implementation::init_button(), gui2::twidget::tvisible::invisible, left_1, message_, message_use_markup_, ok, right_1, gui2::tcontrol::set_label(), gui2::tcontrol::set_use_markup(), gui2::twidget::set_visible(), and title_.
|
inline |
Definition at line 103 of file message.hpp.
References auto_close, and auto_close_.
void gui2::tmessage::set_button_caption | ( | const tbutton_id | button, |
const std::string & | caption | ||
) |
Definition at line 109 of file message.cpp.
References buttons_.
Referenced by gui2::show_message().
void gui2::tmessage::set_button_retval | ( | const tbutton_id | button, |
const int | retval | ||
) |
Definition at line 127 of file message.cpp.
References buttons_.
void gui2::tmessage::set_button_visible | ( | const tbutton_id | button, |
const twidget::tvisible::scoped_enum | visible | ||
) |
Definition at line 118 of file message.cpp.
References buttons_.
Referenced by gui2::show_message().
|
inline |
Definition at line 93 of file message.hpp.
References image_.
|
inline |
Definition at line 98 of file message.hpp.
References message_.
|
inline |
Definition at line 88 of file message.hpp.
References title_.
|
privatevirtual |
Inherited from tdialog, implemented by REGISTER_DIALOG.
Implements gui2::tdialog.
|
friend |
Definition at line 34 of file message.hpp.
|
private |
Does the window need to use click_dismiss when the dialog doesn't need a scrollbar.
Definition at line 133 of file message.hpp.
Referenced by pre_show(), and set_auto_close().
|
private |
Holds a pointer to the buttons.
Definition at line 149 of file message.hpp.
Referenced by post_show(), pre_show(), set_button_caption(), set_button_retval(), and set_button_visible().
|
private |
The image which is shown in the dialog.
This image can be an icon or portrait or any other image.
Definition at line 124 of file message.hpp.
Referenced by pre_show(), and set_image().
|
private |
The message to show to the user.
Definition at line 127 of file message.hpp.
Referenced by pre_show(), and set_message().
|
private |
Whether to enable formatting markup for the dialog message.
Definition at line 136 of file message.hpp.
Referenced by pre_show().
|
private |
The title for the dialog.
Definition at line 117 of file message.hpp.
Referenced by pre_show(), and set_title().