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