GG: ThreeButtonDlg.h Source File

GG

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

ThreeButtonDlg.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /* GG is a GUI for SDL and OpenGL.
3 Copyright (C) 2003-2008 T. Zachary Laine
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License
7 as published by the Free Software Foundation; either version 2.1
8 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA
19
20 If you do not wish to comply with the terms of the LGPL please
21 contact the author as other terms are available for a fee.
22
23 Zach Laine
24 whatwasthataddress@gmail.com */
25
29 #ifndef _GG_ThreeButtonDlg_h_
30 #define _GG_ThreeButtonDlg_h_
31
32 #include <GG/Wnd.h>
33
34
35 namespace GG {
36
37 class Button;
38 class Font;
39
57 class GG_API ThreeButtonDlg : public Wnd
58 {
59 public:
61
62 ThreeButtonDlg(X x, Y y, X w, Y h, const std::string& msg, const boost::shared_ptr<Font>& font, Clr color,
63 Clr border_color, Clr button_color, Clr text_color, std::size_t buttons, const std::string& zero = "",
64 const std::string& one = "", const std::string& two = "");
65
67 ThreeButtonDlg(X w, Y h, const std::string& msg, const boost::shared_ptr<Font>& font, Clr color,
68 Clr border_color, Clr button_color, Clr text_color, std::size_t buttons, const std::string& zero = "",
69 const std::string& one = "", const std::string& two = "");
71
73 Clr ButtonColor() const;
74 std::size_t Result() const;
75 std::size_t DefaultButton() const;
76 std::size_t EscapeButton() const;
77
78
80 virtual void Render();
81 virtual void KeyPress(Key key, boost::uint32_t key_code_point, Flags<ModKey> mod_keys);
82
83 void SetButtonColor(Clr color);
84 void SetDefaultButton(std::size_t i);
85 void SetEscapeButton(std::size_t i);
86
87
88 static const std::size_t NO_BUTTON;
89
90 protected:
92 ThreeButtonDlg();
93
94
95 private:
96 std::size_t NumButtons() const;
97 void Init(const std::string& msg, const boost::shared_ptr<Font>& font, std::size_t buttons,
98 const std::string& zero = "", const std::string& one = "", const std::string& two = "");
99 void ConnectSignals();
100 void Button0Clicked();
101 void Button1Clicked();
102 void Button2Clicked();
103
104 Clr m_color;
105 Clr m_border_color;
106 Clr m_text_color;
107 Clr m_button_color;
108 std::size_t m_default;
109 std::size_t m_escape;
110 std::size_t m_result;
111 Button* m_button_0;
112 Button* m_button_1;
113 Button* m_button_2;
114 };
115
116 } // namespace GG
117
118 #endif