diff options
Diffstat (limited to 'src/DrawUtil.hh')
-rw-r--r-- | src/DrawUtil.hh | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/DrawUtil.hh b/src/DrawUtil.hh new file mode 100644 index 0000000..5131c70 --- /dev/null +++ b/src/DrawUtil.hh | |||
@@ -0,0 +1,95 @@ | |||
1 | // DrawUtil.hh for fluxbox | ||
2 | // Copyright (c) 2001-2002 Henrik Kinnunen (fluxgen@linuxmail.org) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | // $Id: DrawUtil.hh,v 1.3 2002/02/17 19:00:14 fluxgen Exp $ | ||
23 | |||
24 | #ifndef DRAWUTIL_HH | ||
25 | #define DRAWUTIL_HH | ||
26 | |||
27 | #include <X11/Xlib.h> | ||
28 | |||
29 | struct DrawUtil | ||
30 | { | ||
31 | struct Font | ||
32 | { | ||
33 | enum FontJustify {LEFT=0, RIGHT, CENTER}; | ||
34 | |||
35 | XFontSet set; | ||
36 | XFontSetExtents *set_extents; | ||
37 | XFontStruct *fontstruct; | ||
38 | FontJustify justify; | ||
39 | }; | ||
40 | |||
41 | static void DrawString(Display *display, Window w, GC gc, DrawUtil::Font *font, | ||
42 | unsigned int text_w, unsigned int size_w, | ||
43 | unsigned int bevel_w, char *text); | ||
44 | |||
45 | // ---------------------------------------------------------------------- | ||
46 | // xvertext, Copyright (c) 1992 Alan Richardson (mppa3@uk.ac.sussex.syma) | ||
47 | // ---------------------------------------------------------------------- | ||
48 | |||
49 | /* *** The font structures *** */ | ||
50 | |||
51 | struct BitmapStruct { | ||
52 | int bit_w; | ||
53 | int bit_h; | ||
54 | |||
55 | Pixmap bm; | ||
56 | }; | ||
57 | |||
58 | struct XRotCharStruct { | ||
59 | int ascent; | ||
60 | int descent; | ||
61 | int lbearing; | ||
62 | int rbearing; | ||
63 | int width; | ||
64 | |||
65 | BitmapStruct glyph; | ||
66 | }; | ||
67 | |||
68 | struct XRotFontStruct { | ||
69 | int dir; | ||
70 | int height; | ||
71 | int max_ascent; | ||
72 | int max_descent; | ||
73 | int max_char; | ||
74 | int min_char; | ||
75 | char *name; | ||
76 | |||
77 | XFontStruct *xfontstruct; | ||
78 | |||
79 | DrawUtil::XRotCharStruct per_char[95]; | ||
80 | }; | ||
81 | static unsigned int XRotTextWidth(DrawUtil::XRotFontStruct *rotfont, char *str, int len); | ||
82 | static void XRotDrawString(Display *dpy, DrawUtil::XRotFontStruct *rotfont, Drawable drawable, | ||
83 | GC gc, int x, int y, char *str, int len); | ||
84 | |||
85 | static void DrawRotString(Display *display, Window w, GC gc, DrawUtil::XRotFontStruct *font, | ||
86 | unsigned int align, unsigned int text_w, | ||
87 | unsigned int size_w, unsigned int size_h, | ||
88 | unsigned int bevel_w, char *text); | ||
89 | |||
90 | static DrawUtil::XRotFontStruct *XRotLoadFont(Display *dpy, char *fontname, float angle); | ||
91 | static void XRotUnloadFont(Display *dpy, DrawUtil::XRotFontStruct *rotfont); | ||
92 | |||
93 | }; | ||
94 | |||
95 | #endif //_DRAWUTIL_HH_ | ||