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 Point 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);
67 void frredraw(Frame*);
69 uchar *_frallocstr(Frame*, unsigned);
70 void _frinsure(Frame*, int, unsigned);
71 Point _frdraw(Frame*, Point);
72 void _frgrowbox(Frame*, int);
73 void _frfreebox(Frame*, int, int);
74 void _frmergebox(Frame*, int);
75 void _frdelbox(Frame*, int, int);
76 void _frsplitbox(Frame*, int, int);
77 int _frfindbox(Frame*, int, ulong, ulong);
78 void _frclosebox(Frame*, int, int);
79 int _frcanfit(Frame*, Point, Frbox*);
80 void _frcklinewrap(Frame*, Point*, Frbox*);
81 void _frcklinewrap0(Frame*, Point*, Frbox*);
82 void _fradvance(Frame*, Point*, Frbox*);
83 int _frnewwid(Frame*, Point, Frbox*);
84 int _frnewwid0(Frame*, Point, Frbox*);
85 void _frclean(Frame*, Point, int, int);
86 void _frdrawtext(Frame*, Point, Image*, Image*);
87 void _fraddbox(Frame*, int, int);
88 Point _frptofcharptb(Frame*, ulong, Point, int);
89 Point _frptofcharnb(Frame*, ulong, int);
90 int _frstrlen(Frame*, int);
91 void frtick(Frame*, Point, int);
92 void frinittick(Frame*);
94 #define NRUNE(b) ((b)->nrune<0? 1 : (b)->nrune)
95 #define NBYTE(b) strlen((char*)(b)->ptr)
96 #if defined(__cplusplus)
97 }
98 #endif
99 #endif