Blob


1 #ifndef _FRAME_H_
2 #define _FRAME_H_ 1
3 #if defined(__cplusplus)
4 extern "C" {
5 #endif
7 AUTOLIB(frame)
9 typedef struct Frbox Frbox;
10 typedef struct Frame Frame;
12 enum{
13 BACK,
14 HIGH,
15 BORD,
16 TEXT,
17 HTEXT,
18 NCOL
19 };
21 #define FRTICKW 3
23 struct Frbox
24 {
25 long wid; /* in pixels */
26 long nrune; /* <0 ==> negate and treat as break char */
27 uchar *ptr;
28 short bc; /* break char */
29 short minwid;
30 };
32 struct Frame
33 {
34 Font *font; /* of chars in the frame */
35 Display *display; /* on which frame appears */
36 Image *b; /* on which frame appears */
37 Image *cols[NCOL]; /* text and background colors */
38 Rectangle r; /* in which text appears */
39 Rectangle entire; /* of full frame */
40 void (*scroll)(Frame*, int); /* scroll function provided by application */
41 Frbox *box;
42 ulong p0, p1; /* selection */
43 ushort nbox, nalloc;
44 ushort maxtab; /* max size of tab, in pixels */
45 ushort nchars; /* # runes in frame */
46 ushort nlines; /* # lines with text */
47 ushort maxlines; /* total # lines in frame */
48 ushort lastlinefull; /* last line fills frame */
49 ushort modified; /* changed since frselect() */
50 Image *tick; /* typing tick */
51 Image *tickback; /* saved image under tick */
52 int ticked; /* flag: is tick onscreen? */
53 int noredraw; /* don't draw on the screen */
54 };
56 ulong frcharofpt(Frame*, Point);
57 Point frptofchar(Frame*, ulong);
58 int frdelete(Frame*, ulong, ulong);
59 void frinsert(Frame*, Rune*, Rune*, ulong);
60 void frselect(Frame*, Mousectl*);
61 void frselectpaint(Frame*, Point, Point, Image*);
62 void frdrawsel(Frame*, Point, ulong, ulong, int);
63 void frdrawsel0(Frame*, Point, ulong, ulong, Image*, Image*);
64 void frinit(Frame*, Rectangle, Font*, Image*, Image**);
65 void frsetrects(Frame*, Rectangle, Image*);
66 void frclear(Frame*, int);
68 uchar *_frallocstr(Frame*, unsigned);
69 void _frinsure(Frame*, int, unsigned);
70 Point _frdraw(Frame*, Point);
71 void _frgrowbox(Frame*, int);
72 void _frfreebox(Frame*, int, int);
73 void _frmergebox(Frame*, int);
74 void _frdelbox(Frame*, int, int);
75 void _frsplitbox(Frame*, int, int);
76 int _frfindbox(Frame*, int, ulong, ulong);
77 void _frclosebox(Frame*, int, int);
78 int _frcanfit(Frame*, Point, Frbox*);
79 void _frcklinewrap(Frame*, Point*, Frbox*);
80 void _frcklinewrap0(Frame*, Point*, Frbox*);
81 void _fradvance(Frame*, Point*, Frbox*);
82 int _frnewwid(Frame*, Point, Frbox*);
83 int _frnewwid0(Frame*, Point, Frbox*);
84 void _frclean(Frame*, Point, int, int);
85 void _frredraw(Frame*, Point);
86 void _fraddbox(Frame*, int, int);
87 Point _frptofcharptb(Frame*, ulong, Point, int);
88 Point _frptofcharnb(Frame*, ulong, int);
89 int _frstrlen(Frame*, int);
90 void frtick(Frame*, Point, int);
91 void frinittick(Frame*);
93 #define NRUNE(b) ((b)->nrune<0? 1 : (b)->nrune)
94 #define NBYTE(b) strlen((char*)(b)->ptr)
95 #if defined(__cplusplus)
96 }
97 #endif
98 #endif