104
110
virtual int height() const { return ascent() + descent(); }
105
111
virtual int descent() const = 0;
106
112
virtual int ascent() const = 0;
113
virtual int textWidth(const ustring &s) const = 0;
107
114
virtual int textWidth(char const * str, int len) const = 0;
109
116
virtual void drawGlyphs(class Graphics & graphics, int x, int y,
112
119
int textWidth(char const * str) const;
113
120
int multilineTabPos(char const * str) const;
114
121
YDimension multilineAlloc(char const * str) const;
116
static char * getNameElement(char const * pattern, unsigned const element);
119
/******************************************************************************/
120
/******************************************************************************/
122
class YPixmap: public virtual refcounted {
124
// YPixmap(YPixmap const &pixmap);
125
#ifdef CONFIG_ANTIALIASING
126
YPixmap(YPixbuf & pixbuf);
129
YPixmap(char const * fileName);
131
YPixmap(char const * fileName, int w, int h);
133
YPixmap(int w, int h, bool mask = false);
134
YPixmap(Pixmap pixmap, Pixmap mask, int w, int h);
136
YPixmap(Pixmap pixmap, Pixmap mask, int w, int h, int wScaled, int hScaled);
137
void scaleImage(Pixmap pixmap, Pixmap mask, int x, int y, int w, int h, int nw, int nh);
142
YPixmap(const ref<YPixmap> &pixmap, int newWidth, int newHeight);
144
static ref<YPixmap> scale(ref<YPixmap> source, int const width, int const height);
146
Pixmap pixmap() const { return fPixmap; }
147
Pixmap mask() const { return fMask; }
148
int width() const { return fWidth; }
149
int height() const { return fHeight; }
151
bool valid() const { return (fPixmap != None); }
153
void replicate(bool horiz, bool copyMask);
155
static Pixmap createPixmap(int w, int h);
156
static Pixmap createPixmap(int w, int h, int depth);
157
static Pixmap createMask(int w, int h);
162
unsigned int fWidth, fHeight;
122
YDimension multilineAlloc(const ustring &str) const;
125
/******************************************************************************/
126
/******************************************************************************/
166
128
struct YSurface {
167
129
#ifdef CONFIG_GRADIENTS
168
130
YSurface(class YColor * color, ref<YPixmap> pixmap,
169
ref<YPixbuf> gradient):
131
ref<YImage> gradient):
170
132
color(color), pixmap(pixmap), gradient(gradient) {}
172
134
YSurface(class YColor * color, ref<YPixmap> pixmap):
199
155
const int dx, const int dy);
200
156
void copyDrawable(const Drawable d, const int x, const int y,
201
157
const int w, const int h, const int dx, const int dy);
202
159
void copyImage(XImage * im, const int x, const int y,
203
160
const int w, const int h, const int dx, const int dy);
204
161
void copyImage(XImage * im, const int x, const int y) {
205
162
copyImage(im, 0, 0, im->width, im->height, x, y);
207
165
void copyPixmap(const ref<YPixmap> &p, const int x, const int y,
208
const int w, const int h, const int dx, const int dy)
166
const int w, const int h, const int dx, const int dy)
211
169
copyDrawable(p->pixmap(), x, y, w, h, dx, dy);
213
172
#ifdef CONFIG_ANTIALIASING
214
173
void copyPixbuf(class YPixbuf & pixbuf, const int x, const int y,
215
174
const int w, const int h, const int dx, const int dy,
217
176
void copyAlphaMask(class YPixbuf & pixbuf, const int x, const int y,
218
177
const int w, const int h, const int dx, const int dy);
221
181
void drawPoint(int x, int y);
222
182
void drawLine(int x1, int y1, int x2, int y2);
227
187
void drawArc(int x, int y, int width, int height, int a1, int a2);
228
188
void drawArrow(YDirection direction, int x, int y, int size, bool pressed = false);
190
void drawChars(const ustring &s, int x, int y);
230
191
void drawChars(char const * data, int offset, int len, int x, int y);
231
192
void drawCharUnderline(int x, int y, char const * str, int charPos);
194
void drawCharUnderline(int x, int y, const ustring &str, int charPos);
233
196
void drawString(int x, int y, char const * str);
234
197
void drawStringEllipsis(int x, int y, char const * str, int maxWidth);
198
void drawStringEllipsis(int x, int y, const ustring &str, int maxWidth);
235
199
void drawStringMultiline(int x, int y, char const * str);
200
void drawStringMultiline(int x, int y, const ustring &str);
237
void drawImage(const ref<YIconImage> &img, int const x, int const y);
238
202
void drawPixmap(const ref<YPixmap> &pix, int const x, int const y);
203
void drawImage(const ref<YImage> &pix, int const x, int const y);
204
void drawImage(const ref<YImage> &pix, int const x, int const y, int w, int h, int dx, int dy);
205
void compositeImage(const ref<YImage> &pix, int const x, int const y, int w, int h, int dx, int dy);
239
206
void drawMask(const ref<YPixmap> &pix, int const x, int const y);
240
207
void drawClippedPixmap(Pixmap pix, Pixmap clip,
241
208
int x, int y, int w, int h, int toX, int toY);
252
219
void setLineWidth(int width);
253
220
void setPenStyle(bool dotLine = false); ///!!!hack
254
221
void setFunction(int function = GXcopy);
256
223
void draw3DRect(int x, int y, int w, int h, bool raised);
257
224
void drawBorderW(int x, int y, int w, int h, bool raised);
258
225
void drawBorderM(int x, int y, int w, int h, bool raised);
273
240
#ifdef CONFIG_GRADIENTS
274
void drawGradient(const ref<YPixbuf> &pixbuf,
241
void drawGradient(const ref<YImage> &gradient,
275
242
int const x, int const y, const int w, const int h,
276
243
int const gx, int const gy, const int gw, const int gh);
277
void drawGradient(const ref<YPixbuf> &pixbuf,
244
void drawGradient(const ref<YImage> &gradient,
278
245
int const x, int const y, const int w, const int h) {
279
drawGradient(pixbuf, x, y, w, h, 0, 0, w, h);
246
drawGradient(gradient, x, y, w, h, 0, 0, w, h);