File: text.h

package info (click to toggle)
9term 1.6.6-5
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 2,340 kB
  • ctags: 2,035
  • sloc: ansic: 17,308; makefile: 220; sh: 178
file content (93 lines) | stat: -rw-r--r-- 1,794 bytes parent folder | download | duplicates (3)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef _LIBTEXT_H
#define _LIBTEXT_H

/*
 * Types...
 */

typedef struct Button	Button;
typedef struct Scroll	Scroll;
typedef struct Text	Text;

struct Button {
	Rectangle		r;
	Bitmap			*b;
	char			*label;
	void			*data;
};

struct Scroll {
	Rectangle		r;
	Bitmap			*b;
	ulong			thumb;
	ulong			extent;
	ulong			max;
	ulong			buttons;
	ulong			n;
	Rectangle		_q;
	void			*data;
};

struct Text {
	Rectangle		r;
	Bitmap			*b;
	Frame			f;
	Rune			*text;
	ulong			alloced;
	ulong			length;
	ulong			base;
	ulong			end;
	ulong			p0;
	ulong			p1;
	ulong			pout;
	ulong			pmark;
	uchar			modified;
	uchar			scrolling;
	Scroll			*scroll;
	Rune			*snarfed;
	ulong			snarflen;
	void			*data;
};

/*
 * Things...
 */

#define	BUTTON1			1
#define	BUTTON2			2
#define	BUTTON3			4

/*
 * Functions...
 */

void			scrollupdate(Scroll *, int);
Scroll			*scrollalloc(Bitmap *, Rectangle);
void			scrollfree(Scroll *);
void			scrollset(Scroll *, ulong, ulong, ulong);
ulong			scrollhit(Scroll *, Event *);

Text			*textalloc(Bitmap *, Rectangle, Font *);
void			textfree(Text *);
void			texthit(Text *, Event *, ulong);
void			textinsert(Text *, Rune *, Rune *, ulong);
void			textinsertchar(Text *, uchar *, uchar *, ulong);
void			textselect(Text *, Mouse *);
void			texthighlight(Text *, ulong, ulong, Fcode);
void			textdelete(Text *, ulong, ulong);
void			textset(Text *, ulong);
void			textfill(Text *);
void			textshow(Text *, ulong, ulong);
void			textjump(Text *, int);
void			textsetrects(Text *, Rectangle, Bitmap *);
void			textscroll(Text *, int);
void			textsnarf(Text *, ulong, ulong);
void			textpaste(Text *, ulong, ulong);

void			doubleclick(Text *, ulong);
ulong			_backnl(Text *, long, ulong);

ulong			texttoutf(char *, Rune *, Rune *);
ulong			utftotext(Rune *, char *, char *);

#endif