Texts » History » Version 27
iri, 03/24/2011 10:31 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 | 20 | iri | h2. _gtkTextNew |
12 | 1 | iri | |
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 | 24 | iri | h2. _gtkTextSetBuffer |
32 | |||
33 | Sets a text buffer object as the buffer being displayed by a text object |
||
34 | |||
35 | Protototype : *fun [ObjGtkWidget ObjGtkWidget] ObjGtkWidget* |
||
36 | |||
37 | table. |
||
38 | |*text*|ObjGtkWidget|any text object already created| |
||
39 | |*buffer*|ObjGtkWidget|any text buffer object already created| |
||
40 | |||
41 | +Return+ : ObjGtkWidget : the same text object or nil if an error occurs |
||
42 | |||
43 | 5 | iri | h2. _gtkTextGetEditable |
44 | |||
45 | Return if a text object is editable or not. |
||
46 | |||
47 | Prototype : *fun [ObjGtkWidget] I* |
||
48 | +Return+ : I : 1 if editable, else 0. Nil if error (object is nil). |
||
49 | 3 | iri | |
50 | 6 | iri | |
51 | 7 | iri | h2. _gtkTextSetEditable |
52 | |||
53 | Set if a text object is editable or not. |
||
54 | |||
55 | Prototype : *fun [ObjGtkWidget I] ObjGtkWidget* |
||
56 | Set the integer to 1 if the text must be editable, 0 otherwise |
||
57 | |||
58 | +Return+ : ObjGtkWidget : the same text object or nil if error (object is nil). |
||
59 | |||
60 | 21 | iri | h2. _gtkTextInsertWidget |
61 | |||
62 | Insert a widget in a text object. |
||
63 | |||
64 | Prototype : *fun [ObjGtklWidget ObjGtklWidget I] ObjGtklWidget* |
||
65 | |||
66 | table. |
||
67 | |*text*|ObjGtklWidget|any text object already created| |
||
68 | |*child*|ObjGtklWidget|a widget to insert in the text object| |
||
69 | |*position*|I|a position where the widget will be inserted| |
||
70 | |||
71 | +Return+ : ObjGtklWidget : the same object or, if an error occurs, returns nil. |
||
72 | |||
73 | 25 | iri | h2. _gtkTextScroll |
74 | |||
75 | Scrolls text object to the given position. |
||
76 | +NOTE+ : this function could be updated and its prototype could be modified. |
||
77 | |||
78 | Prototype : *fun [ObjGtkWidget I I I] I* |
||
79 | |||
80 | table. |
||
81 | |*text*|ObjGtkWidget|a valid text object| |
||
82 | |*position*|I|a position of a character| |
||
83 | |*alignx*|I|horizontal position displayed of this character : 0 to left, 100 to right, 50, to center, etc| |
||
84 | |*aligny*|I|vertical position displayed of this character : 0 to top, 100 to bottom, 50, to center, etc| |
||
85 | |||
86 | +Return+ : I : 1 if scrolling occured, else 0. If an error occurs, returns nil. |
||
87 | |||
88 | 26 | iri | h2. _gtkTextSetBorderSize |
89 | |||
90 | Sets the width / heigth around the text in a text object |
||
91 | |||
92 | !http://www.scolring.org/files/divers/scolring_wiki_gtk_text_border_size.png! |
||
93 | ::: @_gtkTextSetBorderSize text [50 10 25 0];@ |
||
94 | |||
95 | Prototype : *fun [ObjGtkWidget [I I I I]] ObjGtkWidget* |
||
96 | |||
97 | table. |
||
98 | |*text*|ObjGtkWidget|a valid text object| |
||
99 | |*sizes*|[I I I I]|the size of (respectively) the LEFT, TOP, RIGHT, BOTTOM. If nil or negative, size will be at 0. If tuple is equal to nil, all size will be at 0| |
||
100 | |||
101 | +Return+ : ObjGtkWidget : the same text object or nil if error |
||
102 | |||
103 | 27 | iri | h2. _gtkTextSetWrap |
104 | |||
105 | Sets the mode wrap |
||
106 | |||
107 | Prototype : *fun [ObjGtkWidget I] ObjGtkWidget* |
||
108 | |||
109 | table. |
||
110 | |*text*|ObjGtkWidget|a text object| | |
||
111 | |*mode*|I|SCOL_GTK_TEXT_WRAP_NONE|default, do not wrap lines; just make the text area wider| |
||
112 | | | |SCOL_GTK_TEXT_WRAP_CHAR|wrap text, breaking lines anywhere the cursor can appear| |
||
113 | | | |SCOL_GTK_TEXT_WRAP_WORD|wrap text, breaking lines in between words| |
||
114 | | | |SCOL_GTK_TEXT_WRAP_WORD_CHAR|wrap text, breaking lines in between words, or if that is not enough, also between graphemes| |
||
115 | |||
116 | +Return+ : ObjGtkWidget : the same object or nil if error. |
||
117 | |||
118 | 25 | iri | |
119 | 7 | iri | |
120 | 6 | iri | h1. Buffers |
121 | |||
122 | h2. _gtkTextBufferNew |
||
123 | |||
124 | Create a new text buffer object. |
||
125 | |||
126 | Prototype : *fun [Chn ObjGtkWidget] ObjGtkWidget* |
||
127 | |||
128 | table. |
||
129 | |*channel*|Chn|A channel| |
||
130 | |*tagstable*|ObjGtkWidget|A tags table object or nil (in this case, a default table object will be created)| |
||
131 | |||
132 | +Return+ : ObjGtkWidget : a new text buffer object or nil if error |
||
133 | |||
134 | h2. _gtkTextBufferInsert |
||
135 | |||
136 | Insert a string in a position |
||
137 | |||
138 | Prototype : *fun [ObjGtkWidget S I] ObjGtkWidget* |
||
139 | |||
140 | table. |
||
141 | |*buffer*|ObjGtkWidget|Any buffer already created| |
||
142 | |*string*|S|Any string to insert| |
||
143 | |*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the end| |
||
144 | |||
145 | +Return+ : ObjGtkWidget : the same text buffer object or nil if error. |
||
146 | |||
147 | 10 | iri | h2. _gtkTextBufferInsertCopy |
148 | |||
149 | Copy a string from a buffer (between two positions) to a buffer. |
||
150 | *Bug* |
||
151 | |||
152 | Prototype : *fun [ObjGtkWidget I ObjGtkWidget I I] ObjGtkWidget* |
||
153 | |||
154 | table. |
||
155 | 13 | iri | |*buffer*|ObjGtkWidget|Any buffer already created (destination)| |
156 | 10 | iri | |*position*|I|Any string to insert| |
157 | 13 | iri | |*buffer*|ObjGtkWidget|Any other buffer already created (source)| |
158 | 10 | iri | |*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the begin| |
159 | |*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the end| |
||
160 | |||
161 | +Return+ : ObjGtkWidget : the same text buffer object or nil if error. |
||
162 | |||
163 | 19 | iri | h2. _gtkTextBufferInsertPix |
164 | |||
165 | Insert an image into a text buffer object, at a given position. |
||
166 | |||
167 | Prototype : *fun [ObjGtkWidget P I I I I] ObjGtkWidget* |
||
168 | |||
169 | table. |
||
170 | |*buffer*|ObjGtkWidget|any valid text buffer object| |
||
171 | |*filename*|P|a valid read-reference filename (relative at the Scol partition, of course)| |
||
172 | |*position*|I|a position to insert the image| |
||
173 | |*width*|I|a given width, or nil to keep the original width| |
||
174 | |*height*|I|a given height, or nil to keep the original height| |
||
175 | |*ratio*|I|1 to preserve the image's aspect ratio, else 0 or other value| |
||
176 | |||
177 | +Return+ : ObjGtkWidget : the same object or nil if error |
||
178 | |||
179 | 8 | iri | h2. _gtkTextBufferCount |
180 | |||
181 | 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. |
||
182 | |||
183 | Prototype : *fun [ObjGtkWidget] [I I]* |
||
184 | |||
185 | +Return+ : [I I] : a tuple with the number of lines and the numbers of characters. If error, the function returns nil. |
||
186 | |||
187 | 11 | iri | h2. _gtkTextBufferRem |
188 | |||
189 | Removes text between _start_ and _end_ positions from a text buffer object. |
||
190 | |||
191 | Prototype : *fun [ObjGtkWidget I I] ObjGtkWidget* |
||
192 | |||
193 | table. |
||
194 | |*buffer*|ObjGtkWidget|any text buffer object already created| |
||
195 | 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_| |
196 | 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)| |
197 | |||
198 | +Return+ : ObjGtkWidget : the same text buffer object or nil if an error occurs. |
||
199 | |||
200 | 14 | iri | h2. _gtkTextBufferSet |
201 | |||
202 | Set a string to a text buffer object. The old content is overwritten. |
||
203 | |||
204 | Prototype : *fun [ObjGtkWidget S] ObjGtkWidget* |
||
205 | |||
206 | table. |
||
207 | |*buffer*|ObjGtkWidget|any text buffer object| |
||
208 | |*string*|S|any string to set. If nil, the buffer will be empty (as "")| |
||
209 | |||
210 | +Return+ : ObjGtkWidget : the same object or nil if an error occurs. |
||
211 | |||
212 | 15 | iri | h2. _gtkTextBufferSetFrom |
213 | |||
214 | 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. |
||
215 | |||
216 | Prototype : *fun [ObjGtkWidget S I] ObjGtkWidget* |
||
217 | |||
218 | |||
219 | table. |
||
220 | |*buffer*|ObjGtkWidget|any text buffer object| |
||
221 | |*string*|S|any string to set. If nil, the buffer will be empty (as "")| |
||
222 | |*position*|I|a position to begin the treatment. If nil, _position_ will be at 0, if negative, it will be from the end.| |
||
223 | |||
224 | +Return+ : ObjGtkWidget : the same object or nil if an error occurs. |
||
225 | |||
226 | 17 | iri | h2. _gtkTextBufferGet |
227 | |||
228 | Returns the content to a text buffer object, without any invisible characters, without any embedded object. See _gtkTextBufferGetFull below too. |
||
229 | |||
230 | Prototype : *fun [ObjGtkWidget] S* |
||
231 | |||
232 | +Return+ : S : a string or nil if error. |
||
233 | |||
234 | 16 | iri | h2. _gtkTextBufferGetFull |
235 | |||
236 | Returns from a buffer text object a string in the range [_start_, _end_]. |
||
237 | |||
238 | Prototype : *fun [ObjGtkWidget I I I I] S* |
||
239 | |||
240 | table. |
||
241 | |*buffer*|ObjGtkWidget|any text buffer object| | |
||
242 | |*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| | |
||
243 | |*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.| |
||
244 | |*flagA*|I|a flag, whether to include invisible text|SCOL_GTK_TEXT_WITH_HIDDENCHAR to include hidden characters, otherwise 0 or nil| |
||
245 | |*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| |
||
246 | |||
247 | +Return+ : S : the string or nil if error |
||
248 | |||
249 | 22 | iri | h2. _gtkTextBufferIsModified |
250 | |||
251 | Get or Set if the text buffer has been modified since the last call (or its creation) |
||
252 | |||
253 | Prototype : *fun [ObjGtkWidget I] I* |
||
254 | |||
255 | table. |
||
256 | |*buffer*|ObjGtkWidget|a valid text buffer object| |
||
257 | |*value*|I|To get the current state, _value_ must be nil| |
||
258 | | | |To set a new state, _value_ must be 1 (true, is modified) or should be 0 (false, isn't modified)| |
||
259 | |||
260 | +Return+ : I : the current or the new state |
||
261 | 16 | iri | |
262 | 23 | iri | h2. _gtkTextBufferSelectionRem |
263 | |||
264 | Delete the currently selected text |
||
265 | |||
266 | Prototype : *fun [ObjGtkWidget] ObjGtkWidget* |
||
267 | |||
268 | +Return+ : ObjGtkWidget : the same object or nil if error |
||
269 | |||
270 | 14 | iri | |
271 | 9 | iri | |
272 | 18 | iri | h1. Tags table |
273 | 9 | iri | |
274 | h2. _gtkTextBufferGetTagTable |
||
275 | |||
276 | Gets the tags table associated with a text buffer object. |
||
277 | |||
278 | Prototype : *fun [ObjGtkWidget] ObjGtkWidget* |
||
279 | |||
280 | +Return+ : ObjGtkWidget : the Scol tags table object if is already created or a new Scol object. Nil if error. |
||
281 | |||
282 | 2 | iri | Return [[Api]] |