Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

windowing.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           paradialog.h  -  description
00003                              -------------------
00004     begin                : Thu Feb 21 2002
00005     copyright            : (C) 2002 by Martin Bickel
00006     email                : bickel@asc-hq.org
00007  ***************************************************************************/
00008 
00013 /***************************************************************************
00014  *                                                                         *
00015  *   This program is free software; you can redistribute it and/or modify  *
00016  *   it under the terms of the GNU General Public License as published by  *
00017  *   the Free Software Foundation; either version 2 of the License, or     *
00018  *   (at your option) any later version.                                   *
00019  *                                                                         *
00020  ***************************************************************************/
00021 
00022 #ifndef windowingH
00023 #define windowingH
00024 
00025 #include "global.h"
00026 
00027 #include <sigc++/sigc++.h>
00028 
00029 #include "libs/loki/SmartPtr.h"
00030 
00031 #include "paradialog.h"
00032 #include "widgets/bargraphwidget.h"
00033 
00034 class ASCGUI_Window : public  PG_Window {
00035       ASCString panelName;
00036       void destruct();
00037    protected:
00038       bool setup();
00039 
00040       class WidgetParameters
00041       {
00042          public:
00043             WidgetParameters();
00044             ASCString backgroundImage;
00045             PG_Draw::BkMode backgroundMode;
00046             
00047             PG_Label::TextAlign textAlign;
00048             bool textAlign_defined;
00049             
00050             int fontColor;
00051             bool fontColor_defined;
00052             
00053             ASCString fontName;
00054             ASCString style;
00055             int fontAlpha;
00056             bool fontAlpha_defined;
00057             
00058             int fontSize;
00059             bool fontSize_defined;
00060             
00061             int backgroundColor;
00062             bool backgroundColor_defined;
00063             
00064             int transparency;
00065             bool transparency_defined;
00066 
00067             int bordersize;
00068             bool bordersize_defined;
00069             bool hidden;
00070 
00071             void assign( PG_Widget* widget );
00072             void assign( BarGraphWidget* widget );
00073             void assign( PG_ThemeWidget* widget );
00074             void assign( PG_Label* widget );
00075             void runTextIO ( PropertyReadingContainer& pc );
00076       };
00077 
00078       virtual WidgetParameters getDefaultWidgetParams() = 0;
00079 
00080       typedef deallocating_map<ASCString, TextPropertyGroup*> GuiCache;
00081       static GuiCache guiCache;
00082       
00083       TextPropertyGroup* textPropertyGroup;
00084    public:
00085       void setLabelText ( const ASCString& widgetName, const ASCString& text, PG_Widget* parent = NULL );
00086       void setLabelText ( const ASCString& widgetName, int i, PG_Widget* parent = NULL );
00087       void setLabelColor ( const ASCString& widgetName, PG_Color color, PG_Widget* parent = NULL );
00088       void setImage ( const ASCString& widgetName, Surface& image, PG_Widget* parent = NULL );
00089       void setImage ( const ASCString& widgetName, SDL_Surface* image = NULL, PG_Widget* parent = NULL );
00090       void setImage ( const ASCString& widgetName, const ASCString& filename, PG_Widget* parent = NULL );
00091       void hide( const ASCString& widgetName, PG_Widget* parent = NULL );
00092       void show( const ASCString& widgetName, PG_Widget* parent = NULL );
00093       void setBargraphValue( const ASCString& widgetName, float fraction, PG_Widget* parent = NULL );
00094       void setBarGraphColor( const ASCString& widgetName, PG_Color color, PG_Widget* parent = NULL );
00095       void rename( const ASCString& widgetName, const ASCString& newname, PG_Widget* parent = NULL );
00096       void setWidgetTransparency ( const ASCString& widgetName, int transparency, PG_Widget* parent = NULL );
00097       
00098       int RunModal();
00099    protected:
00100 
00101       virtual void userHandler( const ASCString& label, PropertyReadingContainer& pc, PG_Widget* parent, WidgetParameters widgetParams ) {}; 
00102 
00103       static PG_Rect parseRect ( PropertyReadingContainer& pc, PG_Widget* parent );
00104       void parsePanelASCTXT ( PropertyReadingContainer& pc, PG_Widget* parent, WidgetParameters widgetParams );
00105 
00106       ASCGUI_Window ( PG_Widget *parent, const PG_Rect &r, const ASCString& panelName_, const ASCString& baseStyle = "Panel", bool loadTheme = true );
00107       // FIXME Close button does not delete Panel
00108       ~ASCGUI_Window();
00109 };
00110 
00111 
00112 class Panel : public ASCGUI_Window {
00113    protected:
00114       WidgetParameters getDefaultWidgetParams();
00115    public:
00116       Panel ( PG_Widget *parent, const PG_Rect &r, const ASCString& panelName_, bool loadTheme = true );
00117 };
00118 
00119 
00121 class LayoutablePanel: public Panel {
00122    private:
00123       ASCString name;
00124       static PG_Rect PositionCalculator( const PG_Rect& r, const ASCString& panelName );
00125       static const int DashBoardWidth = 170;
00126    protected:
00127       void eventMoveWidget (int x, int y);
00128       void eventHide();
00129       void eventShow();
00130    public:
00131       LayoutablePanel ( PG_Widget *parent, const PG_Rect &r, const ASCString& panelName_, bool loadTheme = true );
00132    
00133 };
00134 
00135 class ConfigurableWindow : public ASCGUI_Window {
00136    protected:
00137       WidgetParameters getDefaultWidgetParams();
00138    public:
00139       ConfigurableWindow ( PG_Widget *parent, const PG_Rect &r, const ASCString& panelName_, bool loadTheme = true );
00140 };
00141 
00142 
00143 #endif

Generated on Tue Jun 24 01:27:56 2008 for Advanced Strategic Command by  doxygen 1.4.2