author | sandman <sandman> | 2002-06-24 17:07:45 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-06-24 17:07:45 (UTC) |
commit | f284f40fe5912736666a56143705f260d14feb34 (patch) (unidiff) | |
tree | 2aa6dee5e26aaeffc3505ca0c536651bce09cfe6 /noncore/styles/liquid/liquid.h | |
parent | db5385bc16f56b4c5b84ad4a92ac6bdd46eea321 (diff) | |
download | opie-f284f40fe5912736666a56143705f260d14feb34.zip opie-f284f40fe5912736666a56143705f260d14feb34.tar.gz opie-f284f40fe5912736666a56143705f260d14feb34.tar.bz2 |
Inital checkin of liquid style for OPIE
Diffstat (limited to 'noncore/styles/liquid/liquid.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/styles/liquid/liquid.h | 218 |
1 files changed, 218 insertions, 0 deletions
diff --git a/noncore/styles/liquid/liquid.h b/noncore/styles/liquid/liquid.h new file mode 100644 index 0000000..fb691ea --- a/dev/null +++ b/noncore/styles/liquid/liquid.h | |||
@@ -0,0 +1,218 @@ | |||
1 | #ifndef LIQUID_STYLE_H | ||
2 | #define LIQUID_STYLE_H | ||
3 | |||
4 | |||
5 | #include <qwindowsstyle.h> | ||
6 | #include <qpainter.h> | ||
7 | #include <qdrawutil.h> | ||
8 | #include <qpalette.h> | ||
9 | #include <qwidget.h> | ||
10 | #include <qpushbutton.h> | ||
11 | #include <qscrollbar.h> | ||
12 | #include <qbitmap.h> | ||
13 | #include <qintdict.h> | ||
14 | #include <qstrlist.h> | ||
15 | #include <qobject.h> | ||
16 | #include <limits.h> | ||
17 | |||
18 | |||
19 | /*- | ||
20 | * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. | ||
21 | */ | ||
22 | |||
23 | class QPixmap; | ||
24 | |||
25 | #define BITMAP_ITEMS 41 | ||
26 | #define LIQUID_MENU_CHANGE 667 | ||
27 | #define MOSFET_BUTTON_CHANGE 661 | ||
28 | |||
29 | enum BitmapData{RadioOn=0, RadioOff, RadioOnHover, RadioOffHover, VSBSliderTop, | ||
30 | VSBSliderMid, VSBSliderBtm, VSBSliderTopHover, VSBSliderMidHover, | ||
31 | VSBSliderBtmHover, VSBSliderTopBg, VSBSliderMidBg, VSBSliderBtmBg, | ||
32 | HSBSliderTop, HSBSliderMid, HSBSliderBtm, HSBSliderTopHover, HSBSliderMidHover, | ||
33 | HSBSliderBtmHover, HSBSliderTopBg, HSBSliderMidBg, | ||
34 | HSBSliderBtmBg, Tab, TabDown, TabFocus, CB, CBDown, CBHover, CBDownHover, | ||
35 | HSlider, VSlider, HTMLBtnBorder, HTMLBtnBorderDown, HTMLCB, HTMLCBDown, | ||
36 | HTMLCBHover, HTMLCBDownHover, HTMLRadio, HTMLRadioDown, HTMLRadioHover, | ||
37 | HTMLRadioDownHover}; | ||
38 | |||
39 | |||
40 | class QHeader; | ||
41 | |||
42 | enum TransType{None=0, StippledBg, StippledBtn, TransStippleBg, | ||
43 | TransStippleBtn, Custom}; | ||
44 | |||
45 | class TransMenuHandler : public QObject | ||
46 | { | ||
47 | Q_OBJECT | ||
48 | public: | ||
49 | TransMenuHandler(QObject *parent); | ||
50 | ~TransMenuHandler(){;} | ||
51 | void reloadSettings(); | ||
52 | int transType(){return(type);} | ||
53 | QPixmap *pixmap(WId id){return(pixDict.find(id));} | ||
54 | const QColor& textColor(){return(fgColor);} | ||
55 | const QColor& bgColor(){return(color);} | ||
56 | bool useShadowText(){return(shadowText);} | ||
57 | protected: | ||
58 | bool eventFilter(QObject *obj, QEvent *ev); | ||
59 | void stripePixmap(QPixmap &pix, const QColor &color); | ||
60 | |||
61 | QColor color, fgColor; | ||
62 | int opacity; | ||
63 | int type; | ||
64 | bool shadowText; | ||
65 | QIntDict<QPixmap>pixDict; | ||
66 | }; | ||
67 | |||
68 | class LiquidStyle : public QWindowsStyle | ||
69 | { | ||
70 | friend class TransMenuHandler; | ||
71 | public: | ||
72 | LiquidStyle(); | ||
73 | ~LiquidStyle(); | ||
74 | virtual void polish(QWidget *w); | ||
75 | virtual void unPolish(QWidget *w); | ||
76 | virtual void polish(QApplication *a); | ||
77 | virtual void unPolish(QApplication *a); | ||
78 | virtual void polish(QPalette &p); | ||
79 | void drawButton(QPainter *p, int x, int y, int w, int h, | ||
80 | const QColorGroup &g, bool sunken = FALSE, | ||
81 | const QBrush *fill = 0 ); | ||
82 | void drawButtonMask(QPainter *p, int x, int y, int w, int h); | ||
83 | void drawComboButtonMask(QPainter *p, int x, int y, int w, int h); | ||
84 | QRect buttonRect(int x, int y, int w, int h); | ||
85 | void drawBevelButton(QPainter *p, int x, int y, int w, int h, | ||
86 | const QColorGroup &g, bool sunken = FALSE, | ||
87 | const QBrush *fill = 0 ); | ||
88 | void drawPushButton(QPushButton *btn, QPainter *p); | ||
89 | virtual void drawPushButtonLabel (QPushButton *btn, QPainter *p); | ||
90 | void drawScrollBarControls(QPainter*, const QScrollBar*, int sliderStart, | ||
91 | uint controls, uint activeControl ); | ||
92 | QStyle::ScrollControl scrollBarPointOver(const QScrollBar *sb, | ||
93 | int sliderStart, const QPoint &p); | ||
94 | void scrollBarMetrics(const QScrollBar *sb, int &sliderMin, int &sliderMax, | ||
95 | int &sliderLength, int &buttonDim); | ||
96 | QSize indicatorSize() const; | ||
97 | void drawIndicator(QPainter* p, int x, int y, int w, int h, | ||
98 | const QColorGroup &g, int state, bool down = FALSE, | ||
99 | bool enabled = TRUE ); | ||
100 | void drawIndicatorMask(QPainter *p, int x, int y, int w, int h, int); | ||
101 | QSize exclusiveIndicatorSize() const; | ||
102 | void drawExclusiveIndicator(QPainter* p, int x, int y, int w, int h, | ||
103 | const QColorGroup &g, bool on, | ||
104 | bool down = FALSE, bool enabled = TRUE ); | ||
105 | void drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w, | ||
106 | int h, bool); | ||
107 | void drawComboButton(QPainter *p, int x, int y, int w, int h, | ||
108 | const QColorGroup &g, bool sunken = FALSE, | ||
109 | bool editable = FALSE, bool enabled = TRUE, | ||
110 | const QBrush *fill = 0 ); | ||
111 | QRect comboButtonRect(int x, int y, int w, int h); | ||
112 | QRect comboButtonFocusRect(int x, int y, int w, int h); | ||
113 | int sliderLength() const; | ||
114 | void drawArrow(QPainter *p, Qt::ArrowType type, bool down, | ||
115 | int x, int y, int w, int h, const QColorGroup &g, | ||
116 | bool enabled=true, const QBrush *fill = 0); | ||
117 | void drawSlider(QPainter *p, int x, int y, int w, int h, | ||
118 | const QColorGroup &g, Orientation orient, | ||
119 | bool tickAbove, bool tickBelow); | ||
120 | void drawSliderMask(QPainter *p, int x, int y, int w, int h, | ||
121 | Orientation orient, bool, bool); | ||
122 | void drawMenuBarItem(QPainter *p, int x, int y, int w, int h, | ||
123 | QMenuItem *mi, QColorGroup &g, bool enabled, bool active ); | ||
124 | |||
125 | void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw, | ||
126 | int tab, QMenuItem *mi, const QPalette &pal, | ||
127 | bool act, bool enabled, int x, int y, int w, | ||
128 | int h); | ||
129 | int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm); | ||
130 | void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, | ||
131 | const QColor *pen, bool atBorder); | ||
132 | int defaultFrameWidth() const {return(2);} | ||
133 | void polishPopupMenu(QPopupMenu *mnu); | ||
134 | void drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, | ||
135 | bool selected); | ||
136 | void drawTabMask( QPainter*, const QTabBar*, QTab*, bool selected ); | ||
137 | void tabbarMetrics(const QTabBar *t, int &hFrame, int &vFrame, | ||
138 | int &overlap); | ||
139 | |||
140 | void drawSplitter(QPainter *p, int x, int y, int w, int h, | ||
141 | const QColorGroup &g, Orientation orient); | ||
142 | int splitterWidth() const {return(6);} | ||
143 | void drawPanel(QPainter *p, int x, int y, int w, int h, | ||
144 | const QColorGroup &g, bool sunken, int lineWidth, | ||
145 | const QBrush *fill); | ||
146 | void drawToolButton(QPainter *p, int x, int y, int w, | ||
147 | int h, const QColorGroup &g, | ||
148 | bool sunken, const QBrush *fill); | ||
149 | // for repainting toolbuttons when the toolbar is resized | ||
150 | bool eventFilter(QObject *obj, QEvent *ev); | ||
151 | void drawSliderGroove(QPainter * p, int x, int y, int w, int h, | ||
152 | const QColorGroup &g, QCOORD c, Orientation); | ||
153 | void drawSliderGrooveMask(QPainter * p, int x, int y, int w, int h, | ||
154 | QCOORD c, Orientation); | ||
155 | int buttonDefaultIndicatorWidth() const {return(2);} | ||
156 | void drawPopupPanel(QPainter *p, int x, int y, int w, int h, | ||
157 | const QColorGroup &g, int lineWidth, | ||
158 | const QBrush * fill); | ||
159 | protected: | ||
160 | void adjustHSV(QPixmap &pix, int h, int s, int v); | ||
161 | void intensity(QPixmap &pix, float percent); | ||
162 | |||
163 | void drawRoundButton(QPainter *p, const QColor &c, const QColor &bg, int x, | ||
164 | int y, int w, int h, bool supportPushDown = false, | ||
165 | bool pushedDown = false, bool autoDefault = false, | ||
166 | bool isMasked = false); | ||
167 | void drawClearBevel(QPainter *p, int x, int y, int w, int h, | ||
168 | const QColor &c, const QColor &bg); | ||
169 | void drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g, | ||
170 | bool horiz); | ||
171 | void drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, | ||
172 | bool down=false, bool fast = true); | ||
173 | void drawRoundRect(QPainter *p, int x, int y, int w, int h); | ||
174 | void loadCustomButtons(); | ||
175 | void applyCustomAttributes(QPushButton *btn); | ||
176 | void unapplyCustomAttributes(QPushButton *btn); | ||
177 | QPixmap* getPixmap(BitmapData item); | ||
178 | QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); | ||
179 | private: | ||
180 | bool highcolor; | ||
181 | QColorGroup radioOnGrp; | ||
182 | QWidget *highlightWidget; | ||
183 | QBrush wallpaper; | ||
184 | QBitmap lightBmp; | ||
185 | QBitmap grayBmp; | ||
186 | QBitmap dgrayBmp; | ||
187 | QBitmap maskBmp; | ||
188 | QBitmap xBmp; | ||
189 | QBitmap btnMaskBmp, htmlBtnMaskBmp; | ||
190 | QPixmap *btnBorderPix, *btnBlendPix, *bevelFillPix, *smallBevelFillPix, *menuPix; | ||
191 | QBitmap paper1, paper2, paper3; | ||
192 | QBrush baseBrush, menuBrush, pagerBrush, pagerHoverBrush, bgBrush; | ||
193 | bool menuAni, menuFade; | ||
194 | |||
195 | QIntDict<QPixmap>btnDict; | ||
196 | QIntDict<QPixmap>btnBorderDict; | ||
197 | QIntDict<QPixmap>bevelFillDict; | ||
198 | QIntDict<QPixmap>smallBevelFillDict; | ||
199 | |||
200 | QList<QColor>customBtnColorList; | ||
201 | QList<QPixmap>customBtnIconList; | ||
202 | QStrList customBtnLabelList; | ||
203 | QPixmap *vsbSliderFillPix; | ||
204 | TransMenuHandler *menuHandler; | ||
205 | QPixmap *pixmaps[BITMAP_ITEMS]; | ||
206 | QPixmap sbBuffer; | ||
207 | int oldSliderThickness; | ||
208 | int lowLightVal; | ||
209 | QHeader *currentHeader; | ||
210 | int headerHoverID; | ||
211 | QWMatrix rMatrix; | ||
212 | int bH, bS, bV; | ||
213 | int bHoverH, bHoverS, bHoverV; | ||
214 | int btnH, btnS, btnV; | ||
215 | int btnHoverH, btnHoverS, btnHoverV; | ||
216 | }; | ||
217 | |||
218 | #endif | ||