1 #pragma src "/sys/src/libframe"
2 #pragma lib "libframe.a"
4 typedef struct Frbox Frbox;
5 typedef struct Frame Frame;
20 long wid; /* in pixels */
21 long nrune; /* <0 ==> negate and treat as break char */
25 short bc; /* break char */
33 Font *font; /* of chars in the frame */
34 Display *display; /* on which frame appears */
35 Image *b; /* on which frame appears */
36 Image *cols[NCOL]; /* text and background colors */
37 Rectangle r; /* in which text appears */
38 Rectangle entire; /* of full frame */
39 void (*scroll)(Frame*, int); /* scroll function provided by application */
41 ulong p0, p1; /* selection */
43 ushort maxtab; /* max size of tab, in pixels */
44 ushort nchars; /* # runes in frame */
45 ushort nlines; /* # lines with text */
46 ushort maxlines; /* total # lines in frame */
47 ushort lastlinefull; /* last line fills frame */
48 ushort modified; /* changed since frselect() */
49 Image *tick; /* typing tick */
50 Image *tickback; /* saved image under tick */
51 int ticked; /* flag: is tick onscreen? */
54 ulong frcharofpt(Frame*, Point);
55 Point frptofchar(Frame*, ulong);
56 int frdelete(Frame*, ulong, ulong);
57 void frinsert(Frame*, Rune*, Rune*, ulong);
58 void frselect(Frame*, Mousectl*);
59 void frselectpaint(Frame*, Point, Point, Image*);
60 void frdrawsel(Frame*, Point, ulong, ulong, int);
61 Point frdrawsel0(Frame*, Point, ulong, ulong, Image*, Image*);
62 void frinit(Frame*, Rectangle, Font*, Image*, Image**);
63 void frsetrects(Frame*, Rectangle, Image*);
64 void frclear(Frame*, int);
66 uchar *_frallocstr(Frame*, unsigned);
67 void _frinsure(Frame*, int, unsigned);
68 Point _frdraw(Frame*, Point);
69 void _frgrowbox(Frame*, int);
70 void _frfreebox(Frame*, int, int);
71 void _frmergebox(Frame*, int);
72 void _frdelbox(Frame*, int, int);
73 void _frsplitbox(Frame*, int, int);
74 int _frfindbox(Frame*, int, ulong, ulong);
75 void _frclosebox(Frame*, int, int);
76 int _frcanfit(Frame*, Point, Frbox*);
77 void _frcklinewrap(Frame*, Point*, Frbox*);
78 void _frcklinewrap0(Frame*, Point*, Frbox*);
79 void _fradvance(Frame*, Point*, Frbox*);
80 int _frnewwid(Frame*, Point, Frbox*);
81 int _frnewwid0(Frame*, Point, Frbox*);
82 void _frclean(Frame*, Point, int, int);
83 void _frdrawtext(Frame*, Point, Image*, Image*);
84 void _fraddbox(Frame*, int, int);
85 Point _frptofcharptb(Frame*, ulong, Point, int);
86 Point _frptofcharnb(Frame*, ulong, int);
87 int _frstrlen(Frame*, int);
88 void frtick(Frame*, Point, int);
89 void frinittick(Frame*);
90 void frredraw(Frame*);
92 #define NRUNE(b) ((b)->nrune<0? 1 : (b)->nrune)
93 #define NBYTE(b) strlen((char*)(b)->ptr)