diff options
author | fluxgen <fluxgen> | 2001-12-13 20:44:00 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2001-12-13 20:44:00 (GMT) |
commit | babce4da5ece32f9d9d9c160761391e4b31d556b (patch) | |
tree | 2be9332bee380dc2e6bb88e0a0d781b7b648c440 | |
parent | c5fdccd430ec5f5624c51e173e45e332401deec8 (diff) | |
download | fluxbox-babce4da5ece32f9d9d9c160761391e4b31d556b.zip fluxbox-babce4da5ece32f9d9d9c160761391e4b31d556b.tar.bz2 |
see misc.cc log
-rw-r--r-- | src/misc.hh | 73 |
1 files changed, 57 insertions, 16 deletions
diff --git a/src/misc.hh b/src/misc.hh index ebfbac0..b0593da 100644 --- a/src/misc.hh +++ b/src/misc.hh | |||
@@ -19,42 +19,83 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | #ifndef _MISC_HH_ | ||
23 | #define _MISC_HH_ | ||
24 | |||
22 | 25 | ||
23 | #ifdef HAVE_CONFIG_H | 26 | #ifdef HAVE_CONFIG_H |
24 | # include "config.h" | 27 | # include "config.h" |
25 | #endif //HAVE_CONFIG_H | 28 | #endif //HAVE_CONFIG_H |
26 | 29 | ||
27 | #include <X11/Xlib.h> | 30 | #include <X11/Xlib.h> |
28 | #include "Theme.hh" | ||
29 | 31 | ||
30 | #ifndef _MISC_HH_ | 32 | class Misc |
31 | #define _MISC_HH_ | 33 | { |
34 | public: | ||
35 | typedef struct FFont | ||
36 | { | ||
37 | enum FontJustify {LEFT=0, RIGHT, CENTER}; | ||
38 | |||
39 | XFontSet set; | ||
40 | XFontSetExtents *set_extents; | ||
41 | XFontStruct *fontstruct; | ||
42 | FontJustify justify; | ||
43 | } Font; | ||
44 | |||
45 | static char *strdup(const char *); | ||
32 | 46 | ||
33 | // ---- start code stealing ----- | 47 | static void DrawString(Display *display, Window w, GC gc, Misc::Font *font, |
48 | unsigned int text_w, unsigned int size_w, | ||
49 | unsigned int bevel_w, char *text); | ||
34 | 50 | ||
35 | // ---------------------------------------------------------------------- | 51 | // ---------------------------------------------------------------------- |
36 | // xvertext, Copyright (c) 1992 Alan Richardson (mppa3@uk.ac.sussex.syma) | 52 | // xvertext, Copyright (c) 1992 Alan Richardson (mppa3@uk.ac.sussex.syma) |
37 | // ---------------------------------------------------------------------- | 53 | // ---------------------------------------------------------------------- |
38 | 54 | ||
39 | #define XV_NOFONT 1 // no such font on X server | 55 | /* *** The font structures *** */ |
40 | #define XV_NOMEM 2 // couldn't do malloc | ||
41 | #define XV_NOXIMAGE 3 // couldn't create an XImage | ||
42 | 56 | ||
43 | unsigned int XRotTextWidth(XRotFontStruct *rotfont, char *str, int len); | 57 | struct BitmapStruct { |
44 | void XRotDrawString(Display *dpy, XRotFontStruct *rotfont, Drawable drawable, | 58 | int bit_w; |
45 | GC gc, int x, int y, char *str, int len); | 59 | int bit_h; |
46 | 60 | ||
47 | //int xv_errno; //TODO: ? | 61 | Pixmap bm; |
62 | }; | ||
48 | 63 | ||
49 | // --- stop code stealing --- | 64 | struct XRotCharStruct { |
65 | int ascent; | ||
66 | int descent; | ||
67 | int lbearing; | ||
68 | int rbearing; | ||
69 | int width; | ||
50 | 70 | ||
51 | void DrawString(Display *display, Window w, GC gc, FFont *font, | 71 | BitmapStruct glyph; |
52 | unsigned int text_w, unsigned int size_w, | 72 | }; |
53 | unsigned int bevel_w, char *text); | 73 | |
74 | struct XRotFontStruct { | ||
75 | int dir; | ||
76 | int height; | ||
77 | int max_ascent; | ||
78 | int max_descent; | ||
79 | int max_char; | ||
80 | int min_char; | ||
81 | char *name; | ||
82 | |||
83 | XFontStruct *xfontstruct; | ||
54 | 84 | ||
55 | void DrawRotString(Display *display, Window w, GC gc, XRotFontStruct *font, | 85 | Misc::XRotCharStruct per_char[95]; |
86 | }; | ||
87 | static unsigned int XRotTextWidth(Misc::XRotFontStruct *rotfont, char *str, int len); | ||
88 | static void XRotDrawString(Display *dpy, Misc::XRotFontStruct *rotfont, Drawable drawable, | ||
89 | GC gc, int x, int y, char *str, int len); | ||
90 | |||
91 | static void DrawRotString(Display *display, Window w, GC gc, Misc::XRotFontStruct *font, | ||
56 | unsigned int align, unsigned int text_w, | 92 | unsigned int align, unsigned int text_w, |
57 | unsigned int size_w, unsigned int size_h, | 93 | unsigned int size_w, unsigned int size_h, |
58 | unsigned int bevel_w, char *text); | 94 | unsigned int bevel_w, char *text); |
95 | |||
96 | static Misc::XRotFontStruct *Misc::XRotLoadFont(Display *dpy, char *fontname, float angle); | ||
97 | static void Misc::XRotUnloadFont(Display *dpy, Misc::XRotFontStruct *rotfont); | ||
98 | |||
99 | }; | ||
59 | 100 | ||
60 | #endif //_MISC_HH_ | 101 | #endif //_MISC_HH_ |