GG

StyleFactory.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /* GG is a GUI for SDL and OpenGL.
00003    Copyright (C) 2003-2008 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@gmail.com */
00025 
00029 #ifndef _GG_StyleFactory_h_
00030 #define _GG_StyleFactory_h_
00031 
00032 #include  <GG/ClrConstants.h>
00033 #include  <GG/DynamicGraphic.h>
00034 #include  <GG/FontFwd.h>
00035 #include  <GG/MultiEditFwd.h>
00036 
00037 
00038 namespace GG {
00039 
00040 class Button;
00041 class ColorDlg;
00042 class DropDownList;
00043 class DynamicGraphic;
00044 class FileDlg;
00045 class Edit;
00046 class Font;
00047 class GroupBox;
00048 class ListBox;
00049 class MenuBar;
00050 class MultiEdit;
00051 class RadioButtonGroup;
00052 class Scroll;
00053 class Slider;
00054 template <class T>
00055 class Spin;
00056 class StateButton;
00057 class StaticGraphic;
00058 class TabBar;
00059 class TabWnd;
00060 class TextControl;
00061 class Texture;
00062 class ThreeButtonDlg;
00063 struct UnicodeCharset;
00064 
00079 class GG_API StyleFactory
00080 {
00081 public: 
00083     StyleFactory(); 
00084     virtual ~StyleFactory(); 
00085 
00086 
00089     virtual boost::shared_ptr<Font> DefaultFont(unsigned int pts = 12) const;
00090 
00094     virtual boost::shared_ptr<Font> DefaultFont(unsigned int pts,
00095                                                 const UnicodeCharset* first,
00096                                                 const UnicodeCharset* last) const;
00097  
00099 
00100     virtual Button*            NewButton(X x, Y y, X w, Y h, const std::string& str,
00101                                          const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00102                                          Flags<WndFlag> flags = INTERACTIVE) const;
00103 
00105     virtual StateButton*       NewStateButton(X x, Y y, X w, Y h, const std::string& str,
00106                                               const boost::shared_ptr<Font>& font, Flags<TextFormat> format, Clr color,
00107                                               Clr text_color = CLR_BLACK, Clr interior = CLR_ZERO,
00108                                               StateButtonStyle style = SBSTYLE_3D_XBOX, Flags<WndFlag> flags = INTERACTIVE) const;
00109 
00111     virtual RadioButtonGroup*  NewRadioButtonGroup(X x, Y y, X w, Y h, Orientation orientation) const;
00112 
00114     virtual DropDownList*      NewDropDownList(X x, Y y, X w, Y h, Y drop_ht, Clr color,
00115                                                Flags<WndFlag> flags = INTERACTIVE) const;
00116 
00118     virtual DynamicGraphic*    NewDynamicGraphic(X x, Y y, X w, Y h, bool loop, X frame_width, Y frame_height,
00119                                                  int margin, const std::vector<boost::shared_ptr<Texture> >& textures,
00120                                                  Flags<GraphicStyle> style = GRAPHIC_NONE, int frames = DynamicGraphic::ALL_FRAMES,
00121                                                  Flags<WndFlag> flags = Flags<WndFlag>()) const;
00122 
00124     virtual Edit*              NewEdit(X x, Y y, X w, const std::string& str, const boost::shared_ptr<Font>& font,
00125                                        Clr color, Clr text_color = CLR_BLACK, Clr interior = CLR_ZERO,
00126                                        Flags<WndFlag> flags = INTERACTIVE) const;
00127 
00129     virtual ListBox*           NewListBox(X x, Y y, X w, Y h, Clr color, Clr interior = CLR_ZERO,
00130                                           Flags<WndFlag> flags = INTERACTIVE) const;
00131 
00133     virtual MenuBar*           NewMenuBar(X x, Y y, X w, const boost::shared_ptr<Font>& font,
00134                                           Clr text_color = CLR_WHITE, Clr color = CLR_BLACK,
00135                                           Clr interior = CLR_SHADOW) const;
00136 
00138     virtual MultiEdit*         NewMultiEdit(X x, Y y, X w, Y h, const std::string& str,
00139                                             const boost::shared_ptr<Font>& font, Clr color, Flags<MultiEditStyle> style = MULTI_LINEWRAP,
00140                                             Clr text_color = CLR_BLACK, Clr interior = CLR_ZERO,
00141                                             Flags<WndFlag> flags = INTERACTIVE) const;
00142 
00144     virtual Scroll*            NewScroll(X x, Y y, X w, Y h, Orientation orientation, Clr color, Clr interior,
00145                                          Flags<WndFlag> flags = INTERACTIVE | REPEAT_BUTTON_DOWN) const;
00146 
00148     virtual Slider*            NewSlider(X x, Y y, X w, Y h, int min, int max, Orientation orientation,
00149                                          SliderLineStyle style, Clr color, int tab_width, int line_width = 5,
00150                                          Flags<WndFlag> flags = INTERACTIVE) const;
00151 
00153     virtual Spin<int>*         NewIntSpin(X x, Y y, X w, int value, int step, int min, int max, bool edits,
00154                                           const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00155                                           Clr interior = CLR_ZERO, Flags<WndFlag> flags = INTERACTIVE) const;
00156 
00158     virtual Spin<double>*      NewDoubleSpin(X x, Y y, X w, double value, double step, double min, double max, bool edits,
00159                                              const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00160                                              Clr interior = CLR_ZERO, Flags<WndFlag> flags = INTERACTIVE) const;
00161 
00163     virtual StaticGraphic*     NewStaticGraphic(X x, Y y, X w, Y h, const boost::shared_ptr<Texture>& texture,
00164                                                 Flags<GraphicStyle> style = GRAPHIC_NONE, Flags<WndFlag> flags = Flags<WndFlag>()) const;
00165 
00167     virtual TabBar*            NewTabBar(X x, Y y, X w, const boost::shared_ptr<Font>& font, Clr color,
00168                                          Clr text_color = CLR_BLACK, TabBarStyle style = TAB_BAR_ATTACHED,
00169                                          Flags<WndFlag> flags = INTERACTIVE) const;
00170 
00172     virtual TextControl*       NewTextControl(X x, Y y, X w, Y h, const std::string& str,
00173                                               const boost::shared_ptr<Font>& font, Clr color = CLR_BLACK,
00174                                               Flags<TextFormat> format = FORMAT_NONE, Flags<WndFlag> flags = Flags<WndFlag>()) const;
00175 
00177     virtual TextControl*       NewTextControl(X x, Y y, const std::string& str, const boost::shared_ptr<Font>& font,
00178                                               Clr color = CLR_BLACK, Flags<TextFormat> format = FORMAT_NONE,
00179                                               Flags<WndFlag> flags = Flags<WndFlag>()) const;
00180 
00182     virtual GroupBox*          NewGroupBox(X x, Y y, X w, Y h, const std::string& label, const boost::shared_ptr<Font>& font,
00183                                            Clr color, Clr text_color = CLR_BLACK, Clr interior = CLR_ZERO,
00184                                            Flags<WndFlag> flags = Flags<WndFlag>()) const;
00186  
00188 
00189     virtual ListBox*           NewDropDownListListBox(X x, Y y, X w, Y h, Clr color, Clr interior = CLR_ZERO,
00190                                                       Flags<WndFlag> flags = INTERACTIVE) const;
00191 
00193     virtual Scroll*            NewListBoxVScroll(X x, Y y, X w, Y h, Clr color, Clr interior,
00194                                                  Flags<WndFlag> flags = INTERACTIVE | REPEAT_BUTTON_DOWN) const;
00195 
00197     virtual Scroll*            NewListBoxHScroll(X x, Y y, X w, Y h, Clr color, Clr interior,
00198                                                  Flags<WndFlag> flags = INTERACTIVE | REPEAT_BUTTON_DOWN) const;
00199 
00201     virtual Scroll*            NewMultiEditVScroll(X x, Y y, X w, Y h, Clr color, Clr interior,
00202                                                    Flags<WndFlag> flags = INTERACTIVE | REPEAT_BUTTON_DOWN) const;
00203 
00205     virtual Scroll*            NewMultiEditHScroll(X x, Y y, X w, Y h, Clr color, Clr interior,
00206                                                    Flags<WndFlag> flags = INTERACTIVE | REPEAT_BUTTON_DOWN) const;
00207 
00209     virtual Button*            NewScrollUpButton(X x, Y y, X w, Y h, const std::string& str,
00210                                                  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00211                                                  Flags<WndFlag> flags = INTERACTIVE | REPEAT_BUTTON_DOWN) const;
00212 
00214     virtual Button*            NewScrollDownButton(X x, Y y, X w, Y h, const std::string& str,
00215                                                    const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00216                                                    Flags<WndFlag> flags = INTERACTIVE | REPEAT_BUTTON_DOWN) const;
00217 
00219     virtual Button*            NewVScrollTabButton(X x, Y y, X w, Y h, const std::string& str,
00220                                                    const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00221                                                    Flags<WndFlag> flags = INTERACTIVE) const;
00222 
00224     virtual Button*            NewScrollLeftButton(X x, Y y, X w, Y h, const std::string& str,
00225                                                    const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00226                                                    Flags<WndFlag> flags = INTERACTIVE | REPEAT_BUTTON_DOWN) const;
00227 
00229     virtual Button*            NewScrollRightButton(X x, Y y, X w, Y h, const std::string& str,
00230                                                     const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00231                                                     Flags<WndFlag> flags = INTERACTIVE | REPEAT_BUTTON_DOWN) const;
00232 
00234     virtual Button*            NewHScrollTabButton(X x, Y y, X w, Y h, const std::string& str,
00235                                                    const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00236                                                    Flags<WndFlag> flags = INTERACTIVE) const;
00237 
00239     virtual Button*            NewVSliderTabButton(X x, Y y, X w, Y h, const std::string& str,
00240                                                    const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00241                                                    Flags<WndFlag> flags = INTERACTIVE) const;
00242 
00244     virtual Button*            NewHSliderTabButton(X x, Y y, X w, Y h, const std::string& str,
00245                                                    const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00246                                                    Flags<WndFlag> flags = INTERACTIVE) const;
00247 
00249     virtual Button*            NewSpinIncrButton(X x, Y y, X w, Y h, const std::string& str,
00250                                                  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00251                                                  Flags<WndFlag> flags = INTERACTIVE | REPEAT_BUTTON_DOWN) const;
00252 
00254     virtual Button*            NewSpinDecrButton(X x, Y y, X w, Y h, const std::string& str,
00255                                                  const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00256                                                  Flags<WndFlag> flags = INTERACTIVE | REPEAT_BUTTON_DOWN) const;
00257 
00259     virtual Edit*              NewSpinEdit(X x, Y y, X w, const std::string& str, const boost::shared_ptr<Font>& font,
00260                                            Clr color, Clr text_color = CLR_BLACK, Clr interior = CLR_ZERO,
00261                                            Flags<WndFlag> flags = INTERACTIVE) const;
00262 
00264     virtual StateButton*       NewTabBarTab(X x, Y y, X w, Y h, const std::string& str,
00265                                             const boost::shared_ptr<Font>& font, Flags<TextFormat> format, Clr color,
00266                                             Clr text_color = CLR_BLACK, Clr interior = CLR_ZERO,
00267                                             StateButtonStyle style = SBSTYLE_3D_TOP_ATTACHED_TAB, Flags<WndFlag> flags = INTERACTIVE) const;
00268 
00270     virtual Button*            NewTabBarLeftButton(X x, Y y, X w, Y h, const std::string& str,
00271                                                    const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00272                                                    Flags<WndFlag> flags = INTERACTIVE) const;
00273 
00275     virtual Button*            NewTabBarRightButton(X x, Y y, X w, Y h, const std::string& str,
00276                                                     const boost::shared_ptr<Font>& font, Clr color, Clr text_color = CLR_BLACK,
00277                                                     Flags<WndFlag> flags = INTERACTIVE) const;
00279  
00281 
00282     virtual TabWnd*            NewTabWnd(X x, Y y, X w, Y h, const boost::shared_ptr<Font>& font, Clr color,
00283                                          Clr text_color = CLR_BLACK, TabBarStyle style = TAB_BAR_ATTACHED,
00284                                          Flags<WndFlag> flags = INTERACTIVE | DRAGABLE) const;
00286  
00288 
00289     virtual ColorDlg*          NewColorDlg(X x, Y y, const boost::shared_ptr<Font>& font,
00290                                            Clr dialog_color, Clr border_color, Clr text_color = CLR_BLACK) const;
00291 
00293     virtual ColorDlg*          NewColorDlg(X x, Y y, Clr original_color, const boost::shared_ptr<Font>& font,
00294                                            Clr dialog_color, Clr border_color, Clr text_color = CLR_BLACK) const;
00295 
00297     virtual FileDlg*           NewFileDlg(const std::string& directory, const std::string& filename, bool save, bool multi,
00298                                           const boost::shared_ptr<Font>& font, Clr color, Clr border_color,
00299                                           Clr text_color = CLR_BLACK) const;
00300 
00302     virtual ThreeButtonDlg*    NewThreeButtonDlg(X x, Y y, X w, Y h, const std::string& msg,
00303                                                  const boost::shared_ptr<Font>& font, Clr color, Clr border_color,
00304                                                  Clr button_color, Clr text_color, int buttons, const std::string& zero = "",
00305                                                  const std::string& one = "", const std::string& two = "") const;
00306 
00309     virtual ThreeButtonDlg*    NewThreeButtonDlg(X w, Y h, const std::string& msg, const boost::shared_ptr<Font>& font,
00310                                                  Clr color, Clr border_color, Clr button_color, Clr text_color, int buttons,
00311                                                  const std::string& zero = "", const std::string& one = "",
00312                                                  const std::string& two = "") const;
00314 
00317     virtual void               DeleteWnd(Wnd* wnd) const;
00318 
00320     static const std::string&  DefaultFontName();
00321 
00322     template <class Archive>
00323     void serialize(Archive& ar, const unsigned int version) {}
00324 };
00325 
00326 } // namespace GG
00327 
00328 #endif // _GG_StyleFactory_h_