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

pgthemewidget.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000,2001,2002  Alexander Pipelka
00004  
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 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     Library General Public License for more details.
00014  
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: mbickel $
00023     Update Date:      $Date: 2007-04-13 16:15:57 $
00024     Source File:      $Source: /home/cvspsrv/cvsroot/games/asc/source/libs/paragui/include/pgthemewidget.h,v $
00025     CVS/RCS Revision: $Revision: 1.2 $
00026     Status:           $State: Exp $
00027 */
00028 
00033 #ifndef PG_THEMEWIDGET_H
00034 #define PG_THEMEWIDGET_H
00035 
00036 #include "pgwidget.h"
00037 #include "pgdraw.h"
00038 
00039 class PG_ThemeWidgetDataInternal;
00040 
00084 class DECLSPEC PG_ThemeWidget : public PG_Widget  {
00085 public:
00086 
00095         PG_ThemeWidget(PG_Widget* parent, const PG_Rect& r = PG_Rect::null, const std::string& style="ThemeWidget");
00096 
00108         PG_ThemeWidget(PG_Widget* parent, const PG_Rect& r, bool bCreateSurface, const std::string& style="ThemeWidget");
00109 
00112         ~PG_ThemeWidget();
00113 
00118         void LoadThemeStyle(const std::string& widgettype);
00119 
00120         void LoadThemeStyle(const std::string& widgettype, const std::string& objectname);
00121 
00128         bool SetBackground(const std::string& filename, PG_Draw::BkMode mode=PG_Draw::TILE);
00129 
00137         bool SetBackground(const std::string& filename, PG_Draw::BkMode mode, const PG_Color& colorkey);
00138 
00145         bool SetBackground(SDL_Surface* surface, PG_Draw::BkMode mode=PG_Draw::TILE);
00146 
00151         void SetBackgroundBlend(Uint8 backblend);
00152 
00157         void SetGradient(const PG_Gradient& grad);
00158 
00163         PG_Gradient GetGradient();
00164 
00173         bool LoadImage(const std::string& filename);
00174 
00184         bool LoadImage(const std::string& filename, const PG_Color& key);
00185 
00194         bool SetImage(SDL_Surface* image, bool bFreeImage = true);
00195 
00201         void SetTransparency(Uint8 t, bool bRecursive = false);
00202 
00215         static SDL_Surface* CreateThemedSurface(const PG_Rect& r, PG_Gradient* gradient, SDL_Surface* background, PG_Draw::BkMode bkmode, Uint8 blend);
00216 
00221         static void DeleteThemedSurface(SDL_Surface* surface);
00222 
00223         void SetSimpleBackground(bool simple);
00224 
00225         void SetBackgroundColor(const PG_Color& c);
00226 
00227 protected:
00228 
00230         void eventSizeWidget(Uint16 w, Uint16 h);
00231 
00233         void eventDraw(SDL_Surface* surface, const PG_Rect& rect);
00234 
00236         void eventBlit(SDL_Surface* surface, const PG_Rect& src, const PG_Rect& dst);
00237 
00238 
00239         bool my_has_gradient;
00240 
00241         PG_Gradient my_gradient;
00242 
00243         SDL_Surface* my_background;
00244 
00245         SDL_Surface* my_image;
00246 
00247         Uint8 my_blendLevel;
00248 
00249         bool my_backgroundFree;
00250 
00251         PG_Draw::BkMode my_backgroundMode;
00252 
00253 private:
00254 
00255         PG_ThemeWidget(const PG_ThemeWidget&);
00256 
00257         PG_ThemeWidget& operator=(const PG_ThemeWidget&);
00258 
00259         DLLLOCAL void Init(const std::string& style);
00260 
00261         DLLLOCAL void CreateSurface(Uint16 w = 0, Uint16 h = 0);
00262 
00266         DLLLOCAL void FreeSurface();
00267 
00268         DLLLOCAL void FreeImage();
00269 
00270         // this is a bit rude but neccessary for future binary compatibility
00271         // because adding non-static data members would break the ABI.
00272         // For this we put all private data into a dynamically created struct.
00273         PG_ThemeWidgetDataInternal* _mid;
00274 };
00275 
00276 #endif // PG_THEMEWIDGET_H

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