Texts » History » Version 19
iri, 03/21/2011 10:47 PM
| 1 | 5 | iri | {{toc}} |
|---|---|---|---|
| 2 | |||
| 3 | 1 | iri | h1. Texts |
| 4 | |||
| 5 | Widget that displays a text string, typically on multi lines. |
||
| 6 | !>http://library.gnome.org/devel/gtk/2.21/multiline-text.png! |
||
| 7 | 4 | iri | A text object can be seen as a container. Each text object has a buffer object. The buffer object stores the content (the string). You can change buffer object to a same text object. |
| 8 | |||
| 9 | 1 | iri | |
| 10 | 5 | iri | |
| 11 | 1 | iri | h2. _gtkTextView |
| 12 | |||
| 13 | Create a new text object. |
||
| 14 | |||
| 15 | Prototype : *fun [Chn ObjGtkWidget S] [ObjGtkWidgetObjGtkWidget]* |
||
| 16 | |||
| 17 | table. |
||
| 18 | |*channel*|Chn|a channel. Can not be nil| |
||
| 19 | |*buffer*|ObjGtkWidget|a text buffer object. It can be nil; in this case, a default buffer will be created| |
||
| 20 | |*content*|S|an initial content. It can be nil| |
||
| 21 | |||
| 22 | +Return+ : [ObjGtkWidget ObjGtkWidget] : the new text object and the buffer text object. If _buffer_ was not nil, this will be the same, otherwise, it will be a new buffer text object too. |
||
| 23 | 2 | iri | |
| 24 | 3 | iri | h2. _gtkTextGetBuffer |
| 25 | |||
| 26 | Return the current buffer object. |
||
| 27 | |||
| 28 | Prototype : *fun [ObjGtkWidget] ObjGtkWidget* |
||
| 29 | 1 | iri | Text object -> buffer object. |
| 30 | 5 | iri | |
| 31 | h2. _gtkTextGetEditable |
||
| 32 | |||
| 33 | Return if a text object is editable or not. |
||
| 34 | |||
| 35 | Prototype : *fun [ObjGtkWidget] I* |
||
| 36 | +Return+ : I : 1 if editable, else 0. Nil if error (object is nil). |
||
| 37 | 3 | iri | |
| 38 | 6 | iri | |
| 39 | 7 | iri | h2. _gtkTextSetEditable |
| 40 | |||
| 41 | Set if a text object is editable or not. |
||
| 42 | |||
| 43 | Prototype : *fun [ObjGtkWidget I] ObjGtkWidget* |
||
| 44 | Set the integer to 1 if the text must be editable, 0 otherwise |
||
| 45 | |||
| 46 | +Return+ : ObjGtkWidget : the same text object or nil if error (object is nil). |
||
| 47 | |||
| 48 | |||
| 49 | 6 | iri | h1. Buffers |
| 50 | |||
| 51 | h2. _gtkTextBufferNew |
||
| 52 | |||
| 53 | Create a new text buffer object. |
||
| 54 | |||
| 55 | Prototype : *fun [Chn ObjGtkWidget] ObjGtkWidget* |
||
| 56 | |||
| 57 | table. |
||
| 58 | |*channel*|Chn|A channel| |
||
| 59 | |*tagstable*|ObjGtkWidget|A tags table object or nil (in this case, a default table object will be created)| |
||
| 60 | |||
| 61 | +Return+ : ObjGtkWidget : a new text buffer object or nil if error |
||
| 62 | |||
| 63 | h2. _gtkTextBufferInsert |
||
| 64 | |||
| 65 | Insert a string in a position |
||
| 66 | |||
| 67 | Prototype : *fun [ObjGtkWidget S I] ObjGtkWidget* |
||
| 68 | |||
| 69 | table. |
||
| 70 | |*buffer*|ObjGtkWidget|Any buffer already created| |
||
| 71 | |*string*|S|Any string to insert| |
||
| 72 | |*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the end| |
||
| 73 | |||
| 74 | +Return+ : ObjGtkWidget : the same text buffer object or nil if error. |
||
| 75 | |||
| 76 | 10 | iri | h2. _gtkTextBufferInsertCopy |
| 77 | |||
| 78 | Copy a string from a buffer (between two positions) to a buffer. |
||
| 79 | *Bug* |
||
| 80 | |||
| 81 | Prototype : *fun [ObjGtkWidget I ObjGtkWidget I I] ObjGtkWidget* |
||
| 82 | |||
| 83 | table. |
||
| 84 | 13 | iri | |*buffer*|ObjGtkWidget|Any buffer already created (destination)| |
| 85 | 10 | iri | |*position*|I|Any string to insert| |
| 86 | 13 | iri | |*buffer*|ObjGtkWidget|Any other buffer already created (source)| |
| 87 | 10 | iri | |*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the begin| |
| 88 | |*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the end| |
||
| 89 | |||
| 90 | +Return+ : ObjGtkWidget : the same text buffer object or nil if error. |
||
| 91 | |||
| 92 | 19 | iri | h2. _gtkTextBufferInsertPix |
| 93 | |||
| 94 | Insert an image into a text buffer object, at a given position. |
||
| 95 | |||
| 96 | Prototype : *fun [ObjGtkWidget P I I I I] ObjGtkWidget* |
||
| 97 | |||
| 98 | table. |
||
| 99 | |*buffer*|ObjGtkWidget|any valid text buffer object| |
||
| 100 | |*filename*|P|a valid read-reference filename (relative at the Scol partition, of course)| |
||
| 101 | |*position*|I|a position to insert the image| |
||
| 102 | |*width*|I|a given width, or nil to keep the original width| |
||
| 103 | |*height*|I|a given height, or nil to keep the original height| |
||
| 104 | |*ratio*|I|1 to preserve the image's aspect ratio, else 0 or other value| |
||
| 105 | |||
| 106 | +Return+ : ObjGtkWidget : the same object or nil if error |
||
| 107 | |||
| 108 | 8 | iri | h2. _gtkTextBufferCount |
| 109 | |||
| 110 | Gets the number of lines and of characters in the buffer. The number of characters and the numbers of bytes can be different. here, the number of characters is returned. |
||
| 111 | |||
| 112 | Prototype : *fun [ObjGtkWidget] [I I]* |
||
| 113 | |||
| 114 | +Return+ : [I I] : a tuple with the number of lines and the numbers of characters. If error, the function returns nil. |
||
| 115 | |||
| 116 | 11 | iri | h2. _gtkTextBufferRem |
| 117 | |||
| 118 | Removes text between _start_ and _end_ positions from a text buffer object. |
||
| 119 | |||
| 120 | Prototype : *fun [ObjGtkWidget I I] ObjGtkWidget* |
||
| 121 | |||
| 122 | table. |
||
| 123 | |*buffer*|ObjGtkWidget|any text buffer object already created| |
||
| 124 | 12 | iri | |*start*|I|a start position to begin the suppression. If nil, _start_ will be at 0. If *negative*, _start_ will be the total number of characters less _start_| |
| 125 | 11 | iri | |*end*|I|another position. If nil, _end_ will be the last character, if *negative*, _end_ will be _start_ - _end_ (= the number of characters to remove)| |
| 126 | |||
| 127 | +Return+ : ObjGtkWidget : the same text buffer object or nil if an error occurs. |
||
| 128 | |||
| 129 | 14 | iri | h2. _gtkTextBufferSet |
| 130 | |||
| 131 | Set a string to a text buffer object. The old content is overwritten. |
||
| 132 | |||
| 133 | Prototype : *fun [ObjGtkWidget S] ObjGtkWidget* |
||
| 134 | |||
| 135 | table. |
||
| 136 | |*buffer*|ObjGtkWidget|any text buffer object| |
||
| 137 | |*string*|S|any string to set. If nil, the buffer will be empty (as "")| |
||
| 138 | |||
| 139 | +Return+ : ObjGtkWidget : the same object or nil if an error occurs. |
||
| 140 | |||
| 141 | 15 | iri | h2. _gtkTextBufferSetFrom |
| 142 | |||
| 143 | Set a string to a text buffer object from a given position. This function is at your convenience, you can do _gtkTextBufferRem and _gtkTextBufferInsert. The old content is overwritten. |
||
| 144 | |||
| 145 | Prototype : *fun [ObjGtkWidget S I] ObjGtkWidget* |
||
| 146 | |||
| 147 | |||
| 148 | table. |
||
| 149 | |*buffer*|ObjGtkWidget|any text buffer object| |
||
| 150 | |*string*|S|any string to set. If nil, the buffer will be empty (as "")| |
||
| 151 | |*position*|I|a position to begin the treatment. If nil, _position_ will be at 0, if negative, it will be from the end.| |
||
| 152 | |||
| 153 | +Return+ : ObjGtkWidget : the same object or nil if an error occurs. |
||
| 154 | |||
| 155 | 17 | iri | h2. _gtkTextBufferGet |
| 156 | |||
| 157 | Returns the content to a text buffer object, without any invisible characters, without any embedded object. See _gtkTextBufferGetFull below too. |
||
| 158 | |||
| 159 | Prototype : *fun [ObjGtkWidget] S* |
||
| 160 | |||
| 161 | +Return+ : S : a string or nil if error. |
||
| 162 | |||
| 163 | 16 | iri | h2. _gtkTextBufferGetFull |
| 164 | |||
| 165 | Returns from a buffer text object a string in the range [_start_, _end_]. |
||
| 166 | |||
| 167 | Prototype : *fun [ObjGtkWidget I I I I] S* |
||
| 168 | |||
| 169 | table. |
||
| 170 | |*buffer*|ObjGtkWidget|any text buffer object| | |
||
| 171 | |*start*|I|a position to begin the read. If _start_ is equal at nil, _start_ will be at 0, if negative, it will be from the end| | |
||
| 172 | |*end*|I|a position to stop the read. If _end_ is equal at nil, _end_ will be at 0, if negative, it will be from the end.|If _end_ is < _start_, they are reversed.| |
||
| 173 | |*flagA*|I|a flag, whether to include invisible text|SCOL_GTK_TEXT_WITH_HIDDENCHAR to include hidden characters, otherwise 0 or nil| |
||
| 174 | |*flagB*|I|a flag, whether to include embedded images or any others objects|SCOL_GTK_TEXT_WITH_OBJECT to include embedded object, otherwise 0 or nil. If it set, a 0xFFFC character will be included for each object in the current position| |
||
| 175 | |||
| 176 | +Return+ : S : the string or nil if error |
||
| 177 | |||
| 178 | |||
| 179 | 14 | iri | |
| 180 | 9 | iri | |
| 181 | 18 | iri | h1. Tags table |
| 182 | 9 | iri | |
| 183 | h2. _gtkTextBufferGetTagTable |
||
| 184 | |||
| 185 | Gets the tags table associated with a text buffer object. |
||
| 186 | |||
| 187 | Prototype : *fun [ObjGtkWidget] ObjGtkWidget* |
||
| 188 | |||
| 189 | +Return+ : ObjGtkWidget : the Scol tags table object if is already created or a new Scol object. Nil if error. |
||
| 190 | |||
| 191 | 2 | iri | Return [[Api]] |