summaryrefslogtreecommitdiff
path: root/noncore/styles
authorar <ar>2004-05-31 15:26:50 (UTC)
committer ar <ar>2004-05-31 15:26:50 (UTC)
commit27dfc34d411dee76f09f5e516c60b0a64eb35948 (patch) (unidiff)
treeb7f7259497630390e352a1257cac5dc59f5399a6 /noncore/styles
parent27b09fe4f930b96e82cea9fb0eb1a9b87f7ec062 (diff)
downloadopie-27dfc34d411dee76f09f5e516c60b0a64eb35948.zip
opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.gz
opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.bz2
- convert qWarning to owarn
Diffstat (limited to 'noncore/styles') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/theme/othemebase.h981
1 files changed, 493 insertions, 488 deletions
diff --git a/noncore/styles/theme/othemebase.h b/noncore/styles/theme/othemebase.h
index e691692..5519798 100644
--- a/noncore/styles/theme/othemebase.h
+++ b/noncore/styles/theme/othemebase.h
@@ -18,6 +18,11 @@
18#ifndef __OTHEMEBASE_H 18#ifndef __OTHEMEBASE_H
19#define __OTHEMEBASE_H 19#define __OTHEMEBASE_H
20 20
21/* OPIE */
22#include <opie2/odebug.h>
23using namespace Opie::Core;
24
25/* QT */
21#include <qdatetime.h> 26#include <qdatetime.h>
22#include <qtimer.h> 27#include <qtimer.h>
23#include <qwindowsstyle.h> 28#include <qwindowsstyle.h>
@@ -39,48 +44,48 @@
39class OThemePixmap : public QPixmap 44class OThemePixmap : public QPixmap
40{ 45{
41public: 46public:
42 enum BorderType{Top = 0, Bottom, Left, Right, TopLeft, TopRight, BottomLeft, 47 enum BorderType{Top = 0, Bottom, Left, Right, TopLeft, TopRight, BottomLeft,
43 BottomRight}; 48 BottomRight};
44 49
45 OThemePixmap( bool timer = true ); 50 OThemePixmap( bool timer = true );
46 OThemePixmap( const OThemePixmap &p ); 51 OThemePixmap( const OThemePixmap &p );
47 ~OThemePixmap(); 52 ~OThemePixmap();
48 QPixmap* border( BorderType type ); 53 QPixmap* border( BorderType type );
49 void setBorder( BorderType type, const QPixmap &p ); 54 void setBorder( BorderType type, const QPixmap &p );
50 void updateAccessed(); 55 void updateAccessed();
51 bool isOld(); 56 bool isOld();
52protected: 57protected:
53 QTime *t; 58 QTime *t;
54 QPixmap *b[ 8 ]; 59 QPixmap *b[ 8 ];
55 60
56private: 61private:
57 class OThemePixmapPrivate; 62 class OThemePixmapPrivate;
58 OThemePixmapPrivate *d; 63 OThemePixmapPrivate *d;
59}; 64};
60 65
61inline QPixmap* OThemePixmap::border( BorderType type ) 66inline QPixmap* OThemePixmap::border( BorderType type )
62{ 67{
63 return ( b[ type ] ); 68 return ( b[ type ] );
64} 69}
65 70
66inline void OThemePixmap::setBorder( BorderType type, const QPixmap &p ) 71inline void OThemePixmap::setBorder( BorderType type, const QPixmap &p )
67{ 72{
68 if ( b[ type ] ) { 73 if ( b[ type ] ) {
69 qWarning( "OThemePixmap: Overwriting existing border!" ); 74 owarn << "OThemePixmap: Overwriting existing border!" << oendl;
70 delete( b[ type ] ); 75 delete( b[ type ] );
71 } 76 }
72 b[ type ] = new QPixmap( p ); 77 b[ type ] = new QPixmap( p );
73} 78}
74 79
75inline void OThemePixmap::updateAccessed() 80inline void OThemePixmap::updateAccessed()
76{ 81{
77 if (t) 82 if (t)
78 t->start(); 83 t->start();
79} 84}
80 85
81inline bool OThemePixmap::isOld() 86inline bool OThemePixmap::isOld()
82{ 87{
83 return ( t ? t->elapsed() >= 300000 : false ); 88 return ( t ? t->elapsed() >= 300000 : false );
84} 89}
85 90
86/** 91/**
@@ -106,72 +111,72 @@ inline bool OThemePixmap::isOld()
106 */ 111 */
107class OThemeCache : public QObject 112class OThemeCache : public QObject
108{ 113{
109 Q_OBJECT 114 Q_OBJECT
110public: 115public:
111 /** 116 /**
112 * The scale hints supported by the cache. Note that Tiled is not here 117 * The scale hints supported by the cache. Note that Tiled is not here
113 * since tiled pixmaps are kept only once in OThemeBase. 118 * since tiled pixmaps are kept only once in OThemeBase.
114 */ 119 */
115 enum ScaleHint{FullScale, HorizontalScale, VerticalScale}; 120 enum ScaleHint{FullScale, HorizontalScale, VerticalScale};
116 /** 121 /**
117 * The constructor. 122 * The constructor.
118 * 123 *
119 * @param maxSize The maximum size of the cache in kilobytes. 124 * @param maxSize The maximum size of the cache in kilobytes.
120 */ 125 */
121 OThemeCache( int maxSize, QObject *parent = 0, const char *name = 0 ); 126 OThemeCache( int maxSize, QObject *parent = 0, const char *name = 0 );
122 /** 127 /**
123 * Inserts a new pixmap into the cache. 128 * Inserts a new pixmap into the cache.
124 * 129 *
125 * @param pixmap The pixmap to insert. 130 * @param pixmap The pixmap to insert.
126 * @param scale The scaling type of the pixmap. 131 * @param scale The scaling type of the pixmap.
127 * @param widgetID The widget ID of the pixmap, usually from OThemeBase's 132 * @param widgetID The widget ID of the pixmap, usually from OThemeBase's
128 * WidgetType enum. 133 * WidgetType enum.
129 * 134 *
130 * @return True if the insert was successful, false otherwise. 135 * @return True if the insert was successful, false otherwise.
131 */ 136 */
132 bool insert( OThemePixmap *pixmap, ScaleHint scale, int widgetID, 137 bool insert( OThemePixmap *pixmap, ScaleHint scale, int widgetID,
133 bool border = false, bool mask = false ); 138 bool border = false, bool mask = false );
134 /** 139 /**
135 * Returns a fully scaled pixmap. 140 * Returns a fully scaled pixmap.
136 * 141 *
137 * @param w The pixmap width to search for. 142 * @param w The pixmap width to search for.
138 * @param h The pixmap height to search for. 143 * @param h The pixmap height to search for.
139 * @param widgetID The widget ID to search for. 144 * @param widgetID The widget ID to search for.
140 * 145 *
141 * @return True if a pixmap matching the width, height, and widget ID of 146 * @return True if a pixmap matching the width, height, and widget ID of
142 * the pixmap exists, NULL otherwise. 147 * the pixmap exists, NULL otherwise.
143 */ 148 */
144 OThemePixmap* pixmap( int w, int h, int widgetID, bool border = false, 149 OThemePixmap* pixmap( int w, int h, int widgetID, bool border = false,
145 bool mask = false ); 150 bool mask = false );
146 /** 151 /**
147 * Returns a horizontally scaled pixmap. 152 * Returns a horizontally scaled pixmap.
148 * 153 *
149 * @param w The pixmap width to search for. 154 * @param w The pixmap width to search for.
150 * @param widgetID The widget ID to search for. 155 * @param widgetID The widget ID to search for.
151 * 156 *
152 * @return True if a pixmap matching the width and widget ID of 157 * @return True if a pixmap matching the width and widget ID of
153 * the pixmap exists, NULL otherwise. 158 * the pixmap exists, NULL otherwise.
154 */ 159 */
155 OThemePixmap* horizontalPixmap( int w, int widgetID ); 160 OThemePixmap* horizontalPixmap( int w, int widgetID );
156 /** 161 /**
157 * Returns a vertically scaled pixmap. 162 * Returns a vertically scaled pixmap.
158 * 163 *
159 * @param h The pixmap height to search for. 164 * @param h The pixmap height to search for.
160 * @param widgetID The widget ID to search for. 165 * @param widgetID The widget ID to search for.
161 * 166 *
162 * @return True if a pixmap matching the height and widget ID of 167 * @return True if a pixmap matching the height and widget ID of
163 * the pixmap exists, NULL otherwise. 168 * the pixmap exists, NULL otherwise.
164 */ 169 */
165 OThemePixmap* verticalPixmap( int h, int widgetID ); 170 OThemePixmap* verticalPixmap( int h, int widgetID );
166protected slots: 171protected slots:
167 void flushTimeout(); 172 void flushTimeout();
168protected: 173protected:
169 QIntCache<OThemePixmap> cache; 174 QIntCache<OThemePixmap> cache;
170 QTimer flushTimer; 175 QTimer flushTimer;
171 176
172private: 177private:
173 class OThemeCachePrivate; 178 class OThemeCachePrivate;
174 OThemeCachePrivate *d; 179 OThemeCachePrivate *d;
175}; 180};
176 181
177 182
@@ -189,551 +194,551 @@ private:
189 */ 194 */
190class OThemeBase: public QWindowsStyle 195class OThemeBase: public QWindowsStyle
191{ 196{
192 Q_OBJECT 197 Q_OBJECT
193public: 198public:
194 /** 199 /**
195 * Constructs a new OThemeBase object. 200 * Constructs a new OThemeBase object.
196 */ 201 */
197 OThemeBase( const QString &configFile ); 202 OThemeBase( const QString &configFile );
198 ~OThemeBase(); 203 ~OThemeBase();
199 /** 204 /**
200 * Describes if a pixmap should be scaled fully, horizontally, vertically, 205 * Describes if a pixmap should be scaled fully, horizontally, vertically,
201 * or not at all and tiled. 206 * or not at all and tiled.
202 */ 207 */
203 enum ScaleHint{FullScale, HorizontalScale, VerticalScale, TileScale}; 208 enum ScaleHint{FullScale, HorizontalScale, VerticalScale, TileScale};
204 /** 209 /**
205 * The default arrow types. 210 * The default arrow types.
206 */ 211 */
207 enum ArrowStyle{MotifArrow, LargeArrow, SmallArrow}; 212 enum ArrowStyle{MotifArrow, LargeArrow, SmallArrow};
208 /** 213 /**
209 * The default frame shading styles. 214 * The default frame shading styles.
210 */ 215 */
211 enum ShadeStyle{Motif, Windows, Next, KDE}; 216 enum ShadeStyle{Motif, Windows, Next, KDE};
212 /** 217 /**
213 * The default scrollbar button layout. BottomLeft is like what Next 218 * The default scrollbar button layout. BottomLeft is like what Next
214 * uses, BottomRight is like Platinum, and Opposite it like Windows and 219 * uses, BottomRight is like Platinum, and Opposite it like Windows and
215 * Motif. 220 * Motif.
216 */ 221 */
217 enum SButton{SBBottomLeft, SBBottomRight, SBOpposite}; 222 enum SButton{SBBottomLeft, SBBottomRight, SBOpposite};
218 /** 223 /**
219 * The gradient types. Horizontal is left to right, Vertical is top to 224 * The gradient types. Horizontal is left to right, Vertical is top to
220 * bottom, and diagonal is upper-left to bottom-right. 225 * bottom, and diagonal is upper-left to bottom-right.
221 */ 226 */
222 enum Gradient{GrNone, GrHorizontal, GrVertical, GrDiagonal, GrPyramid, 227 enum Gradient{GrNone, GrHorizontal, GrVertical, GrDiagonal, GrPyramid,
223 GrRectangle, GrElliptic, GrReverseBevel}; 228 GrRectangle, GrElliptic, GrReverseBevel};
224 /** 229 /**
225 * This provides a list of widget types that OThemeBase recognizes. 230 * This provides a list of widget types that OThemeBase recognizes.
226 */ 231 */
227 /* Internal note: The order here is important. Some widgets inherit 232 /* Internal note: The order here is important. Some widgets inherit
228 * properties. This is usually for when you have two settings for the 233 * properties. This is usually for when you have two settings for the
229 * same widget, ie: on(sunken), and off. The on settings will inherit 234 * same widget, ie: on(sunken), and off. The on settings will inherit
230 * the properties of the off one when nothing is specified in the config. 235 * the properties of the off one when nothing is specified in the config.
231 * 236 *
232 * In order to be able to handle this while still having everything in 237 * In order to be able to handle this while still having everything in
233 * one group that is easy to loop from we have the following order: 238 * one group that is easy to loop from we have the following order:
234 * unsunked(off) items, sunken(on)items, and then the ones that don't 239 * unsunked(off) items, sunken(on)items, and then the ones that don't
235 * matter. INHERIT_ITEMS define the number of widgets that have inheritence 240 * matter. INHERIT_ITEMS define the number of widgets that have inheritence
236 * so if 0 == PushButtonOff then INHERIT_ITEMS should == PushButtonOn 241 * so if 0 == PushButtonOff then INHERIT_ITEMS should == PushButtonOn
237 * and so on. WIDGETS define the total number of widgets. 242 * and so on. WIDGETS define the total number of widgets.
238 */ 243 */
239 enum WidgetType{ 244 enum WidgetType{
240 // Off (unsunken widgets) 245 // Off (unsunken widgets)
241 PushButton = 0, ComboBox, HScrollBarSlider, VScrollBarSlider, Bevel, 246 PushButton = 0, ComboBox, HScrollBarSlider, VScrollBarSlider, Bevel,
242 ToolButton, ScrollButton, HScrollDeco, VScrollDeco, 247 ToolButton, ScrollButton, HScrollDeco, VScrollDeco,
243 ComboDeco, MenuItem, InactiveTab, ArrowUp, ArrowDown, ArrowLeft, 248 ComboDeco, MenuItem, InactiveTab, ArrowUp, ArrowDown, ArrowLeft,
244 ArrowRight, 249 ArrowRight,
245 // On (sunken widgets) 250 // On (sunken widgets)
246 PushButtonDown, ComboBoxDown, HScrollBarSliderDown, 251 PushButtonDown, ComboBoxDown, HScrollBarSliderDown,
247 VScrollBarSliderDown, BevelDown, ToolButtonDown, ScrollButtonDown, 252 VScrollBarSliderDown, BevelDown, ToolButtonDown, ScrollButtonDown,
248 HScrollDecoDown, VScrollDecoDown, ComboDecoDown, MenuItemDown, 253 HScrollDecoDown, VScrollDecoDown, ComboDecoDown, MenuItemDown,
249 ActiveTab, SunkenArrowUp, SunkenArrowDown, SunkenArrowLeft, 254 ActiveTab, SunkenArrowUp, SunkenArrowDown, SunkenArrowLeft,
250 SunkenArrowRight, 255 SunkenArrowRight,
251 // Everything else (indicators must have separate settings) 256 // Everything else (indicators must have separate settings)
252 HScrollGroove, VScrollGroove, Slider, SliderGroove, IndicatorOn, 257 HScrollGroove, VScrollGroove, Slider, SliderGroove, IndicatorOn,
253 IndicatorOff, ExIndicatorOn, ExIndicatorOff, HBarHandle, VBarHandle, 258 IndicatorOff, ExIndicatorOn, ExIndicatorOff, HBarHandle, VBarHandle,
254 ToolBar, Splitter, CheckMark, MenuBar, DisArrowUp, DisArrowDown, 259 ToolBar, Splitter, CheckMark, MenuBar, DisArrowUp, DisArrowDown,
255 DisArrowLeft, DisArrowRight, ProgressBar, ProgressBg, MenuBarItem, 260 DisArrowLeft, DisArrowRight, ProgressBar, ProgressBg, MenuBarItem,
256 Background}; 261 Background};
257 262
258 /** 263 /**
259 * The scaling type specified by the Config file. 264 * The scaling type specified by the Config file.
260 * 265 *
261 * @param widget A Widgets enum value. 266 * @param widget A Widgets enum value.
262 * 267 *
263 * @return A ScaleHint enum value. 268 * @return A ScaleHint enum value.
264 */ 269 */
265 ScaleHint scaleHint( WidgetType widget ) const; 270 ScaleHint scaleHint( WidgetType widget ) const;
266 /** 271 /**
267 * The gradient type specified by the KConfig file. 272 * The gradient type specified by the KConfig file.
268 * 273 *
269 * @param widget A Widgets enum value. 274 * @param widget A Widgets enum value.
270 * 275 *
271 * @return A Gradient enum value. 276 * @return A Gradient enum value.
272 */ 277 */
273 Gradient gradientHint( WidgetType widget ) const; 278 Gradient gradientHint( WidgetType widget ) const;
274 /** 279 /**
275 * The color group specified for a given widget. 280 * The color group specified for a given widget.
276 * If a color group is set in the theme configuration 281 * If a color group is set in the theme configuration
277 * that is used, otherwise defaultColor is returned. 282 * that is used, otherwise defaultColor is returned.
278 * 283 *
279 * @param defaultColor The colorGroup to set if one is available. 284 * @param defaultColor The colorGroup to set if one is available.
280 * 285 *
281 * @param widget The widget whose color group to retrieve. 286 * @param widget The widget whose color group to retrieve.
282 * 287 *
283 */ 288 */
284 const QColorGroup* colorGroup( const QColorGroup &defaultGroup, 289 const QColorGroup* colorGroup( const QColorGroup &defaultGroup,
285 WidgetType widget ) const; 290 WidgetType widget ) const;
286 291
287 QBrush pixmapBrush( const QColorGroup &group, QColorGroup::ColorRole role, 292 QBrush pixmapBrush( const QColorGroup &group, QColorGroup::ColorRole role,
288 int w, int h, WidgetType widget ); 293 int w, int h, WidgetType widget );
289 /** 294 /**
290 * True if the widget has a pixmap or gradient specified. 295 * True if the widget has a pixmap or gradient specified.
291 */ 296 */
292 bool isPixmap( WidgetType widget ) const; 297 bool isPixmap( WidgetType widget ) const;
293 /** 298 /**
294 * True if the widget has a color group specified. 299 * True if the widget has a color group specified.
295 */ 300 */
296 bool isColor( WidgetType widget ) const; 301 bool isColor( WidgetType widget ) const;
297 /** 302 /**
298 * True if the user specified a 3D focus rectangle 303 * True if the user specified a 3D focus rectangle
299 */ 304 */
300 bool is3DFocus() const; 305 bool is3DFocus() const;
301 /** 306 /**
302 * If the user specified a 3D focus rectangle, they may also specify an 307 * If the user specified a 3D focus rectangle, they may also specify an
303 * offset from the default rectangle to use when drawing it. This returns 308 * offset from the default rectangle to use when drawing it. This returns
304 * the specified offset. 309 * the specified offset.
305 */ 310 */
306 int focusOffset() const; 311 int focusOffset() const;
307 /** 312 /**
308 * The border width of the specified widget. 313 * The border width of the specified widget.
309 */ 314 */
310 int borderWidth( WidgetType widget ) const; 315 int borderWidth( WidgetType widget ) const;
311 /** 316 /**
312 * Pixmap border width of the specified widget. 317 * Pixmap border width of the specified widget.
313 */ 318 */
314 int pixBorderWidth( WidgetType widget ) const; 319 int pixBorderWidth( WidgetType widget ) const;
315 /** 320 /**
316 * Returns the border pixmap if enabled for the specified widget. This 321 * Returns the border pixmap if enabled for the specified widget. This
317 * will contain the originial pixmap, plus the edges separated in 322 * will contain the originial pixmap, plus the edges separated in
318 * OThemePixmap::border() if valid. If invalid it will return NULL. 323 * OThemePixmap::border() if valid. If invalid it will return NULL.
319 */ 324 */
320 OThemePixmap* borderPixmap( WidgetType widget ); 325 OThemePixmap* borderPixmap( WidgetType widget );
321 /** 326 /**
322 * The highlight width of the specified widget. 327 * The highlight width of the specified widget.
323 */ 328 */
324 int highlightWidth( WidgetType widget ) const; 329 int highlightWidth( WidgetType widget ) const;
325 /** 330 /**
326 * The border plus highlight width of the widget. 331 * The border plus highlight width of the widget.
327 */ 332 */
328 int decoWidth( WidgetType widget ) const; 333 int decoWidth( WidgetType widget ) const;
329 /** 334 /**
330 * The extent (width for vertical, height for horizontal) requested 335 * The extent (width for vertical, height for horizontal) requested
331 * for the scrollbars. 336 * for the scrollbars.
332 */ 337 */
333 int getSBExtent() const; 338 int getSBExtent() const;
334 /** 339 /**
335 * The scrollbar button layout. 340 * The scrollbar button layout.
336 */ 341 */
337 SButton scrollBarLayout() const; 342 SButton scrollBarLayout() const;
338 /** 343 /**
339 * The arrow type. 344 * The arrow type.
340 */ 345 */
341 ArrowStyle arrowType() const; 346 ArrowStyle arrowType() const;
342 /** 347 /**
343 * The shading type. 348 * The shading type.
344 */ 349 */
345 ShadeStyle shade() const; 350 ShadeStyle shade() const;
346 /** 351 /**
347 * The frame width. 352 * The frame width.
348 */ 353 */
349 int frameWidth() const; 354 int frameWidth() const;
350 /** 355 /**
351 * The splitter width. 356 * The splitter width.
352 */ 357 */
353 int splitWidth() const; 358 int splitWidth() const;
354 /** 359 /**
355 * The contrast for some bevel effects such as reverse gradient. 360 * The contrast for some bevel effects such as reverse gradient.
356 */ 361 */
357 int bevelContrast( WidgetType widget ) const; 362 int bevelContrast( WidgetType widget ) const;
358 /** 363 /**
359 * The button text X shift. 364 * The button text X shift.
360 */ 365 */
361 int buttonXShift() const; 366 int buttonXShift() const;
362 /** 367 /**
363 * The button text Y shift. 368 * The button text Y shift.
364 */ 369 */
365 int buttonYShift() const; 370 int buttonYShift() const;
366 /** 371 /**
367 * Returns either the slider length of the slider pixmap if available, 372 * Returns either the slider length of the slider pixmap if available,
368 * otherwise the length specified in the config file. 373 * otherwise the length specified in the config file.
369 */ 374 */
370 int sliderButtonLength() const; 375 int sliderButtonLength() const;
371 /** 376 /**
372 * True if rounded buttons are requested. 377 * True if rounded buttons are requested.
373 */ 378 */
374 bool roundButton() const; 379 bool roundButton() const;
375 /** 380 /**
376 * True if rounded comboboxes are requested. 381 * True if rounded comboboxes are requested.
377 */ 382 */
378 bool roundComboBox() const; 383 bool roundComboBox() const;
379 /** 384 /**
380 * True if rounded slider grooves are requested. 385 * True if rounded slider grooves are requested.
381 */ 386 */
382 bool roundSlider() const; 387 bool roundSlider() const;
383 /** 388 /**
384 * True if a line should be drawn on the bottom of active tabs. 389 * True if a line should be drawn on the bottom of active tabs.
385 */ 390 */
386 bool activeTabLine() const; 391 bool activeTabLine() const;
387 /** 392 /**
388 * True if a line should be drawn on the bottom of inactive tabs. 393 * True if a line should be drawn on the bottom of inactive tabs.
389 */ 394 */
390 bool inactiveTabLine() const; 395 bool inactiveTabLine() const;
391 /** 396 /**
392 * Returns the current uncached pixmap for the given widget. This will 397 * Returns the current uncached pixmap for the given widget. This will
393 * usually be either the last scaled or gradient pixmap if those have 398 * usually be either the last scaled or gradient pixmap if those have
394 * been specified in the config file, the original pixmap if not, or NULL 399 * been specified in the config file, the original pixmap if not, or NULL
395 * if no pixmap has been specified. 400 * if no pixmap has been specified.
396 */ 401 */
397 OThemePixmap* uncached( WidgetType widget ) const; 402 OThemePixmap* uncached( WidgetType widget ) const;
398 /** 403 /**
399 * Returns the pixmap for the given widget at the specified width and 404 * Returns the pixmap for the given widget at the specified width and
400 * height. This will return NULL if no pixmap or gradient is specified. 405 * height. This will return NULL if no pixmap or gradient is specified.
401 * It may also return a different sized pixmap if the scaling 406 * It may also return a different sized pixmap if the scaling
402 * is set to Tiled. When using this method, you should call it using 407 * is set to Tiled. When using this method, you should call it using
403 * the needed width and height then use QPainter::drawTiledPixmap to 408 * the needed width and height then use QPainter::drawTiledPixmap to
404 * paint it. Doing this, if the pixmap is scaled it will be the proper 409 * paint it. Doing this, if the pixmap is scaled it will be the proper
405 * size, otherwise it will be tiled. 410 * size, otherwise it will be tiled.
406 * 411 *
407 * @param w Requested width. 412 * @param w Requested width.
408 * @param h Requested height. 413 * @param h Requested height.
409 * @param widget Widget type. 414 * @param widget Widget type.
410 * @return The pixmap or NULL if one is not specified. 415 * @return The pixmap or NULL if one is not specified.
411 */ 416 */
412 virtual OThemePixmap *scalePixmap( int w, int h, WidgetType widget ); 417 virtual OThemePixmap *scalePixmap( int w, int h, WidgetType widget );
413 /** 418 /**
414 * This method reads a configuration file and applies it to the user's 419 * This method reads a configuration file and applies it to the user's
415 * kstylerc file. It does not signal applications to reload via the 420 * kstylerc file. It does not signal applications to reload via the
416 * KDEChangeGeneral atom, if you want to do this you must do so yourself. 421 * KDEChangeGeneral atom, if you want to do this you must do so yourself.
417 * See kcmdisplay's general.cpp for an example. 422 * See kcmdisplay's general.cpp for an example.
418 * 423 *
419 * @param file The configuration file to apply. 424 * @param file The configuration file to apply.
420 */ 425 */
421 static void applyConfigFile( const QString &file ); 426 static void applyConfigFile( const QString &file );
422protected: 427protected:
423 /** 428 /**
424 * Returns a QImage for the given widget if the widget is scaled, NULL 429 * Returns a QImage for the given widget if the widget is scaled, NULL
425 * otherwise. QImages of the original pixmap are stored for scaled 430 * otherwise. QImages of the original pixmap are stored for scaled
426 * widgets in order to facilitate fast and accurate smooth-scaling. This 431 * widgets in order to facilitate fast and accurate smooth-scaling. This
427 * also saves us a conversion from a pixmap to an image then back again. 432 * also saves us a conversion from a pixmap to an image then back again.
428 */ 433 */
429 QImage* image( WidgetType widget ) const; 434 QImage* image( WidgetType widget ) const;
430 /** 435 /**
431 * Returns the gradient high color if one is specified, NULL otherwise. 436 * Returns the gradient high color if one is specified, NULL otherwise.
432 */ 437 */
433 QColor* gradientHigh( WidgetType widget ) const; 438 QColor* gradientHigh( WidgetType widget ) const;
434 /** 439 /**
435 * Returns the gradient low color if one is specified, NULL otherwise. 440 * Returns the gradient low color if one is specified, NULL otherwise.
436 */ 441 */
437 QColor* gradientLow( WidgetType widget ) const; 442 QColor* gradientLow( WidgetType widget ) const;
438 /** 443 /**
439 * Reads in all the configuration file entries supported. 444 * Reads in all the configuration file entries supported.
440 * 445 *
441 * @param colorStyle The style for the color groups. In KDE, colors were 446 * @param colorStyle The style for the color groups. In KDE, colors were
442 * calculated a little differently for Motif vs Windows styles. This 447 * calculated a little differently for Motif vs Windows styles. This
443 * is obsolete. 448 * is obsolete.
444 */ 449 */
445 void readConfig( Qt::GUIStyle colorStyle = Qt::WindowsStyle ); 450 void readConfig( Qt::GUIStyle colorStyle = Qt::WindowsStyle );
446 void readWidgetConfig( int i, Config *config, QString *pixnames, 451 void readWidgetConfig( int i, Config *config, QString *pixnames,
447 QString *brdnames, bool *loadArray ); 452 QString *brdnames, bool *loadArray );
448 void copyWidgetConfig( int sourceID, int destID, QString *pixnames, 453 void copyWidgetConfig( int sourceID, int destID, QString *pixnames,
449 QString *brdnames ); 454 QString *brdnames );
450 /** 455 /**
451 * Makes a full color group based on the given foreground and background 456 * Makes a full color group based on the given foreground and background
452 * colors. This is the same code used by KDE (kapp.cpp) in previous 457 * colors. This is the same code used by KDE (kapp.cpp) in previous
453 * versions. 458 * versions.
454 */ 459 */
455 QColorGroup* makeColorGroup( QColor &fg, QColor &bg, 460 QColorGroup* makeColorGroup( QColor &fg, QColor &bg,
456 Qt::GUIStyle style = Qt::WindowsStyle ); 461 Qt::GUIStyle style = Qt::WindowsStyle );
457 OThemePixmap* scale( int w, int h, WidgetType widget ); 462 OThemePixmap* scale( int w, int h, WidgetType widget );
458 OThemePixmap* scaleBorder( int w, int h, WidgetType type ); 463 OThemePixmap* scaleBorder( int w, int h, WidgetType type );
459 OThemePixmap* gradient( int w, int h, WidgetType widget ); 464 OThemePixmap* gradient( int w, int h, WidgetType widget );
460 OThemePixmap* blend( WidgetType widget ); 465 OThemePixmap* blend( WidgetType widget );
461 void generateBorderPix( int i ); 466 void generateBorderPix( int i );
462 void applyResourceGroup( Config *config, int i, QString *copyfrom, QString *pixnames, QString *brdnames ); 467 void applyResourceGroup( Config *config, int i, QString *copyfrom, QString *pixnames, QString *brdnames );
463 void applyMiscResourceGroup( Config *config ); 468 void applyMiscResourceGroup( Config *config );
464 void readResourceGroup( int i, QString *copyfrom, QString *pixnames, QString *brdnames, 469 void readResourceGroup( int i, QString *copyfrom, QString *pixnames, QString *brdnames,
465 bool *loadArray ); 470 bool *loadArray );
466 void readMiscResourceGroup(); 471 void readMiscResourceGroup();
467 /** 472 /**
468 * Attempts to load a pixmap from the default OThemeBase locations. 473 * Attempts to load a pixmap from the default OThemeBase locations.
469 */ 474 */
470 OThemePixmap* loadPixmap( QString &name ); 475 OThemePixmap* loadPixmap( QString &name );
471 /** 476 /**
472 * Attempts to load a image from the default OThemeBase locations. 477 * Attempts to load a image from the default OThemeBase locations.
473 */ 478 */
474 QImage* loadImage( QString &name ); 479 QImage* loadImage( QString &name );
475private: 480private:
476 SButton sbPlacement; 481 SButton sbPlacement;
477 ArrowStyle arrowStyle; 482 ArrowStyle arrowStyle;
478 ShadeStyle shading; 483 ShadeStyle shading;
479 int defaultFrame; 484 int defaultFrame;
480 int btnXShift, btnYShift; 485 int btnXShift, btnYShift;
481 int sliderLen; 486 int sliderLen;
482 int splitterWidth; 487 int splitterWidth;
483 int focus3DOffset; 488 int focus3DOffset;
484 int sbExtent; 489 int sbExtent;
485 bool smallGroove; 490 bool smallGroove;
486 bool roundedButton, roundedCombo, roundedSlider; 491 bool roundedButton, roundedCombo, roundedSlider;
487 bool aTabLine, iTabLine; 492 bool aTabLine, iTabLine;
488 bool focus3D; 493 bool focus3D;
489 OThemeCache *cache; 494 OThemeCache *cache;
490 int cacheSize; 495 int cacheSize;
491 QString configFileName; 496 QString configFileName;
492 QString configFilePath; 497 QString configFilePath;
493 498
494protected: 499protected:
495 QColor fgcolor, bgcolor, selfgcolor, selbgcolor, winfgcolor, winbgcolor; 500 QColor fgcolor, bgcolor, selfgcolor, selbgcolor, winfgcolor, winbgcolor;
496 501
497private: 502private:
498 /** 503 /**
499 * The theme pixmaps. Many of these may be NULL if no pixmap is specified. 504 * The theme pixmaps. Many of these may be NULL if no pixmap is specified.
500 * There may also be duplicate pixmap pointers if more than one widget 505 * There may also be duplicate pixmap pointers if more than one widget
501 * uses the same tiled pixmap. If a pixmap is tiled, it is kept here and 506 * uses the same tiled pixmap. If a pixmap is tiled, it is kept here and
502 * this acts as a cache. Otherwise this will hold whatever the last scaled 507 * this acts as a cache. Otherwise this will hold whatever the last scaled
503 * pixmap was. 508 * pixmap was.
504 */ 509 */
505 OThemePixmap *pixmaps[ WIDGETS ]; 510 OThemePixmap *pixmaps[ WIDGETS ];
506 /** 511 /**
507 * The theme images. These are for scaled images and are kept in order 512 * The theme images. These are for scaled images and are kept in order
508 * to maintain fast smoothscaling. 513 * to maintain fast smoothscaling.
509 */ 514 */
510 QImage *images[ WIDGETS ]; 515 QImage *images[ WIDGETS ];
511 /** 516 /**
512 * The border widths 517 * The border widths
513 */ 518 */
514 unsigned char borders[ WIDGETS ]; 519 unsigned char borders[ WIDGETS ];
515 /** 520 /**
516 * The highlight widths 521 * The highlight widths
517 */ 522 */
518 unsigned char highlights[ WIDGETS ]; 523 unsigned char highlights[ WIDGETS ];
519 /** 524 /**
520 * The scale hints for pixmaps and gradients. 525 * The scale hints for pixmaps and gradients.
521 */ 526 */
522 ScaleHint scaleHints[ WIDGETS ]; 527 ScaleHint scaleHints[ WIDGETS ];
523 /** 528 /**
524 * All the color groups. 529 * All the color groups.
525 */ 530 */
526 QColorGroup *colors[ WIDGETS ]; 531 QColorGroup *colors[ WIDGETS ];
527 /** 532 /**
528 * Gradient low colors (or blend background). 533 * Gradient low colors (or blend background).
529 */ 534 */
530 QColor *grLowColors[ WIDGETS ]; 535 QColor *grLowColors[ WIDGETS ];
531 /** 536 /**
532 * Gradient high colors. 537 * Gradient high colors.
533 */ 538 */
534 QColor *grHighColors[ WIDGETS ]; 539 QColor *grHighColors[ WIDGETS ];
535 /** 540 /**
536 * Gradient types. 541 * Gradient types.
537 */ 542 */
538 Gradient gradients[ WIDGETS ]; 543 Gradient gradients[ WIDGETS ];
539 /** 544 /**
540 * Blend intensity factors 545 * Blend intensity factors
541 */ 546 */
542 float blends[ WIDGETS ]; 547 float blends[ WIDGETS ];
543 /** 548 /**
544 * Bevel contrasts 549 * Bevel contrasts
545 */ 550 */
546 unsigned char bContrasts[ WIDGETS ]; 551 unsigned char bContrasts[ WIDGETS ];
547 /** 552 /**
548 * Duplicate pixmap entries (used during destruction). 553 * Duplicate pixmap entries (used during destruction).
549 */ 554 */
550 bool duplicate[ WIDGETS ]; 555 bool duplicate[ WIDGETS ];
551 /** 556 /**
552 * Pixmapped border widths 557 * Pixmapped border widths
553 */ 558 */
554 int pbWidth[ WIDGETS ]; 559 int pbWidth[ WIDGETS ];
555 /** 560 /**
556 * Pixmapped borders 561 * Pixmapped borders
557 */ 562 */
558 OThemePixmap *pbPixmaps[ WIDGETS ]; 563 OThemePixmap *pbPixmaps[ WIDGETS ];
559 /** 564 /**
560 * Duplicate border pixmapped border entries 565 * Duplicate border pixmapped border entries
561 */ 566 */
562 bool pbDuplicate[ WIDGETS ]; 567 bool pbDuplicate[ WIDGETS ];
563 568
564private: 569private:
565 class OThemeBasePrivate; 570 class OThemeBasePrivate;
566 OThemeBasePrivate *d; 571 OThemeBasePrivate *d;
567 572
568}; 573};
569 574
570inline bool OThemeBase::isPixmap( WidgetType widget ) const 575inline bool OThemeBase::isPixmap( WidgetType widget ) const
571{ 576{
572 return ( pixmaps[ widget ] != NULL || gradients[ widget ] != GrNone ); 577 return ( pixmaps[ widget ] != NULL || gradients[ widget ] != GrNone );
573} 578}
574 579
575inline bool OThemeBase::isColor( WidgetType widget ) const 580inline bool OThemeBase::isColor( WidgetType widget ) const
576{ 581{
577 return ( colors[ widget ] != NULL ); 582 return ( colors[ widget ] != NULL );
578} 583}
579 584
580inline bool OThemeBase::is3DFocus() const 585inline bool OThemeBase::is3DFocus() const
581{ 586{
582 return ( focus3D ); 587 return ( focus3D );
583} 588}
584 589
585inline int OThemeBase::focusOffset() const 590inline int OThemeBase::focusOffset() const
586{ 591{
587 return ( focus3DOffset ); 592 return ( focus3DOffset );
588} 593}
589 594
590inline int OThemeBase::bevelContrast( WidgetType widget ) const 595inline int OThemeBase::bevelContrast( WidgetType widget ) const
591{ 596{
592 return ( bContrasts[ widget ] ); 597 return ( bContrasts[ widget ] );
593} 598}
594 599
595inline OThemeBase::ScaleHint OThemeBase::scaleHint( WidgetType widget ) const 600inline OThemeBase::ScaleHint OThemeBase::scaleHint( WidgetType widget ) const
596{ 601{
597 return ( ( widget < WIDGETS ) ? scaleHints[ widget ] : TileScale ); 602 return ( ( widget < WIDGETS ) ? scaleHints[ widget ] : TileScale );
598} 603}
599 604
600inline OThemeBase::Gradient OThemeBase::gradientHint( WidgetType widget ) const 605inline OThemeBase::Gradient OThemeBase::gradientHint( WidgetType widget ) const
601{ 606{
602 return ( ( widget < WIDGETS ) ? gradients[ widget ] : GrNone ); 607 return ( ( widget < WIDGETS ) ? gradients[ widget ] : GrNone );
603} 608}
604 609
605inline OThemePixmap* OThemeBase::uncached( WidgetType widget ) const 610inline OThemePixmap* OThemeBase::uncached( WidgetType widget ) const
606{ 611{
607 return ( pixmaps[ widget ] ); 612 return ( pixmaps[ widget ] );
608} 613}
609 614
610inline QBrush OThemeBase::pixmapBrush( const QColorGroup &group, 615inline QBrush OThemeBase::pixmapBrush( const QColorGroup &group,
611 QColorGroup::ColorRole role, 616 QColorGroup::ColorRole role,
612 int w, int h, WidgetType widget ) 617 int w, int h, WidgetType widget )
613{ 618{
614 if ( pixmaps[ widget ] || images[ widget ] ) 619 if ( pixmaps[ widget ] || images[ widget ] )
615 return ( QBrush( group.color( role ), *scalePixmap( w, h, widget ) ) ); 620 return ( QBrush( group.color( role ), *scalePixmap( w, h, widget ) ) );
616 else 621 else
617 return ( group.color( role ) ); 622 return ( group.color( role ) );
618} 623}
619 624
620inline const QColorGroup* OThemeBase::colorGroup( const QColorGroup &defaultGroup, 625inline const QColorGroup* OThemeBase::colorGroup( const QColorGroup &defaultGroup,
621 WidgetType widget ) const 626 WidgetType widget ) const
622{ 627{
623 return ( ( colors[ widget ] ) ? colors[ widget ] : &defaultGroup ); 628 return ( ( colors[ widget ] ) ? colors[ widget ] : &defaultGroup );
624} 629}
625 630
626inline int OThemeBase::borderWidth( WidgetType widget ) const 631inline int OThemeBase::borderWidth( WidgetType widget ) const
627{ 632{
628 return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] ); 633 return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] );
629} 634}
630 635
631inline int OThemeBase::pixBorderWidth( WidgetType widget ) const 636inline int OThemeBase::pixBorderWidth( WidgetType widget ) const
632{ 637{
633 return ( pbWidth[ widget ] ); 638 return ( pbWidth[ widget ] );
634} 639}
635 640
636inline int OThemeBase::highlightWidth( WidgetType widget ) const 641inline int OThemeBase::highlightWidth( WidgetType widget ) const
637{ 642{
638 return ( pbWidth[ widget ] ? 0 : highlights[ widget ] ); 643 return ( pbWidth[ widget ] ? 0 : highlights[ widget ] );
639} 644}
640 645
641inline int OThemeBase::decoWidth( WidgetType widget ) const 646inline int OThemeBase::decoWidth( WidgetType widget ) const
642{ 647{
643 return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] + highlights[ widget ] ); 648 return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] + highlights[ widget ] );
644} 649}
645 650
646inline QColor* OThemeBase::gradientHigh( WidgetType widget ) const 651inline QColor* OThemeBase::gradientHigh( WidgetType widget ) const
647{ 652{
648 return ( grHighColors[ widget ] ); 653 return ( grHighColors[ widget ] );
649} 654}
650 655
651inline QColor* OThemeBase::gradientLow( WidgetType widget ) const 656inline QColor* OThemeBase::gradientLow( WidgetType widget ) const
652{ 657{
653 return ( grLowColors[ widget ] ); 658 return ( grLowColors[ widget ] );
654} 659}
655 660
656inline QImage* OThemeBase::image( WidgetType widget ) const 661inline QImage* OThemeBase::image( WidgetType widget ) const
657{ 662{
658 return ( images[ widget ] ); 663 return ( images[ widget ] );
659} 664}
660 665
661inline OThemeBase::SButton OThemeBase::scrollBarLayout() const 666inline OThemeBase::SButton OThemeBase::scrollBarLayout() const
662{ 667{
663 return ( sbPlacement ); 668 return ( sbPlacement );
664} 669}
665 670
666inline OThemeBase::ArrowStyle OThemeBase::arrowType() const 671inline OThemeBase::ArrowStyle OThemeBase::arrowType() const
667{ 672{
668 return ( arrowStyle ); 673 return ( arrowStyle );
669} 674}
670 675
671inline OThemeBase::ShadeStyle OThemeBase::shade() const 676inline OThemeBase::ShadeStyle OThemeBase::shade() const
672{ 677{
673 return ( shading ); 678 return ( shading );
674} 679}
675 680
676inline int OThemeBase::frameWidth() const 681inline int OThemeBase::frameWidth() const
677{ 682{
678 return ( defaultFrame ); 683 return ( defaultFrame );
679} 684}
680 685
681inline int OThemeBase::buttonXShift() const 686inline int OThemeBase::buttonXShift() const
682{ 687{
683 return ( btnXShift ); 688 return ( btnXShift );
684} 689}
685 690
686inline int OThemeBase::splitWidth() const 691inline int OThemeBase::splitWidth() const
687{ 692{
688 return ( splitterWidth ); 693 return ( splitterWidth );
689} 694}
690 695
691inline int OThemeBase::buttonYShift() const 696inline int OThemeBase::buttonYShift() const
692{ 697{
693 return ( btnYShift ); 698 return ( btnYShift );
694} 699}
695 700
696inline int OThemeBase::sliderButtonLength() const 701inline int OThemeBase::sliderButtonLength() const
697{ 702{
698 if ( isPixmap( Slider ) ) 703 if ( isPixmap( Slider ) )
699 return ( uncached( Slider ) ->width() ); 704 return ( uncached( Slider ) ->width() );
700 else 705 else
701 return ( sliderLen ); 706 return ( sliderLen );
702} 707}
703 708
704inline bool OThemeBase::roundButton() const 709inline bool OThemeBase::roundButton() const
705{ 710{
706 return ( roundedButton ); 711 return ( roundedButton );
707} 712}
708 713
709inline bool OThemeBase::roundComboBox() const 714inline bool OThemeBase::roundComboBox() const
710{ 715{
711 return ( roundedCombo ); 716 return ( roundedCombo );
712} 717}
713 718
714inline bool OThemeBase::roundSlider() const 719inline bool OThemeBase::roundSlider() const
715{ 720{
716 return ( roundedSlider ); 721 return ( roundedSlider );
717} 722}
718 723
719inline bool OThemeBase::activeTabLine() const 724inline bool OThemeBase::activeTabLine() const
720{ 725{
721 return ( aTabLine ); 726 return ( aTabLine );
722} 727}
723 728
724inline bool OThemeBase::inactiveTabLine() const 729inline bool OThemeBase::inactiveTabLine() const
725{ 730{
726 return ( iTabLine ); 731 return ( iTabLine );
727} 732}
728 733
729inline int OThemeBase::getSBExtent() const 734inline int OThemeBase::getSBExtent() const
730{ 735{
731 return ( sbExtent ); 736 return ( sbExtent );
732} 737}
733 738
734inline OThemePixmap* OThemeBase::borderPixmap( WidgetType widget ) 739inline OThemePixmap* OThemeBase::borderPixmap( WidgetType widget )
735{ 740{
736 return ( pbPixmaps[ widget ] ); 741 return ( pbPixmaps[ widget ] );
737} 742}
738 743
739#endif 744#endif