00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00029 #ifndef _GG_ThreeButtonDlg_h_
00030 #define _GG_ThreeButtonDlg_h_
00031
00032 #include <GG/Wnd.h>
00033
00034
00035 namespace GG {
00036
00037 class Button;
00038 class Font;
00039
00050 class GG_API ThreeButtonDlg : public Wnd
00051 {
00052 public:
00054
00055 ThreeButtonDlg(int x, int y, int w, int h, const std::string& msg, const boost::shared_ptr<Font>& font, Clr color,
00056 Clr border_color, Clr button_color, Clr text_color, int buttons, const std::string& zero = "",
00057 const std::string& one = "", const std::string& two = "");
00058
00060 ThreeButtonDlg(int w, int h, const std::string& msg, const boost::shared_ptr<Font>& font, Clr color,
00061 Clr border_color, Clr button_color, Clr text_color, int buttons, const std::string& zero = "",
00062 const std::string& one = "", const std::string& two = "");
00064
00066 Clr ButtonColor() const;
00067 int Result() const;
00068 int DefaultButton() const;
00069 int EscapeButton() const;
00070
00071
00073 virtual void Render();
00074 virtual void KeyPress(Key key, Flags<ModKey> mod_keys);
00075
00076 void SetButtonColor(Clr color);
00077 void SetDefaultButton(int i);
00078 void SetEscapeButton(int i);
00079
00080
00081 protected:
00083 ThreeButtonDlg();
00084
00085
00086 private:
00087 int NumButtons() const;
00088 void Init(const std::string& msg, const boost::shared_ptr<Font>& font, int buttons,
00089 const std::string& zero = "", const std::string& one = "", const std::string& two = "");
00090 void ConnectSignals();
00091 void Button0Clicked();
00092 void Button1Clicked();
00093 void Button2Clicked();
00094
00095 Clr m_color;
00096 Clr m_border_color;
00097 Clr m_text_color;
00098 Clr m_button_color;
00099 int m_default;
00100 int m_escape;
00101 int m_result;
00102 Button* m_button_0;
00103 Button* m_button_1;
00104 Button* m_button_2;
00105
00106 friend class boost::serialization::access;
00107 template <class Archive>
00108 void serialize(Archive& ar, const unsigned int version);
00109 };
00110
00111 }
00112
00113
00114 template <class Archive>
00115 void GG::ThreeButtonDlg::serialize(Archive& ar, const unsigned int version)
00116 {
00117 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Wnd)
00118 & BOOST_SERIALIZATION_NVP(m_color)
00119 & BOOST_SERIALIZATION_NVP(m_border_color)
00120 & BOOST_SERIALIZATION_NVP(m_text_color)
00121 & BOOST_SERIALIZATION_NVP(m_button_color)
00122 & BOOST_SERIALIZATION_NVP(m_default)
00123 & BOOST_SERIALIZATION_NVP(m_escape)
00124 & BOOST_SERIALIZATION_NVP(m_result)
00125 & BOOST_SERIALIZATION_NVP(m_button_0)
00126 & BOOST_SERIALIZATION_NVP(m_button_1)
00127 & BOOST_SERIALIZATION_NVP(m_button_2);
00128
00129 if (Archive::is_loading::value)
00130 ConnectSignals();
00131 }
00132
00133 #endif // _GG_ThreeButtonDlg_h_