00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FLATSTYLE_H
00022 #define FLATSTYLE_H
00023
00024 #include <qcolor.h>
00025 #include <qwindowsstyle.h>
00026 #include <qpe/styleinterface.h>
00027
00028 class FlatStylePrivate;
00029
00030 class FlatStyle : public QWindowsStyle
00031 {
00032 public:
00033 FlatStyle();
00034 virtual ~FlatStyle();
00035 virtual void polish( QPalette &p );
00036 virtual void polish( QWidget *w );
00037 virtual void unPolish( QWidget *w );
00038
00039 int defaultFrameWidth () const;
00040 void drawItem( QPainter *p, int x, int y, int w, int h,
00041 int flags, const QColorGroup &g, bool enabled,
00042 const QPixmap *pixmap, const QString& text, int len, const QColor* penColor );
00043 void drawPanel ( QPainter * p, int x, int y, int w, int h,
00044 const QColorGroup &, bool sunken=FALSE, int lineWidth = 1, const QBrush * fill = 0 );
00045 void drawButton( QPainter *p, int x, int y, int w, int h,
00046 const QColorGroup &g, bool sunken, const QBrush* fill );
00047 void drawButtonMask ( QPainter * p, int x, int y, int w, int h );
00048 void drawBevelButton( QPainter *p, int x, int y, int w, int h,
00049 const QColorGroup &g, bool sunken=FALSE, const QBrush* fill=0 );
00050 void drawToolButton( QPainter *p, int x, int y, int w, int h,
00051 const QColorGroup &g, bool sunken=FALSE, const QBrush* fill=0 );
00052 void drawPushButton( QPushButton *btn, QPainter *p );
00053 void drawPushButtonLabel( QPushButton *btn, QPainter *p );
00054 QRect comboButtonRect( int x, int y, int w, int h);
00055 QRect comboButtonFocusRect( int x, int y, int w, int h);
00056 void drawComboButton( QPainter *p, int x, int y, int w, int h,
00057 const QColorGroup &g, bool sunken, bool, bool enabled,
00058 const QBrush *fill );
00059 void drawExclusiveIndicator ( QPainter * p, int x, int y, int w, int h,
00060 const QColorGroup & g, bool on, bool down = FALSE, bool enabled = TRUE );
00061 void drawIndicator ( QPainter * p, int x, int y, int w, int h,
00062 const QColorGroup & g, int state, bool down = FALSE, bool enabled = TRUE );
00063 void scrollBarMetrics( const QScrollBar*, int&, int&, int&, int&);
00064 void drawScrollBarControls( QPainter*, const QScrollBar*, int sliderStart, uint controls, uint activeControl );
00065 ScrollControl scrollBarPointOver( const QScrollBar* sb, int sliderStart, const QPoint& p );
00066 void drawRiffles( QPainter* p, int x, int y, int w, int h,
00067 const QColorGroup &g, bool horizontal );
00068 int sliderLength() const;
00069 void drawSlider( QPainter *p, int x, int y, int w, int h,
00070 const QColorGroup &g, Orientation, bool tickAbove, bool tickBelow );
00071 void drawSliderMask( QPainter *p, int x, int y, int w, int h,
00072 Orientation, bool tickAbove, bool tickBelow );
00073 void drawSliderGrooveMask( QPainter *p, int x, int y, int w, int h,
00074 const QColorGroup& , QCOORD c, Orientation orient );
00075 void drawSliderGroove ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, QCOORD c, Orientation );
00076 void drawTab( QPainter *, const QTabBar *, QTab *, bool selected );
00077 void polishPopupMenu ( QPopupMenu * );
00078 int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& );
00079 int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& );
00080 void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi,
00081 const QPalette& pal,
00082 bool act, bool enabled, int x, int y, int w, int h);
00083
00084 int buttonMargin() const;
00085 QSize scrollBarExtent() const;
00086 void getButtonShift( int &x, int &y );
00087
00088 private:
00089 FlatStylePrivate *d;
00090 bool revItem;
00091 bool fillBtnBorder;
00092 QColor btnBg;
00093
00094 #if defined(Q_DISABLE_COPY)
00095 FlatStyle( const FlatStyle & );
00096 FlatStyle& operator=( const FlatStyle & );
00097 #endif
00098 };
00099
00100
00101 class FlatStyleImpl : public StyleInterface
00102 {
00103 public:
00104 FlatStyleImpl();
00105 virtual ~FlatStyleImpl();
00106
00107 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
00108 Q_REFCOUNT
00109
00110 virtual QStyle *style();
00111 virtual QString name() const;
00112
00113 private:
00114 FlatStyle *flat;
00115 };
00116
00117 #endif // FLATSTYLE_H