ThreeButtonDlg.h
Go to the documentation of this file.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
00057 class GG_API ThreeButtonDlg : public Wnd
00058 {
00059 public:
00061
00062 ThreeButtonDlg(X x, Y y, X w, Y h, const std::string& msg, const boost::shared_ptr<Font>& font, Clr color,
00063 Clr border_color, Clr button_color, Clr text_color, std::size_t buttons, const std::string& zero = "",
00064 const std::string& one = "", const std::string& two = "");
00065
00067 ThreeButtonDlg(X w, Y h, const std::string& msg, const boost::shared_ptr<Font>& font, Clr color,
00068 Clr border_color, Clr button_color, Clr text_color, std::size_t buttons, const std::string& zero = "",
00069 const std::string& one = "", const std::string& two = "");
00071
00073 Clr ButtonColor() const;
00074 std::size_t Result() const;
00075 std::size_t DefaultButton() const;
00076 std::size_t EscapeButton() const;
00077
00078
00080 virtual void Render();
00081 virtual void KeyPress(Key key, boost::uint32_t key_code_point, Flags<ModKey> mod_keys);
00082
00083 void SetButtonColor(Clr color);
00084 void SetDefaultButton(std::size_t i);
00085 void SetEscapeButton(std::size_t i);
00086
00087
00088 static const std::size_t NO_BUTTON;
00089
00090 protected:
00092 ThreeButtonDlg();
00093
00094
00095 private:
00096 std::size_t NumButtons() const;
00097 void Init(const std::string& msg, const boost::shared_ptr<Font>& font, std::size_t buttons,
00098 const std::string& zero = "", const std::string& one = "", const std::string& two = "");
00099 void ConnectSignals();
00100 void Button0Clicked();
00101 void Button1Clicked();
00102 void Button2Clicked();
00103
00104 Clr m_color;
00105 Clr m_border_color;
00106 Clr m_text_color;
00107 Clr m_button_color;
00108 std::size_t m_default;
00109 std::size_t m_escape;
00110 std::size_t m_result;
00111 Button* m_button_0;
00112 Button* m_button_1;
00113 Button* m_button_2;
00114
00115 friend class boost::serialization::access;
00116 template <class Archive>
00117 void serialize(Archive& ar, const unsigned int version);
00118 };
00119
00120 }
00121
00122
00123 template <class Archive>
00124 void GG::ThreeButtonDlg::serialize(Archive& ar, const unsigned int version)
00125 {
00126 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Wnd)
00127 & BOOST_SERIALIZATION_NVP(m_color)
00128 & BOOST_SERIALIZATION_NVP(m_border_color)
00129 & BOOST_SERIALIZATION_NVP(m_text_color)
00130 & BOOST_SERIALIZATION_NVP(m_button_color)
00131 & BOOST_SERIALIZATION_NVP(m_default)
00132 & BOOST_SERIALIZATION_NVP(m_escape)
00133 & BOOST_SERIALIZATION_NVP(m_result)
00134 & BOOST_SERIALIZATION_NVP(m_button_0)
00135 & BOOST_SERIALIZATION_NVP(m_button_1)
00136 & BOOST_SERIALIZATION_NVP(m_button_2);
00137
00138 if (Archive::is_loading::value)
00139 ConnectSignals();
00140 }
00141
00142 #endif // _GG_ThreeButtonDlg_h_