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