http://ftp.nluug.nl/pub/os/Linux/distr/pardusrepo/sources/xscreensaver-5.02.tar.gz
[xscreensaver] / driver / mlstring.h
1 /* mlstring.h --- Multi-line strings for use with Xlib
2  *
3  * (c) 2007, Quest Software, Inc. All rights reserved.
4  *
5  * This file is part of XScreenSaver,
6  * Copyright (c) 1993-2004 Jamie Zawinski <jwz@jwz.org>
7  *
8  * Permission to use, copy, modify, distribute, and sell this software and its
9  * documentation for any purpose is hereby granted without fee, provided that
10  * the above copyright notice appear in all copies and that both that
11  * copyright notice and this permission notice appear in supporting
12  * documentation.  No representations are made about the suitability of this
13  * software for any purpose.  It is provided "as is" without express or 
14  * implied warranty.
15  */
16 #ifndef MLSTRING_H
17 #define MLSTRING_H
18
19 #include <X11/Intrinsic.h>
20
21 /* mlstring means multi-line string */
22
23 struct mlstr_line;
24
25 typedef struct mlstring mlstring;
26 struct mlstring {
27   struct mlstr_line *lines; /* linked list */
28   Dimension overall_height;
29   Dimension overall_width;
30   /* XXX: Perhaps it is simpler to keep a reference to the XFontStruct */
31   int font_ascent;
32   int font_height;
33   Font font_id;
34 };
35
36 struct mlstr_line {
37   char *line;
38   Dimension line_width;
39   struct mlstr_line *next_line;
40 };
41
42 mlstring *
43 mlstring_new(const char *str, XFontStruct *font, Dimension wrap_width);
44
45 /* Does not have to be called manually */
46 void
47 mlstring_wrap(mlstring *mstr, XFontStruct *font, Dimension width);
48
49 void
50 mlstring_free(mlstring *str);
51
52 void
53 mlstring_draw(Display *dpy, Drawable dialog, GC gc, mlstring *string, int x, int y);
54
55 #endif
56 /* vim:ts=8:sw=2:noet
57  */