1// included by gtk2.pas 2 3{$IFDEF read_forward_definitions} 4{$ENDIF read_forward_definitions} 5 6//------------------------------------------------------------------------------ 7 8{$IFDEF read_interface_types} 9 PGtkTextLineSegment = ^TGtkTextLineSegment; 10 PGtkTextLineSegmentClass = ^TGtkTextLineSegmentClass; 11 12{ 13 Segments: each line is divided into one or more segments, where each 14 segment is one of several things, such as a group of characters, a 15 tag toggle, a mark, or an embedded widget. Each segment starts with 16 a standard header followed by a body that varies from type to type. 17 } 18{ This header has the segment type, and two specific segments 19 (character and toggle segments) } 20{ Information a BTree stores about a tag. } 21{ highest-level node containing the tag } 22{ total toggles of this tag below tag_root } 23 PGtkTextTagInfo = ^TGtkTextTagInfo; 24 TGtkTextTagInfo = record 25 tag : PGtkTextTag; 26 tag_root : PGtkTextBTreeNode; 27 toggle_count : gint; 28 end; 29 30{ Body of a segment that toggles a tag on or off } 31{ Tag that starts or ends here. } 32{ TRUE means this toggle has been 33 accounted for in node toggle 34 counts; FALSE means it hasn't, yet. } 35 PGtkTextToggleBody = ^TGtkTextToggleBody; 36 TGtkTextToggleBody = record 37 info : PGtkTextTagInfo; 38 inNodeCounts : gboolean; 39 end; 40 41{ 42 The data structure below defines line segments. 43 } 44{ Pointer to record describing 45 segment's type. } 46{ Next in list of segments for this 47 line, or NULL for theEnd of list. } 48{ # of chars of index space occupied } 49{ Size of this segment (# of bytes 50 of index space it occupies). } 51{ Characters that make up character 52 info. Actual length varies to 53 hold as many characters as needed. } 54{ Information about tag toggle. } 55{ Information about mark. } 56{ Child pixbuf } 57{ Child widget } 58 TGtkTextLineSegment = record 59 _type : PGtkTextLineSegmentClass; 60 next : PGtkTextLineSegment; 61 char_count : longint; 62 byte_count : longint; 63 body : record 64 case longint of 65 0 : ( chars : array[0..3] of char ); 66 1 : ( toggle : TGtkTextToggleBody ); 67 2 : ( mark : TGtkTextMarkBody ); 68 3 : ( pixbuf : TGtkTextPixbuf ); 69 4 : ( child : TGtkTextChildBody ); 70 end; 71 end; 72 73 74{ Class struct for segments } 75{ Split seg at index, returning list of two new segments, and freeing seg } 76 77 PGtkTextSegSplitFunc = ^TGtkTextSegSplitFunc; 78 TGtkTextSegSplitFunc = TGtkTextLineSegment; 79{ Delete seg which is contained in line; if tree_gone, the tree is being 80 freed in its entirety, which may matter for some reason (?) 81 Return TRUE if the segment is not deleteable, e.g. a mark. 82 } 83 84 TGtkTextSegDeleteFunc = function (seg:PGtkTextLineSegment; line:PGtkTextLine; tree_gone:gboolean):gboolean; cdecl; 85{ Called after segment structure of line changes, so segments can 86 cleanup (e.g. merge with adjacent segments). Returns a segment list 87 to replace the original segment list with. The line argument is 88 the current line. 89 } 90 91 PGtkTextSegCleanupFunc = ^TGtkTextSegCleanupFunc; 92 TGtkTextSegCleanupFunc = TGtkTextLineSegment; 93{ Called when a segment moves from one line to another. CleanupFunc is also 94 called in that case, so many segments just use CleanupFunc, I'm not sure 95 what's up with that (this function may not be needed...) 96 } 97 98 TGtkTextSegLineChangeFunc = procedure (seg:PGtkTextLineSegment; line:PGtkTextLine); cdecl; 99{ Called to do debug checks on the segment. } 100 101 TGtkTextSegCheckFunc = procedure (seg:PGtkTextLineSegment; line:PGtkTextLine); cdecl; 102{ Name of this kind of segment. } 103{ If a segment has zero size (e.g. a 104 mark or tag toggle), does it 105 attach to character to its left 106 or right? 1 means left, 0 means 107 right. } 108{ Procedure to split large segment 109 into two smaller ones. } 110{ Procedure to call to delete 111 segment. } 112{ After any change to a line, this 113 procedure is invoked for all 114 segments left in the line to 115 perform any cleanup they wish 116 (e.g. joining neighboring 117 segments). } 118{ Invoked when a segment is about 119 to be moved from its current line 120 to an earlier line because of 121 a deletion. The line is that 122 for the segment's old line. 123 CleanupFunc will be invoked after 124 the deletion is finished. } 125{ Called during consistency checks 126 to check internal consistency of 127 segment. } 128 TGtkTextLineSegmentClass = record 129 name : Pchar; 130 leftGravity : gboolean; 131 splitFunc : TGtkTextSegSplitFunc; 132 deleteFunc : TGtkTextSegDeleteFunc; 133 cleanupFunc : TGtkTextSegCleanupFunc; 134 lineChangeFunc : TGtkTextSegLineChangeFunc; 135 checkFunc : TGtkTextSegCheckFunc; 136 end; 137 138{$ENDIF read_interface_types} 139 140//------------------------------------------------------------------------------ 141 142{$IFDEF read_interface_rest} 143function gtk_text_line_segment_split(iter:PGtkTextIter):PGtkTextLineSegment; cdecl; external gtklib; 144function _gtk_char_segment_new(text:Pgchar; len:guint):PGtkTextLineSegment; cdecl; external gtklib; 145 146function _gtk_char_segment_new_from_two_strings(text1:Pgchar; len1:guint; text2:Pgchar; len2:guint):PGtkTextLineSegment; cdecl; external gtklib; 147function _gtk_toggle_segment_new(info:PGtkTextTagInfo; StateOn:gboolean):PGtkTextLineSegment; cdecl; external gtklib; 148{$ENDIF read_interface_rest} 149 150