GG
StyleFactory.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_StyleFactory_h_
30 #define _GG_StyleFactory_h_
31 
32 #include <GG/ClrConstants.h>
33 #include <GG/DynamicGraphic.h>
34 #include <GG/FontFwd.h>
35 #include <GG/MultiEditFwd.h>
36 
37 
38 namespace GG {
39 
40 class Button;
41 class ColorDlg;
42 class DropDownList;
43 class DynamicGraphic;
44 class FileDlg;
45 class Edit;
46 class Font;
47 class GroupBox;
48 class ListBox;
49 class MenuBar;
50 class MultiEdit;
51 class RadioButtonGroup;
52 class Scroll;
53 template <class T>
54 class Slider;
55 template <class T>
56 class Spin;
57 class StateButton;
58 class StaticGraphic;
59 class TabBar;
60 class TabWnd;
61 class TextControl;
62 class Texture;
63 class ThreeButtonDlg;
64 struct UnicodeCharset;
65 
80 class GG_API StyleFactory
81 {
82 public:
84  StyleFactory();
85  virtual ~StyleFactory();
86 
87 
90  virtual boost::shared_ptr<Font> DefaultFont(unsigned int pts = 12) const;
91 
95  virtual boost::shared_ptr<Font> DefaultFont(unsigned int pts,
96  const UnicodeCharset* first,
97  const UnicodeCharset* last) const;
98 
100 
101  virtual Button* NewButton(X x, Y y, X w, Y h, const std::string& str,
102  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
103  Flags<WndFlag> flags = INTERACTIVE) const;
104 
106  virtual StateButton* NewStateButton(X x, Y y, X w, Y h, const std::string& str,
107  const boost::shared_ptr<Font>& font, Flags<TextFormat> format, Clr color,
108  Clr text_color = CLR_BLACK, Clr interior = CLR_ZERO,
110 
112  virtual RadioButtonGroup* NewRadioButtonGroup(X x, Y y, X w, Y h, Orientation orientation) const;
113 
115  virtual DropDownList* NewDropDownList(X x, Y y, X w, Y h, Y drop_ht, Clr color,
116  Flags<WndFlag> flags = INTERACTIVE) const;
117 
119  virtual DynamicGraphic* NewDynamicGraphic(X x, Y y, X w, Y h, bool loop, X frame_width, Y frame_height,
120  int margin, const std::vector<boost::shared_ptr<Texture> >& textures,
121  Flags<GraphicStyle> style = GRAPHIC_NONE, int frames = DynamicGraphic::ALL_FRAMES,
122  Flags<WndFlag> flags = Flags<WndFlag>()) const;
123 
125  virtual Edit* NewEdit(X x, Y y, X w, const std::string& str, const boost::shared_ptr<Font>& font,
126  Clr color, Clr text_color = CLR_BLACK, Clr interior = CLR_ZERO,
127  Flags<WndFlag> flags = INTERACTIVE) const;
128 
130  virtual ListBox* NewListBox(X x, Y y, X w, Y h, Clr color, Clr interior = CLR_ZERO,
131  Flags<WndFlag> flags = INTERACTIVE) const;
132 
134  virtual MenuBar* NewMenuBar(X x, Y y, X w, const boost::shared_ptr<Font>& font,
135  Clr text_color = CLR_WHITE, Clr color = CLR_BLACK,
136  Clr interior = CLR_SHADOW) const;
137 
139  virtual MultiEdit* NewMultiEdit(X x, Y y, X w, Y h, const std::string& str,
140  const boost::shared_ptr<Font>& font, Clr color, Flags<MultiEditStyle> style = MULTI_LINEWRAP,
141  Clr text_color = CLR_BLACK, Clr interior = CLR_ZERO,
142  Flags<WndFlag> flags = INTERACTIVE) const;
143 
145  virtual Scroll* NewScroll(X x, Y y, X w, Y h, Orientation orientation, Clr color, Clr interior,
147 
149  virtual Slider<int>* NewIntSlider(X x, Y y, X w, Y h, int min, int max, Orientation orientation,
150  SliderLineStyle style, Clr color, int tab_width, int line_width = 5,
151  Flags<WndFlag> flags = INTERACTIVE) const;
152 
154  virtual Slider<double>* NewDoubleSlider(X x, Y y, X w, Y h, double min, double max, Orientation orientation,
155  SliderLineStyle style, Clr color, int tab_width, int line_width = 5,
156  Flags<WndFlag> flags = INTERACTIVE) const;
157 
159  virtual Spin<int>* NewIntSpin(X x, Y y, X w, int value, int step, int min, int max, bool edits,
160  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
161  Clr interior = CLR_ZERO, Flags<WndFlag> flags = INTERACTIVE) const;
162 
164  virtual Spin<double>* NewDoubleSpin(X x, Y y, X w, double value, double step, double min, double max, bool edits,
165  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
166  Clr interior = CLR_ZERO, Flags<WndFlag> flags = INTERACTIVE) const;
167 
169  virtual StaticGraphic* NewStaticGraphic(X x, Y y, X w, Y h, const boost::shared_ptr<Texture>& texture,
171 
173  virtual TabBar* NewTabBar(X x, Y y, X w, const boost::shared_ptr<Font>& font, Clr color,
174  Clr text_color = CLR_BLACK, TabBarStyle style = TAB_BAR_ATTACHED,
175  Flags<WndFlag> flags = INTERACTIVE) const;
176 
178  virtual TextControl* NewTextControl(X x, Y y, X w, Y h, const std::string& str,
179  const boost::shared_ptr<Font>& font, Clr color = CLR_BLACK,
180  Flags<TextFormat> format = FORMAT_NONE, Flags<WndFlag> flags = Flags<WndFlag>()) const;
181 
183  virtual TextControl* NewTextControl(X x, Y y, const std::string& str, const boost::shared_ptr<Font>& font,
184  Clr color = CLR_BLACK, Flags<TextFormat> format = FORMAT_NONE,
185  Flags<WndFlag> flags = Flags<WndFlag>()) const;
186 
188  virtual GroupBox* NewGroupBox(X x, Y y, X w, Y h, const std::string& label, const boost::shared_ptr<Font>& font,
189  Clr color, Clr text_color = CLR_BLACK, Clr interior = CLR_ZERO,
190  Flags<WndFlag> flags = Flags<WndFlag>()) const;
192 
194 
195  virtual ListBox* NewDropDownListListBox(X x, Y y, X w, Y h, Clr color, Clr interior = CLR_ZERO,
196  Flags<WndFlag> flags = INTERACTIVE) const;
197 
199  virtual Scroll* NewListBoxVScroll(X x, Y y, X w, Y h, Clr color, Clr interior,
201 
203  virtual Scroll* NewListBoxHScroll(X x, Y y, X w, Y h, Clr color, Clr interior,
205 
207  virtual Scroll* NewMultiEditVScroll(X x, Y y, X w, Y h, Clr color, Clr interior,
209 
211  virtual Scroll* NewMultiEditHScroll(X x, Y y, X w, Y h, Clr color, Clr interior,
213 
215  virtual Button* NewScrollUpButton(X x, Y y, X w, Y h, const std::string& str,
216  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
218 
220  virtual Button* NewScrollDownButton(X x, Y y, X w, Y h, const std::string& str,
221  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
223 
225  virtual Button* NewVScrollTabButton(X x, Y y, X w, Y h, const std::string& str,
226  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
227  Flags<WndFlag> flags = INTERACTIVE) const;
228 
230  virtual Button* NewScrollLeftButton(X x, Y y, X w, Y h, const std::string& str,
231  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
233 
235  virtual Button* NewScrollRightButton(X x, Y y, X w, Y h, const std::string& str,
236  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
238 
240  virtual Button* NewHScrollTabButton(X x, Y y, X w, Y h, const std::string& str,
241  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
242  Flags<WndFlag> flags = INTERACTIVE) const;
243 
245  virtual Button* NewVSliderTabButton(X x, Y y, X w, Y h, const std::string& str,
246  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
247  Flags<WndFlag> flags = INTERACTIVE) const;
248 
250  virtual Button* NewHSliderTabButton(X x, Y y, X w, Y h, const std::string& str,
251  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
252  Flags<WndFlag> flags = INTERACTIVE) const;
253 
255  virtual Button* NewSpinIncrButton(X x, Y y, X w, Y h, const std::string& str,
256  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
258 
260  virtual Button* NewSpinDecrButton(X x, Y y, X w, Y h, const std::string& str,
261  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
263 
265  virtual Edit* NewSpinEdit(X x, Y y, X w, const std::string& str, const boost::shared_ptr<Font>& font,
266  Clr color, Clr text_color = CLR_BLACK, Clr interior = CLR_ZERO,
267  Flags<WndFlag> flags = INTERACTIVE) const;
268 
270  virtual StateButton* NewTabBarTab(X x, Y y, X w, Y h, const std::string& str,
271  const boost::shared_ptr<Font>& font, Flags<TextFormat> format, Clr color,
272  Clr text_color = CLR_BLACK, Clr interior = CLR_ZERO,
274 
276  virtual Button* NewTabBarLeftButton(X x, Y y, X w, Y h, const std::string& str,
277  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
278  Flags<WndFlag> flags = INTERACTIVE) const;
279 
281  virtual Button* NewTabBarRightButton(X x, Y y, X w, Y h, const std::string& str,
282  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
283  Flags<WndFlag> flags = INTERACTIVE) const;
285 
287 
288  virtual TabWnd* NewTabWnd(X x, Y y, X w, Y h, const boost::shared_ptr<Font>& font, Clr color,
289  Clr text_color = CLR_BLACK, TabBarStyle style = TAB_BAR_ATTACHED,
290  Flags<WndFlag> flags = INTERACTIVE | DRAGABLE) const;
292 
294 
295  virtual ColorDlg* NewColorDlg(X x, Y y, const boost::shared_ptr<Font>& font,
296  Clr dialog_color, Clr border_color, Clr text_color = CLR_BLACK) const;
297 
299  virtual ColorDlg* NewColorDlg(X x, Y y, Clr original_color, const boost::shared_ptr<Font>& font,
300  Clr dialog_color, Clr border_color, Clr text_color = CLR_BLACK) const;
301 
303  virtual FileDlg* NewFileDlg(const std::string& directory, const std::string& filename, bool save, bool multi,
304  const boost::shared_ptr<Font>& font, Clr color, Clr border_color,
305  Clr text_color = CLR_BLACK) const;
306 
308  virtual ThreeButtonDlg* NewThreeButtonDlg(X x, Y y, X w, Y h, const std::string& msg,
309  const boost::shared_ptr<Font>& font, Clr color, Clr border_color,
310  Clr button_color, Clr text_color, int buttons, const std::string& zero = "",
311  const std::string& one = "", const std::string& two = "") const;
312 
315  virtual ThreeButtonDlg* NewThreeButtonDlg(X w, Y h, const std::string& msg, const boost::shared_ptr<Font>& font,
316  Clr color, Clr border_color, Clr button_color, Clr text_color, int buttons,
317  const std::string& zero = "", const std::string& one = "",
318  const std::string& two = "") const;
320 
323  virtual void DeleteWnd(Wnd* wnd) const;
324 
326  static const std::string& DefaultFontName();
327 };
328 
329 } // namespace GG
330 
331 #endif