/usr/include/paragui/pgthemewidget.h is in libparagui1.1-dev 1.1.8-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | /*
ParaGUI - crossplatform widgetset
Copyright (C) 2000,2001,2002 Alexander Pipelka
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Alexander Pipelka
pipelka@teleweb.at
Last Update: $Author: braindead $
Update Date: $Date: 2004/09/05 10:51:41 $
Source File: $Source: /cvsroot/paragui/paragui/include/pgthemewidget.h,v $
CVS/RCS Revision: $Revision: 1.3.6.4.2.11 $
Status: $State: Exp $
*/
#ifndef PG_THEMEWIDGET_H
#define PG_THEMEWIDGET_H
#include "pgwidget.h"
#include "pgdraw.h"
class PG_ThemeWidgetDataInternal;
/**
@author Alexander Pipelka
@short Base class for themed widgets
This class is the base class for all themed widgets.<br>
It handles various combinations of gradients and background images.
\anchor theme_PG_ThemeWidget
<h2>Theme support</h2><p>
<b>widget type:</b> ThemeWidget (default)<br>
<b>object name:</b> ThemeWidget<br>
<h3>Parent theme:</h3>
\ref theme_PG_Widget "PG_Widget" theme<br>
<h3>Theme sample:</h3>
\verbatim
<widget>
<type value="ThemeWidget"/>
<object>
<name value="ThemeWidget"/>
<filename name="background" value="default/back.bmp"/>
<property name="backmode" value="TILE"/>
<gradient name="gradient"
color0="0x00B0B1B6"
color1="0x0083838D"
color2="0x007B7B83"
color3="0x00585765"/>
<property name="blend" value="200"/>
<property name="transparency" value="0"/>
<property name="bordersize" value="1"/>
</object>
</widget>
\endverbatim
<p>
<h2>Code:</h2><p>
*/
class DECLSPEC PG_ThemeWidget : public PG_Widget {
public:
/**
Create a new PG_ThemeWidget object
@param parent Pointer to parent widget
@param r Position of the widget (related to parent or screen)
@param style Widgetstyle to load. This style should be defined at your theme file (default = "ThemeWidget")
This constructor creates a themed widget without any drawing surface.
All drawing operations can be done via the eventBlit() callback handler.
*/
PG_ThemeWidget(PG_Widget* parent, const PG_Rect& r = PG_Rect::null, const char* style="ThemeWidget");
/**
Create a new PG_ThemeWidget object
@param parent Pointer to parent widget
@param r Position of the widget (related to parent or screen)
@param bCreateSurface true - create a drawing surface for the widget.
@param style Widgetstyle to load. This style should be defined at your theme file (default = "ThemeWidget")
This constructor creates a themed widget with an internal drawing surface.
All drawing operations can be done via the eventDraw() callback handler.
Additional blitting can be done via the eventBlit() callback. eventBlit() will NOT draw onto the
internal drawing surface. Blitting will be done on the screen surface.
*/
PG_ThemeWidget(PG_Widget* parent, const PG_Rect& r, bool bCreateSurface, const char* style="ThemeWidget");
/**
*/
~PG_ThemeWidget();
/**
Load a specific themestyle
@param widgettype name of widget type to load
*/
void LoadThemeStyle(const char* widgettype);
void LoadThemeStyle(const char* widgettype, const char* objectname);
/**
Load the background image from a file
@param filename path to background image file
@param mode BKMODE_TILE | BKMODE_STRETCH | BKMODE_3TILEH | BKMODE_3TILEV | BKMODE_9TILE
*/
/** */
bool SetBackground(const char* filename, int mode=BKMODE_TILE);
/**
Load the background image from a file and set the colorkey
@param filename path to background image file
@param colorkey colorkey
@param mode BKMODE_TILE | BKMODE_STRETCH | BKMODE_3TILEH | BKMODE_3TILEV | BKMODE_9TILE
*/
/** */
bool SetBackground(const char* filename, int mode, const PG_Color& colorkey);
/**
Define a surface as background image (will not be freed)
@param surface pointer to background surface
@param mode BKMODE_TILE | BKMODE_STRETCH | BKMODE_3TILEH | BKMODE_3TILEV | BKMODE_9TILE
@return true on success
*/
bool SetBackground(SDL_Surface* surface, int mode=BKMODE_TILE);
/**
Defines the "blend-level" of gradient & background
@param backblend 0 - background image fully visible / 255 - gradient fully visible
*/
void SetBackgroundBlend(Uint8 backblend);
/**
Set the background gradient
@param grad a PG_Gradient structure describing the gradient
*/
void SetGradient(PG_Gradient& grad);
/**
Get the background gradient
@return the background gradient
*/
PG_Gradient GetGradient();
/**
Set the bordersize of the widget
@param b bordersize in pixels (currently 0,1,2)
*/
void SetBorderSize(int b);
/**
Get the bordersize of the widget
@return bordersize in pixels
*/
int GetBorderSize();
/**
Display an image in the widget
@param filename name of the image file to load
@return true on success
With this function you can define an image to be displayed at the upper left corner
of the widget. Image data will be erased when deleting the widget or loading / setting
a new image.
*/
bool LoadImage(const char* filename);
/**
Display an image in the widget using a colorkey
@param filename name of the image file to load
@param key the colorkey (0xRRGGBB)
@return true on success
With this function you can define an image with a colorkey to be displayed at the upper left corner
of the widget. Image data will be erased when deleting the widget or loading / setting
a new image.
*/
bool LoadImage(const char* filename, Uint32 key);
/**
Display an image in the widget
@param image pointer to surface to display
@param bFreeImage true if the image should be freed by the widget (default = true)
@return true on success
With this function you can define an image to be displayed at the upper left corner
of the widget.
*/
bool SetImage(SDL_Surface* image, bool bFreeImage = true);
/**
Set the fransparency of the widget
@param t transparency value (0 - opaque / 255 - fully transparent)
@param bRecursive if child widget's transparency should be set the same as widget
*/
void SetTransparency(Uint8 t, bool bRecursive = false);
/**
Create a 'themed' surface
@param r the dimensions of the surface to create
@param gradient pointer to a gradient structure (may be NULL)
@param background pointer to a background surface (may be NULL)
@param bkmode the mode how to fill in the background surface (BKMODE_TILE | BKMODE_STRETCH | BKMODE_3TILEH | BKMODE_3TILEV | BKMODE_9TILE)
@param blend the blend-level between gradient an background
@return the newly created surface
The generated surface is managed by the surfacecache. Don't delete these surface with SDL_FreeSurface. Please use DeleteThemedSurface.
*/
static SDL_Surface* CreateThemedSurface(const PG_Rect& r, PG_Gradient* gradient, SDL_Surface* background, int bkmode, Uint8 blend);
/**
Delete a themed surface
@param surface pointer to surface
*/
static void DeleteThemedSurface(SDL_Surface* surface);
void SetSimpleBackground(bool simple);
void SetBackgroundColor(const PG_Color& c);
protected:
/** */
void eventSizeWidget(Uint16 w, Uint16 h);
/** */
void eventDraw(SDL_Surface* surface, const PG_Rect& rect);
/** */
void eventBlit(SDL_Surface* surface, const PG_Rect& src, const PG_Rect& dst);
bool my_has_gradient;
PG_Gradient my_gradient;
SDL_Surface* my_background;
SDL_Surface* my_image;
Uint8 my_blendLevel;
bool my_backgroundFree;
int my_backgroundMode;
int my_bordersize;
private:
PG_ThemeWidget(const PG_ThemeWidget&);
PG_ThemeWidget& operator=(const PG_ThemeWidget&);
void Init(const char* style);
void CreateSurface(Uint16 w = 0, Uint16 h = 0);
/**
This function frees background surface if possible
*/
void FreeSurface();
void FreeImage();
// this is a bit rude but neccessary for future binary compatibility
// because adding non-static data members would break the ABI.
// For this we put all private data into a dynamically created struct.
PG_ThemeWidgetDataInternal* _mid;
};
#endif // PG_THEMEWIDGET_H
|