Advanced Strategic Command
windowing.h
Go to the documentation of this file.
1 /***************************************************************************
2  paradialog.h - description
3  -------------------
4  begin : Thu Feb 21 2002
5  copyright : (C) 2002 by Martin Bickel
6  email : bickel@asc-hq.org
7  ***************************************************************************/
8 
13 /***************************************************************************
14  * *
15  * This program is free software; you can redistribute it and/or modify *
16  * it under the terms of the GNU General Public License as published by *
17  * the Free Software Foundation; either version 2 of the License, or *
18  * (at your option) any later version. *
19  * *
20  ***************************************************************************/
21 
22 #ifndef windowingH
23 #define windowingH
24 
25 #include "global.h"
26 
27 #include <sigc++/sigc++.h>
28 
29 #include "loki/SmartPtr.h"
30 
31 #include "paradialog.h"
32 #include "widgets/bargraphwidget.h"
33 
34 class ASCGUI_Window : public PG_Window {
35  ASCString panelName;
36  void destruct();
37  protected:
38  bool setup();
39 
41  {
42  public:
45  PG_Draw::BkMode backgroundMode;
46 
47  PG_Label::TextAlign textAlign;
49 
50  int fontColor;
52 
55  int fontAlpha;
57 
58  int fontSize;
60 
63 
66 
69  bool hidden;
70 
71  void assign( PG_Widget* widget );
72  void assign( BarGraphWidget* widget );
73  void assign( PG_ThemeWidget* widget );
74  void assign( PG_Label* widget );
76  };
77 
79 
82 
84  public:
85  void setLabelText ( const ASCString& widgetName, const ASCString& text, PG_Widget* parent = NULL );
86  void setLabelText ( const ASCString& widgetName, int i, PG_Widget* parent = NULL );
87  void setLabelColor ( const ASCString& widgetName, PG_Color color, PG_Widget* parent = NULL );
88  void setImage ( const ASCString& widgetName, Surface& image, PG_Widget* parent = NULL );
89  void setImage ( const ASCString& widgetName, SDL_Surface* image = NULL, PG_Widget* parent = NULL );
90  void setImage ( const ASCString& widgetName, const ASCString& filename, PG_Widget* parent = NULL );
91  void hide( const ASCString& widgetName, PG_Widget* parent = NULL );
92  void show( const ASCString& widgetName, PG_Widget* parent = NULL );
93  void setBargraphValue( const ASCString& widgetName, float fraction, PG_Widget* parent = NULL );
94  void setBarGraphColor( const ASCString& widgetName, PG_Color color, PG_Widget* parent = NULL );
95  void rename( const ASCString& widgetName, const ASCString& newname, PG_Widget* parent = NULL );
96  void setWidgetTransparency ( const ASCString& widgetName, int transparency, PG_Widget* parent = NULL );
97 
98  int RunModal();
99  protected:
100 
101  virtual void userHandler( const ASCString& label, PropertyReadingContainer& pc, PG_Widget* parent, WidgetParameters widgetParams ) {};
102 
103  static PG_Rect parseRect ( PropertyReadingContainer& pc, PG_Widget* parent );
104  void parsePanelASCTXT ( PropertyReadingContainer& pc, PG_Widget* parent, WidgetParameters widgetParams );
105 
106  ASCGUI_Window ( PG_Widget *parent, const PG_Rect &r, const ASCString& panelName_, const ASCString& baseStyle = "Panel", bool loadTheme = true );
107  // FIXME Close button does not delete Panel
108  ~ASCGUI_Window();
109 };
110 
111 
112 class Panel : public ASCGUI_Window {
113  protected:
115  public:
116  Panel ( PG_Widget *parent, const PG_Rect &r, const ASCString& panelName_, bool loadTheme = true );
117 };
118 
119 
121 class LayoutablePanel: public Panel {
122  private:
123  ASCString name;
124  static PG_Rect PositionCalculator( const PG_Rect& r, const ASCString& panelName );
125  static const int DashBoardWidth = 170;
126  protected:
127  void eventMoveWidget (int x, int y);
128  void eventHide();
129  void eventShow();
130  public:
131  LayoutablePanel ( PG_Widget *parent, const PG_Rect &r, const ASCString& panelName_, bool loadTheme = true );
132 
133 };
134 
136  protected:
138  public:
139  ConfigurableWindow ( PG_Widget *parent, const PG_Rect &r, const ASCString& panelName_, bool loadTheme = true );
140 };
141 
142 
143 #endif
TextPropertyGroup * textPropertyGroup
Definition: windowing.h:83
void setImage(const ASCString &widgetName, Surface &image, PG_Widget *parent=NULL)
Definition: windowing.cpp:739
virtual WidgetParameters getDefaultWidgetParams()=0
ASCGUI_Window(PG_Widget *parent, const PG_Rect &r, const ASCString &panelName_, const ASCString &baseStyle="Panel", bool loadTheme=true)
Definition: windowing.cpp:312
deallocating_map< ASCString, TextPropertyGroup * > GuiCache
Definition: windowing.h:80
void eventMoveWidget(int x, int y)
Definition: windowing.cpp:1003
Global platform dependant definitions. This file just branches to the platform specific files in thei...
static GuiCache guiCache
Definition: windowing.h:81
WidgetParameters getDefaultWidgetParams()
Definition: windowing.cpp:1052
LayoutablePanel(PG_Widget *parent, const PG_Rect &r, const ASCString &panelName_, bool loadTheme=true)
Definition: windowing.cpp:979
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
void setWidgetTransparency(const ASCString &widgetName, int transparency, PG_Widget *parent=NULL)
Definition: windowing.cpp:757
void parsePanelASCTXT(PropertyReadingContainer &pc, PG_Widget *parent, WidgetParameters widgetParams)
Definition: windowing.cpp:370
virtual void userHandler(const ASCString &label, PropertyReadingContainer &pc, PG_Widget *parent, WidgetParameters widgetParams)
Definition: windowing.h:101
void setBarGraphColor(const ASCString &widgetName, PG_Color color, PG_Widget *parent=NULL)
Definition: windowing.cpp:801
void assign(PG_Widget *widget)
Definition: windowing.cpp:284
PG_Draw::BkMode backgroundMode
Definition: windowing.h:45
Dialog classes based on the Paragui library.
void setBargraphValue(const ASCString &widgetName, float fraction, PG_Widget *parent=NULL)
Definition: windowing.cpp:790
ConfigurableWindow(PG_Widget *parent, const PG_Rect &r, const ASCString &panelName_, bool loadTheme=true)
Definition: windowing.cpp:1043
void show(const ASCString &widgetName, PG_Widget *parent=NULL)
Definition: windowing.cpp:778
PG_Label::TextAlign textAlign
Definition: windowing.h:47
void rename(const ASCString &widgetName, const ASCString &newname, PG_Widget *parent=NULL)
Definition: windowing.cpp:675
static PG_Rect parseRect(PropertyReadingContainer &pc, PG_Widget *parent)
Definition: windowing.cpp:319
Class that stores all the (preparsed) entries of an .ASCTXT file.
void runTextIO(PropertyReadingContainer &pc)
Definition: windowing.cpp:166
void setLabelColor(const ASCString &widgetName, PG_Color color, PG_Widget *parent=NULL)
Definition: windowing.cpp:710
Panel(PG_Widget *parent, const PG_Rect &r, const ASCString &panelName_, bool loadTheme=true)
Definition: windowing.cpp:948
void hide(const ASCString &widgetName, PG_Widget *parent=NULL)
Definition: windowing.cpp:768
this Panel saves its position in the gameoptions and loads it on construction
Definition: windowing.h:121
a map that stores pointers as values and deletes the pointed-to objects on destruction ...
Definition: typen.h:324
void setLabelText(const ASCString &widgetName, const ASCString &text, PG_Widget *parent=NULL)
Definition: windowing.cpp:685
WidgetParameters getDefaultWidgetParams()
Definition: windowing.cpp:957