ThreeButtonDlg.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /* GG is a GUI for SDL and OpenGL.
00003    Copyright (C) 2003 T. Zachary Laine
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public License
00007    as published by the Free Software Foundation; either version 2.1
00008    of the License, or (at your option) any later version.
00009    
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014     
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA
00019 
00020    If you do not wish to comply with the terms of the LGPL please
00021    contact the author as other terms are available for a fee.
00022     
00023    Zach Laine
00024    whatwasthataddress@hotmail.com */
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 } // namespace GG
00112 
00113 // template implementations
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_

Generated on Wed Mar 26 14:35:42 2008 for GG by  doxygen 1.5.2