aboutsummaryrefslogtreecommitdiff
path: root/src/DrawUtil.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/DrawUtil.hh')
-rw-r--r--src/DrawUtil.hh92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/DrawUtil.hh b/src/DrawUtil.hh
new file mode 100644
index 0000000..d1ef415
--- /dev/null
+++ b/src/DrawUtil.hh
@@ -0,0 +1,92 @@
1// DrawUtil.hh for fluxbox
2// Copyright (c) 2001 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#ifndef _DRAWUTIL_HH_
22#define _DRAWUTIL_HH_
23
24#include <X11/Xlib.h>
25
26struct DrawUtil
27{
28 struct Font
29 {
30 enum FontJustify {LEFT=0, RIGHT, CENTER};
31
32 XFontSet set;
33 XFontSetExtents *set_extents;
34 XFontStruct *fontstruct;
35 FontJustify justify;
36 };
37
38static void DrawString(Display *display, Window w, GC gc, DrawUtil::Font *font,
39 unsigned int text_w, unsigned int size_w,
40 unsigned int bevel_w, char *text);
41
42// ----------------------------------------------------------------------
43// xvertext, Copyright (c) 1992 Alan Richardson (mppa3@uk.ac.sussex.syma)
44// ----------------------------------------------------------------------
45
46 /* *** The font structures *** */
47
48 struct BitmapStruct {
49 int bit_w;
50 int bit_h;
51
52 Pixmap bm;
53 };
54
55 struct XRotCharStruct {
56 int ascent;
57 int descent;
58 int lbearing;
59 int rbearing;
60 int width;
61
62 BitmapStruct glyph;
63 };
64
65 struct XRotFontStruct {
66 int dir;
67 int height;
68 int max_ascent;
69 int max_descent;
70 int max_char;
71 int min_char;
72 char *name;
73
74 XFontStruct *xfontstruct;
75
76 DrawUtil::XRotCharStruct per_char[95];
77 };
78static unsigned int XRotTextWidth(DrawUtil::XRotFontStruct *rotfont, char *str, int len);
79static void XRotDrawString(Display *dpy, DrawUtil::XRotFontStruct *rotfont, Drawable drawable,
80 GC gc, int x, int y, char *str, int len);
81
82static void DrawRotString(Display *display, Window w, GC gc, DrawUtil::XRotFontStruct *font,
83 unsigned int align, unsigned int text_w,
84 unsigned int size_w, unsigned int size_h,
85 unsigned int bevel_w, char *text);
86
87static DrawUtil::XRotFontStruct *XRotLoadFont(Display *dpy, char *fontname, float angle);
88static void XRotUnloadFont(Display *dpy, DrawUtil::XRotFontStruct *rotfont);
89
90};
91
92#endif //_DRAWUTIL_HH_