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

liquid.h

Go to the documentation of this file.
00001 #ifndef LIQUID_STYLE_H
00002 #define LIQUID_STYLE_H
00003 
00004 
00005 #include <qwindowsstyle.h>
00006 #include <qpainter.h>
00007 #include <qdrawutil.h>
00008 #include <qpalette.h>
00009 #include <qwidget.h>
00010 #include <qpushbutton.h>
00011 #include <qscrollbar.h>
00012 #include <qbitmap.h>
00013 #include <qintdict.h>
00014 #include <qstrlist.h>
00015 #include <qobject.h>
00016 #include <limits.h>
00017 
00018 
00019 /*-
00020  * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved.
00021  */
00022 
00023 class QPixmap;
00024 
00025 #define BITMAP_ITEMS 41
00026 #define LIQUID_MENU_CHANGE 667
00027 #define MOSFET_BUTTON_CHANGE 661
00028 
00029 enum BitmapData{RadioOn=0, RadioOff, RadioOnHover, RadioOffHover, VSBSliderTop,
00030 VSBSliderMid, VSBSliderBtm, VSBSliderTopHover, VSBSliderMidHover,
00031 VSBSliderBtmHover, VSBSliderTopBg, VSBSliderMidBg, VSBSliderBtmBg,
00032 HSBSliderTop, HSBSliderMid, HSBSliderBtm, HSBSliderTopHover, HSBSliderMidHover,
00033 HSBSliderBtmHover, HSBSliderTopBg, HSBSliderMidBg,
00034 HSBSliderBtmBg, Tab, TabDown, TabFocus, CB, CBDown, CBHover, CBDownHover,
00035 HSlider, VSlider, HTMLBtnBorder, HTMLBtnBorderDown, HTMLCB, HTMLCBDown,
00036 HTMLCBHover, HTMLCBDownHover, HTMLRadio, HTMLRadioDown, HTMLRadioHover,
00037 HTMLRadioDownHover};
00038 
00039 
00040 class QHeader;
00041 
00042 enum TransType{None=0, StippledBg, StippledBtn, TransStippleBg,
00043     TransStippleBtn, Custom};
00044 
00045 class TransMenuHandler : public QObject
00046 {
00047     Q_OBJECT
00048 public:
00049     TransMenuHandler(QObject *parent);
00050     ~TransMenuHandler(){;}
00051     void reloadSettings();
00052     int transType(){return(type);}
00053     QPixmap *pixmap(WId id){return(pixDict.find(id));}
00054     const QColor& textColor(){return(fgColor);}
00055     const QColor& bgColor(){return(color);}
00056     bool useShadowText(){return(shadowText);}
00057 protected:
00058     bool eventFilter(QObject *obj, QEvent *ev);
00059     void stripePixmap(QPixmap &pix, const QColor &color);
00060 
00061     QColor color, fgColor;
00062     int opacity;
00063     int type;
00064     bool shadowText;
00065     QIntDict<QPixmap>pixDict;
00066 };
00067 
00068 class LiquidStyle : public QWindowsStyle
00069 {
00070     friend class TransMenuHandler;
00071 public:
00072     LiquidStyle();
00073     ~LiquidStyle();
00074     virtual void polish(QWidget *w);
00075     virtual void unPolish(QWidget *w);
00076     virtual void polish(QApplication *a);
00077     virtual void unPolish(QApplication *a);
00078     virtual void polish(QPalette &p);
00079     void drawButton(QPainter *p, int x, int y, int w, int h,
00080                     const QColorGroup &g, bool sunken = FALSE,
00081                     const QBrush *fill = 0 );
00082     void drawButtonMask(QPainter *p, int x, int y, int w, int h);
00083     void drawComboButtonMask(QPainter *p, int x, int y, int w, int h);
00084     QRect buttonRect(int x, int y, int w, int h);
00085     void drawBevelButton(QPainter *p, int x, int y, int w, int h,
00086                          const QColorGroup &g, bool sunken = FALSE,
00087                          const QBrush *fill = 0 );
00088     void drawPushButton(QPushButton *btn, QPainter *p);
00089     virtual void drawPushButtonLabel (QPushButton *btn, QPainter *p);
00090     void drawScrollBarControls(QPainter*,  const QScrollBar*, int sliderStart,
00091                                uint controls, uint activeControl );
00092     QStyle::ScrollControl scrollBarPointOver(const QScrollBar *sb,
00093                                              int sliderStart, const QPoint &p);
00094     void scrollBarMetrics(const QScrollBar *sb, int &sliderMin, int &sliderMax,
00095                           int &sliderLength, int &buttonDim);
00096     QSize indicatorSize() const;
00097     void drawIndicator(QPainter* p, int x, int y, int w, int h,
00098                        const QColorGroup &g, int state, bool down = FALSE,
00099                        bool enabled = TRUE );
00100     void drawIndicatorMask(QPainter *p, int x, int y, int w, int h, int);
00101     QSize exclusiveIndicatorSize() const;
00102     void drawExclusiveIndicator(QPainter* p,  int x, int y, int w, int h,
00103                                 const QColorGroup &g, bool on,
00104                                 bool down = FALSE, bool enabled =  TRUE );
00105     void drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w,
00106                                     int h, bool);
00107     void drawComboButton(QPainter *p, int x, int y, int w, int h,
00108                          const QColorGroup &g, bool sunken = FALSE,
00109                          bool editable = FALSE, bool enabled = TRUE,
00110                          const QBrush *fill = 0 );
00111     QRect comboButtonRect(int x, int y, int w, int h);
00112     QRect comboButtonFocusRect(int x, int y, int w, int h);
00113     int sliderLength() const;
00114     void drawArrow(QPainter *p, Qt::ArrowType type, bool down,
00115                    int x, int y, int w, int h, const QColorGroup &g,
00116                    bool enabled=true, const QBrush *fill = 0);
00117     void drawSlider(QPainter *p, int x, int y, int w, int h,
00118                     const QColorGroup &g, Orientation orient,
00119                     bool tickAbove, bool tickBelow);
00120     void drawSliderMask(QPainter *p, int x, int y, int w, int h,
00121                         Orientation orient, bool, bool);
00122         void drawMenuBarItem(QPainter *p, int x, int y, int w, int h,
00123                             QMenuItem *mi, QColorGroup &g, bool enabled, bool active );
00124 
00125     void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw,
00126                            int tab, QMenuItem *mi, const QPalette &pal,
00127                            bool act, bool enabled, int x, int y, int w,
00128                            int h);
00129     int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm);
00130     void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g,
00131                        const QColor *pen, bool atBorder);
00132     int defaultFrameWidth() const {return(2);}
00133     void polishPopupMenu(QPopupMenu *mnu);
00134     void drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab,
00135                  bool selected);
00136     void drawTabMask( QPainter*, const QTabBar*, QTab*, bool selected );
00137     void tabbarMetrics(const QTabBar *t, int &hFrame, int &vFrame,
00138                        int &overlap);
00139 
00140     void drawSplitter(QPainter *p, int x, int y, int w, int h,
00141                       const QColorGroup &g, Orientation orient);
00142     int splitterWidth() const {return(6);}
00143     void drawPanel(QPainter *p, int x, int y, int w, int h,
00144                    const QColorGroup &g, bool sunken, int lineWidth,
00145                    const QBrush *fill);
00146     void drawToolButton(QPainter *p, int x, int y, int w,
00147                         int h, const QColorGroup &g,
00148                         bool sunken, const QBrush *fill);
00149     // for repainting toolbuttons when the toolbar is resized
00150     bool eventFilter(QObject *obj, QEvent *ev);
00151     void drawSliderGroove(QPainter * p, int x, int y, int w,  int h,
00152                           const QColorGroup &g, QCOORD c, Orientation);
00153     void drawSliderGrooveMask(QPainter * p, int x, int y, int w, int h,
00154                               QCOORD c, Orientation);
00155     int buttonDefaultIndicatorWidth() const {return(2);}
00156     void drawPopupPanel(QPainter *p, int x, int y, int w, int h,
00157                         const QColorGroup &g, int lineWidth,
00158                         const QBrush * fill);
00159 protected:
00160     void adjustHSV(QPixmap &pix, int h, int s, int v);
00161     void intensity(QPixmap &pix, float percent);
00162 
00163     void drawRoundButton(QPainter *p, const QColor &c, const QColor &bg, int x,
00164                          int y, int w, int h, bool  supportPushDown = false,
00165                          bool pushedDown = false, bool autoDefault = false,
00166                          bool isMasked = false);
00167     void drawClearBevel(QPainter *p, int x, int y, int w, int h,
00168                         const QColor &c, const QColor &bg);
00169     void drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g,
00170                    bool horiz);
00171     void drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g,
00172                       bool down=false, bool fast = true);
00173     void drawRoundRect(QPainter *p, int x, int y, int w, int h);
00174     QPixmap* getPixmap(BitmapData item);
00175     QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false);
00176 private:
00177         bool flatTBButtons;
00178     QWidget *highlightWidget;
00179     QBitmap btnMaskBmp, htmlBtnMaskBmp;
00180     QPixmap *btnBorderPix, *btnBlendPix, *bevelFillPix, *smallBevelFillPix, *menuPix;
00181     QBrush bgBrush, menuBrush;
00182     bool menuAni, menuFade;
00183 
00184     QIntDict<QPixmap>btnDict;
00185     QIntDict<QPixmap>btnBorderDict;
00186     QIntDict<QPixmap>bevelFillDict;
00187     QIntDict<QPixmap>smallBevelFillDict;
00188 
00189     QPixmap *vsbSliderFillPix;
00190     TransMenuHandler *menuHandler;
00191     QPixmap *pixmaps[BITMAP_ITEMS];
00192     QPixmap sbBuffer;
00193     int oldSliderThickness;
00194     int lowLightVal;
00195     QHeader *currentHeader;
00196     int headerHoverID;
00197     QWMatrix rMatrix;
00198     int bH, bS, bV;
00199     int bHoverH, bHoverS, bHoverV;
00200     int btnH, btnS, btnV;
00201     int btnHoverH, btnHoverS, btnHoverV;
00202 };
00203 
00204 #endif

Generated on Sat Nov 5 16:17:18 2005 for OPIE by  doxygen 1.4.2