Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GUI_DIALOGS_MESSAGE_HPP_INCLUDED
00017 #define GUI_DIALOGS_MESSAGE_HPP_INCLUDED
00018
00019 #include "gui/dialogs/dialog.hpp"
00020 #include "gui/widgets/control.hpp"
00021
00022 namespace gui2 {
00023
00024 class tbutton;
00025
00026
00027
00028
00029
00030
00031
00032 class tmessage : public tdialog
00033 {
00034 friend struct tmessage_implementation;
00035 public:
00036 tmessage(const std::string& title, const std::string& message,
00037 const bool auto_close)
00038 : title_(title)
00039 , image_()
00040 , message_(message)
00041 , auto_close_(auto_close)
00042 , buttons_(count)
00043 {}
00044
00045 enum tbutton_id {
00046 left_1 = 0
00047 , cancel
00048 , ok
00049 , right_1
00050 , count
00051 };
00052
00053
00054
00055
00056
00057
00058
00059 enum tbutton_style
00060 {
00061 auto_close
00062 , ok_button
00063 , close_button
00064 , ok_cancel_buttons
00065 , cancel_button
00066 , yes_no_buttons
00067 };
00068
00069 void set_button_caption(const tbutton_id button,
00070 const std::string& caption);
00071
00072 void set_button_visible(const tbutton_id button,
00073 const twidget::tvisible visible);
00074
00075 void set_button_retval(const tbutton_id button,
00076 const int retval);
00077
00078
00079
00080 void set_title(const std::string& title) { title_ = title; }
00081
00082 void set_image(const std::string& image) { image_ = image; }
00083
00084 void set_message(const std::string& message) { message_ = message; }
00085
00086 void set_auto_close(const bool auto_close) { auto_close_ = auto_close; }
00087
00088 protected:
00089
00090 void pre_show(CVideo& video, twindow& window);
00091
00092
00093 void post_show(twindow& window);
00094
00095 private:
00096
00097 std::string title_;
00098
00099
00100
00101
00102
00103
00104 std::string image_;
00105
00106
00107 std::string message_;
00108
00109
00110
00111
00112
00113 bool auto_close_;
00114
00115 struct tbutton_status
00116 {
00117 tbutton_status();
00118
00119 tbutton* button;
00120 std::string caption;
00121 twidget::tvisible visible;
00122 int retval;
00123 };
00124
00125
00126 std::vector<tbutton_status> buttons_;
00127
00128
00129 virtual const std::string& window_id() const;
00130 };
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 void show_message(CVideo& video, const std::string& title,
00147 const std::string& message, const std::string& button_caption = "",
00148 const bool auto_close = true);
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166 int show_message(CVideo& video, const std::string& title,
00167 const std::string& message, const tmessage::tbutton_style button_style,
00168 bool message_use_markup = false,
00169 bool title_use_markup = false);
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 void show_error_message(CVideo& video, const std::string& message,
00180 bool message_use_markup = false);
00181
00182 }
00183
00184 #endif
00185