18 #include "kdrawutil.h"
19 #include <tqdrawutil.h>
22 const TQColorGroup &g,
bool sunken,
25 TQPen oldPen = p->pen();
28 p->fillRect(x+1, y+1, w-2, h-2,
29 fill ? *fill : g.brush(TQColorGroup::Button));
30 p->setPen(sunken ? TQt::black : g.light());
31 p->drawLine(x, y, x2-1, y);
32 p->drawLine(x, y, x, y2-1);
33 p->setPen(sunken ? g.midlight() : g.mid());
34 p->drawLine(x+1, y2-1, x2-1, y2-1);
35 p->drawLine(x2-1, y+1, x2-1, y2-1);
36 p->setPen(sunken ? g.light() : TQt::black);
37 p->drawLine(x, y2, x2, y2);
38 p->drawLine(x2, y, x2, y2);
43 TDEFX_EXPORT
void kDrawNextButton(TQPainter *p,
const TQRect &r,
const TQColorGroup &g,
44 bool sunken,
const TQBrush *fill)
46 kDrawNextButton(p, r.x(), r.y(), r.width(), r.height(), g, sunken, fill);
49 TDEFX_EXPORT
void kDrawBeButton(TQPainter *p,
int x,
int y,
int w,
int h,
50 const TQColorGroup &g,
bool sunken,
const TQBrush *fill)
52 TQPen oldPen = p->pen();
56 p->drawLine(x+1, y, x2-1, y);
57 p->drawLine(x, y+1, x, y2-1);
58 p->drawLine(x+1, y2, x2-1, y2);
59 p->drawLine(x2, y+1, x2, y2-1);
64 p->drawLine(x+2, y+2, x2-1, y+2);
65 p->drawLine(x+2, y+3, x2-2, y+3);
66 p->drawLine(x+2, y+4, x+2, y2-1);
67 p->drawLine(x+3, y+4, x+3, y2-2);
71 p->drawLine(x+2, y+2, x2-1, y+2);
72 p->drawLine(x+2, y+3, x2-2, y+3);
73 p->drawLine(x+2, y+4, x+2, y2-1);
74 p->drawLine(x+3, y+4, x+3, y2-2);
78 p->setPen(sunken? g.light() : g.mid());
79 p->drawLine(x2-1, y+2, x2-1, y2-1);
80 p->drawLine(x+2, y2-1, x2-1, y2-1);
83 p->drawLine(x+1, y+1, x2-1, y+1);
84 p->drawLine(x+1, y+2, x+1, y2-1);
85 p->drawLine(x2-2, y+3, x2-2, y2-2);
88 p->fillRect(x+4, y+4, w-6, h-6, *fill);
93 TDEFX_EXPORT
void kDrawBeButton(TQPainter *p, TQRect &r,
const TQColorGroup &g,
bool sunken,
96 kDrawBeButton(p, r.x(), r.y(), r.width(), r.height(), g, sunken, fill);
99 TDEFX_EXPORT
void kDrawRoundButton(TQPainter *p,
const TQRect &r,
const TQColorGroup &g,
103 r.coords(&x, &y, &x2, &y2);
104 if(r.width() > 16 && r.height() > 16){
105 TQPen oldPen = p->pen();
106 TQPointArray hPntArray, lPntArray;
107 hPntArray.putPoints(0, 12, x+4,y+1, x+5,y+1,
108 x+3,y+2, x+2,y+3, x+1,y+4, x+1,y+5,
109 x+1,y2-5, x+1,y2-4, x+2,y2-3,
110 x2-5,y+1, x2-4,y+1, x2-3,y+2);
112 lPntArray.putPoints(0, 17, x2-5,y2-1, x2-4,y2-1,
113 x2-3,y2-2, x2-2,y2-3, x2-1,y2-5, x2-1,y2-4,
115 x+3,y2-2, x+4,y2-1, x+5,y2-1,
116 x2-2,y+3, x2-1,y+4, x2-1,y+5,
118 x2-5,y2-2, x2-4,y2-2,
120 x2-2,y2-5, x2-2,y2-4);
122 p->setPen(sunken ? g.dark() : g.light());
123 p->drawLine(x+6, y, x2-6, y);
124 p->drawLine(0, y+6, 0, y2-6);
125 p->drawPoints(hPntArray);
127 p->setPen(sunken ? g.light() : g.dark());
128 p->drawLine(x+6, y2, x2-6, y2);
129 p->drawLine(x+6, y2-1, x2-6, y2-1);
130 p->drawLine(x2, y+6, x2, y2-6);
131 p->drawLine(x2-1, y+6, x2-1, y2-6);
132 p->drawPoints(lPntArray);
136 qDrawWinPanel(p, x, y, r.width(), r.height(), g, sunken);
140 const TQColorGroup &g,
bool sunken)
142 TQRect r(x, y, w, h);
146 #define QCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2)
148 TDEFX_EXPORT
void kDrawRoundMask(TQPainter *p,
int x,
int y,
int w,
int h,
bool clear)
151 static const TQCOORD btm_left_fill[]={ 0,0,1,0,2,0,3,0,4,0,0,1,1,1,2,1,3,1,4,1,
152 1,2,2,2,3,2,4,2,2,3,3,3,4,3,3,4,4,4 };
154 static const TQCOORD btm_right_fill[]={ 0,0,1,0,2,0,3,0,4,0,0,1,1,1,2,1,3,1,4,
155 1,0,2,1,2,2,2,3,2,0,3,1,3,2,3,0,4,1,4 };
157 static const TQCOORD top_left_fill[]={ 3,0,4,0,2,1,3,1,4,1,1,2,2,2,3,2,4,2,0,3,
158 1,3,2,3,3,3,4,3,0,4,1,4,2,4,3,4,4,4 };
160 static const TQCOORD top_right_fill[]={ 0,0,1,0,0,1,1,1,2,1,0,2,1,2,2,2,3,2,0,
161 3,1,3,2,3,3,3,4,3,0,4,1,4,2,4,3,4,4,4 };
164 p->fillRect(x, y, w, h, TQBrush(TQt::color0, TQt::SolidPattern));
166 TQBrush fillBrush(TQt::color1, TQt::SolidPattern);
167 p->setPen(TQt::color1);
168 if(w > 16 && h > 16){
171 TQPointArray a(QCOORDARRLEN(top_left_fill), top_left_fill);
174 a.setPoints(QCOORDARRLEN(btm_left_fill), btm_left_fill);
177 a.setPoints(QCOORDARRLEN(top_right_fill), top_right_fill);
180 a.setPoints(QCOORDARRLEN(btm_right_fill), btm_right_fill);
181 a.translate(w-6, h-6);
184 p->fillRect(x+6, y, w-12, h, fillBrush);
185 p->fillRect(x, y+6, x+6, h-12, fillBrush);
186 p->fillRect(x2-6, y+6, x2, h-12, fillBrush);
187 p->drawLine(x+6, y, x2-6, y);
188 p->drawLine(x+6, y2, x2-6, y2);
189 p->drawLine(x, y+6, x, y2-6);
190 p->drawLine(x2, y+6, x2, y2-6);
194 p->fillRect(x, y, w, h, fillBrush);
201 r += TQRect(x+6, y+0, w-12, h);
202 r += TQRect(x+5, y+1, 1, h-2);
203 r += TQRect(x+4, y+1, 1, h-2);
204 r += TQRect(x+3, y+2, 1, h-4);
205 r += TQRect(x+2, y+3, 1, h-6);
206 r += TQRect(x+1, y+4, 1, h-8);
207 r += TQRect(x, y+6, 1, h-12);
209 r += TQRect(x2-5, y+1, 1, h-2);
210 r += TQRect(x2-4, y+1, 1, h-2);
211 r += TQRect(x2-3, y+2, 1, h-4);
212 r += TQRect(x2-2, y+3, 1, h-6);
213 r += TQRect(x2-1, y+4, 1, h-8);
214 r += TQRect(x2, y+6, 1, h-12);
217 TDEFX_EXPORT
void kColorBitmaps(TQPainter *p,
const TQColorGroup &g,
int x,
int y,
218 TQBitmap *lightColor, TQBitmap *midColor,
219 TQBitmap *midlightColor, TQBitmap *darkColor,
220 TQBitmap *blackColor, TQBitmap *whiteColor)
222 TQBitmap *bitmaps[]={lightColor, midColor, midlightColor, darkColor,
223 blackColor, whiteColor};
225 TQColor colors[]={g.light(), g.mid(), g.midlight(), g.dark(),
226 TQt::black, TQt::white};
229 for(i=0; i < 6; ++i){
231 if(!bitmaps[i]->mask())
232 bitmaps[i]->setMask(*bitmaps[i]);
233 p->setPen(colors[i]);
234 p->drawPixmap(x, y, *bitmaps[i]);
239 TDEFX_EXPORT
void kColorBitmaps(TQPainter *p,
const TQColorGroup &g,
int x,
int y,
int w,
240 int h,
bool isXBitmaps,
const uchar *lightColor,
241 const uchar *midColor,
const uchar *midlightColor,
242 const uchar *darkColor,
const uchar *blackColor,
243 const uchar *whiteColor)
245 const uchar *data[]={lightColor, midColor, midlightColor, darkColor,
246 blackColor, whiteColor};
248 TQColor colors[]={g.light(), g.mid(), g.midlight(), g.dark(),
249 TQt::black, TQt::white};
253 for(i=0; i < 6; ++i){
255 b = TQBitmap(w, h, data[i], isXBitmaps);
257 p->setPen(colors[i]);
258 p->drawPixmap(x, y, b);
TDEFX_EXPORT void kRoundMaskRegion(TQRegion &r, int x, int y, int w, int h)
#include <kdrawutil.h>
TDEFX_EXPORT void kDrawRoundButton(TQPainter *p, const TQRect &r, const TQColorGroup &g, bool sunken=false)
#include <kdrawutil.h>
TDEFX_EXPORT void kDrawRoundMask(TQPainter *p, int x, int y, int w, int h, bool clear=false)
#include <kdrawutil.h>
TDEFX_EXPORT void kDrawNextButton(TQPainter *p, const TQRect &r, const TQColorGroup &g, bool sunken=false, const TQBrush *fill=0)
#include <kdrawutil.h>
TDEFX_EXPORT void kColorBitmaps(TQPainter *p, const TQColorGroup &g, int x, int y, TQBitmap *lightColor=0, TQBitmap *midColor=0, TQBitmap *midlightColor=0, TQBitmap *darkColor=0, TQBitmap *blackColor=0, TQBitmap *whiteColor=0)
#include <kdrawutil.h>
TDEFX_EXPORT void kDrawBeButton(TQPainter *p, TQRect &r, const TQColorGroup &g, bool sunken=false, const TQBrush *fill=0)
#include <kdrawutil.h>