00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __KTHEMESTYLE_H
00019 #define __KTHEMESTYLE_H
00020
00021 #include "othemebase.h"
00022 #include <qwindowdefs.h>
00023 #include <qobject.h>
00024 #include <qbutton.h>
00025 #include <qpushbutton.h>
00026 #include <qscrollbar.h>
00027 #include <qstring.h>
00028
00029 class QProgressBar;
00030
00031
00043 class OThemeStyle: public OThemeBase
00044 {
00045 Q_OBJECT
00046 public:
00053 OThemeStyle( const QString &configFile = QString::null );
00054 ~OThemeStyle();
00055 virtual void polish( QWidget* );
00056 virtual void unPolish( QWidget* );
00061 virtual void polish( QApplication *app );
00062 virtual void unPolish( QApplication* );
00063
00065
00066 virtual void polish( QPalette& pal );
00067
00068 virtual bool eventFilter ( QObject *obj, QEvent *ev );
00069
00083 virtual void drawBaseButton( QPainter *p, int x, int y, int w, int h,
00084 const QColorGroup &g, bool sunken = FALSE,
00085 bool rounded = FALSE, WidgetType type = Bevel,
00086 const QBrush *fill = 0 );
00096 virtual void drawBaseMask( QPainter *p, int x, int y, int w, int h,
00097 bool rounded );
00104 virtual void drawButton( QPainter *p, int x, int y, int w, int h,
00105 const QColorGroup &g, bool sunken = FALSE,
00106 const QBrush *fill = 0 );
00113 virtual void drawBevelButton( QPainter *p, int x, int y, int w, int h,
00114 const QColorGroup &g, bool sunken = FALSE,
00115 const QBrush *fill = 0 );
00119 virtual void drawToolButton ( QPainter *p, int x, int y, int w, int h,
00120 const QColorGroup &g, bool sunken = FALSE,
00121 const QBrush *fill = 0 );
00122 #if 0
00123
00126 virtual void drawKToolBarButton( QPainter *p, int x, int y, int w, int h,
00127 const QColorGroup &g, bool sunken = false,
00128 bool raised = true, bool enabled = true,
00129 bool popup = false, KToolButtonType type = Icon,
00130 const QString &btext = QString::null,
00131 const QPixmap *icon = NULL,
00132 QFont *font = NULL, QWidget *btn = NULL );
00136 void drawKBarHandle( QPainter *p, int x, int y, int w, int h,
00137 const QColorGroup &g,
00138 KToolBarPos type, QBrush *fill = NULL );
00139
00143 void drawKToolBar( QPainter *p, int x, int y, int w, int h,
00144 const QColorGroup &g, KToolBarPos type,
00145 QBrush *fill = NULL );
00146 #endif
00147
00151 virtual QRect buttonRect( int x, int y, int w, int h );
00155 virtual void drawArrow( QPainter *p, Qt::ArrowType type, bool down,
00156 int x, int y, int w, int h, const QColorGroup &g,
00157 bool enabled = true, const QBrush *fill = 0 );
00162 virtual QSize exclusiveIndicatorSize() const;
00169 virtual void drawExclusiveIndicator( QPainter* p, int x, int y, int w,
00170 int h, const QColorGroup &g, bool on,
00171 bool down = FALSE,
00172 bool enabled = TRUE );
00180 virtual void drawExclusiveIndicatorMask( QPainter *p, int x, int y, int w,
00181 int h, bool on );
00189 virtual void drawIndicatorMask( QPainter *p, int x, int y, int w, int h,
00190 int state );
00194 virtual void drawButtonMask( QPainter *p, int x, int y, int w, int h );
00198 virtual void drawComboButtonMask( QPainter *p, int x, int y, int w, int h );
00203 virtual QSize indicatorSize() const;
00210 virtual void drawIndicator( QPainter* p, int x, int y, int w, int h,
00211 const QColorGroup &g, int state,
00212 bool down = FALSE, bool enabled = TRUE );
00216 virtual void drawComboButton( QPainter *p, int x, int y, int w, int h,
00217 const QColorGroup &g, bool sunken = FALSE,
00218 bool editable = FALSE, bool enabled = TRUE,
00219 const QBrush *fill = 0 );
00223 virtual void drawPushButton( QPushButton* btn, QPainter *p );
00228 virtual void getButtonShift( int &x, int &y );
00232 virtual int defaultFrameWidth() const;
00237 virtual void scrollBarMetrics( const QScrollBar*, int&, int&, int&, int& );
00241 virtual void drawScrollBarControls( QPainter*, const QScrollBar*,
00242 int sliderStart, uint controls,
00243 uint activeControl );
00248 virtual ScrollControl scrollBarPointOver( const QScrollBar*,
00249 int sliderStart, const QPoint& );
00253 virtual int sliderLength() const;
00257 virtual void drawSlider( QPainter *p, int x, int y, int w, int h,
00258 const QColorGroup &g, Orientation, bool tickAbove,
00259 bool tickBelow );
00263 void drawSliderGroove( QPainter *p, int x, int y, int w, int h,
00264 const QColorGroup& g, QCOORD c,
00265 Orientation );
00269 virtual void drawSliderMask( QPainter *p, int x, int y, int w, int h,
00270 Orientation, bool tickAbove, bool tickBelow );
00271
00272
00287 virtual void drawScrollBarGroove( QPainter *p, const QScrollBar *sb,
00288 bool horizontal, QRect r, QColorGroup g );
00300 virtual void drawShade( QPainter *p, int x, int y, int w, int h,
00301 const QColorGroup &g, bool sunken, bool rounded,
00302 int hWidth, int bWidth, ShadeStyle style );
00306 virtual void drawPushButtonLabel( QPushButton *btn, QPainter *p );
00310 #if 0
00311
00312 void drawKMenuBar( QPainter *p, int x, int y, int w, int h,
00313 const QColorGroup &g, bool macMode,
00314 QBrush *fill = NULL );
00315 #endif
00316
00319 virtual void drawMenuBarItem( QPainter *p, int x, int y, int w, int h,
00320 QMenuItem *item, const QColorGroup &g,
00321 bool enabled, bool active );
00325 virtual int splitterWidth() const;
00329 virtual void drawSplitter( QPainter *p, int x, int y, int w, int h,
00330 const QColorGroup &g, Orientation );
00334 virtual void drawCheckMark( QPainter *p, int x, int y, int w, int h,
00335 const QColorGroup &g, bool act, bool dis );
00342 virtual void drawPopupMenuItem( QPainter *p, bool checkable, int maxpmw,
00343 int tab, QMenuItem *mi, const QPalette &pal,
00344 bool act, bool enabled, int x, int y, int w,
00345 int h );
00346 int popupMenuItemHeight( bool checkable, QMenuItem *mi,
00347 const QFontMetrics &fm );
00351 void drawFocusRect( QPainter *p, const QRect &r, const QColorGroup &g,
00352 const QColor *c = 0, bool atBorder = false );
00356 virtual void drawProgressBar (QPainter *, int , int , int , int , const QColorGroup &, int );
00360
00361 virtual void tabbarMetrics( const QTabBar*, int&, int&, int& );
00362 virtual void drawTab( QPainter*, const QTabBar*, QTab*, bool selected );
00363 virtual void drawTabMask( QPainter*, const QTabBar*, QTab*, bool selected );
00364 protected:
00365 QPalette oldPalette, popupPalette, indiPalette, exIndiPalette;
00366
00367 class OThemeStylePrivate;
00368 OThemeStylePrivate *d;
00369 };
00370
00371 #endif