Texts » History » Version 29
iri, 03/25/2011 12:09 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 | 25 | iri | |
137 | 7 | iri | |
138 | 6 | iri | h1. Buffers |
139 | |||
140 | h2. _gtkTextBufferNew |
||
141 | |||
142 | Create a new text buffer object. |
||
143 | |||
144 | Prototype : *fun [Chn ObjGtkWidget] ObjGtkWidget* |
||
145 | |||
146 | table. |
||
147 | |*channel*|Chn|A channel| |
||
148 | |*tagstable*|ObjGtkWidget|A tags table object or nil (in this case, a default table object will be created)| |
||
149 | |||
150 | +Return+ : ObjGtkWidget : a new text buffer object or nil if error |
||
151 | |||
152 | h2. _gtkTextBufferInsert |
||
153 | |||
154 | Insert a string in a position |
||
155 | |||
156 | Prototype : *fun [ObjGtkWidget S I] ObjGtkWidget* |
||
157 | |||
158 | table. |
||
159 | |*buffer*|ObjGtkWidget|Any buffer already created| |
||
160 | |*string*|S|Any string to insert| |
||
161 | |*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the end| |
||
162 | |||
163 | +Return+ : ObjGtkWidget : the same text buffer object or nil if error. |
||
164 | |||
165 | 10 | iri | h2. _gtkTextBufferInsertCopy |
166 | |||
167 | Copy a string from a buffer (between two positions) to a buffer. |
||
168 | *Bug* |
||
169 | |||
170 | Prototype : *fun [ObjGtkWidget I ObjGtkWidget I I] ObjGtkWidget* |
||
171 | |||
172 | table. |
||
173 | 13 | iri | |*buffer*|ObjGtkWidget|Any buffer already created (destination)| |
174 | 10 | iri | |*position*|I|Any string to insert| |
175 | 13 | iri | |*buffer*|ObjGtkWidget|Any other buffer already created (source)| |
176 | 10 | iri | |*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the begin| |
177 | |*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the end| |
||
178 | |||
179 | +Return+ : ObjGtkWidget : the same text buffer object or nil if error. |
||
180 | |||
181 | 19 | iri | h2. _gtkTextBufferInsertPix |
182 | |||
183 | Insert an image into a text buffer object, at a given position. |
||
184 | |||
185 | Prototype : *fun [ObjGtkWidget P I I I I] ObjGtkWidget* |
||
186 | |||
187 | table. |
||
188 | |*buffer*|ObjGtkWidget|any valid text buffer object| |
||
189 | |*filename*|P|a valid read-reference filename (relative at the Scol partition, of course)| |
||
190 | |*position*|I|a position to insert the image| |
||
191 | |*width*|I|a given width, or nil to keep the original width| |
||
192 | |*height*|I|a given height, or nil to keep the original height| |
||
193 | |*ratio*|I|1 to preserve the image's aspect ratio, else 0 or other value| |
||
194 | |||
195 | +Return+ : ObjGtkWidget : the same object or nil if error |
||
196 | |||
197 | 8 | iri | h2. _gtkTextBufferCount |
198 | |||
199 | 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. |
||
200 | |||
201 | Prototype : *fun [ObjGtkWidget] [I I]* |
||
202 | |||
203 | +Return+ : [I I] : a tuple with the number of lines and the numbers of characters. If error, the function returns nil. |
||
204 | |||
205 | 11 | iri | h2. _gtkTextBufferRem |
206 | |||
207 | Removes text between _start_ and _end_ positions from a text buffer object. |
||
208 | |||
209 | Prototype : *fun [ObjGtkWidget I I] ObjGtkWidget* |
||
210 | |||
211 | table. |
||
212 | |*buffer*|ObjGtkWidget|any text buffer object already created| |
||
213 | 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_| |
214 | 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)| |
215 | |||
216 | +Return+ : ObjGtkWidget : the same text buffer object or nil if an error occurs. |
||
217 | |||
218 | 14 | iri | h2. _gtkTextBufferSet |
219 | |||
220 | Set a string to a text buffer object. The old content is overwritten. |
||
221 | |||
222 | Prototype : *fun [ObjGtkWidget S] ObjGtkWidget* |
||
223 | |||
224 | table. |
||
225 | |*buffer*|ObjGtkWidget|any text buffer object| |
||
226 | |*string*|S|any string to set. If nil, the buffer will be empty (as "")| |
||
227 | |||
228 | +Return+ : ObjGtkWidget : the same object or nil if an error occurs. |
||
229 | |||
230 | 15 | iri | h2. _gtkTextBufferSetFrom |
231 | |||
232 | 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. |
||
233 | |||
234 | Prototype : *fun [ObjGtkWidget S I] ObjGtkWidget* |
||
235 | |||
236 | |||
237 | table. |
||
238 | |*buffer*|ObjGtkWidget|any text buffer object| |
||
239 | |*string*|S|any string to set. If nil, the buffer will be empty (as "")| |
||
240 | |*position*|I|a position to begin the treatment. If nil, _position_ will be at 0, if negative, it will be from the end.| |
||
241 | |||
242 | +Return+ : ObjGtkWidget : the same object or nil if an error occurs. |
||
243 | |||
244 | 17 | iri | h2. _gtkTextBufferGet |
245 | |||
246 | Returns the content to a text buffer object, without any invisible characters, without any embedded object. See _gtkTextBufferGetFull below too. |
||
247 | |||
248 | Prototype : *fun [ObjGtkWidget] S* |
||
249 | |||
250 | +Return+ : S : a string or nil if error. |
||
251 | |||
252 | 16 | iri | h2. _gtkTextBufferGetFull |
253 | |||
254 | Returns from a buffer text object a string in the range [_start_, _end_]. |
||
255 | |||
256 | Prototype : *fun [ObjGtkWidget I I I I] S* |
||
257 | |||
258 | table. |
||
259 | |*buffer*|ObjGtkWidget|any text buffer object| | |
||
260 | |*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| | |
||
261 | |*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.| |
||
262 | |*flagA*|I|a flag, whether to include invisible text|SCOL_GTK_TEXT_WITH_HIDDENCHAR to include hidden characters, otherwise 0 or nil| |
||
263 | |*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| |
||
264 | |||
265 | +Return+ : S : the string or nil if error |
||
266 | |||
267 | 22 | iri | h2. _gtkTextBufferIsModified |
268 | |||
269 | Get or Set if the text buffer has been modified since the last call (or its creation) |
||
270 | |||
271 | Prototype : *fun [ObjGtkWidget I] I* |
||
272 | |||
273 | table. |
||
274 | |*buffer*|ObjGtkWidget|a valid text buffer object| |
||
275 | |*value*|I|To get the current state, _value_ must be nil| |
||
276 | | | |To set a new state, _value_ must be 1 (true, is modified) or should be 0 (false, isn't modified)| |
||
277 | |||
278 | +Return+ : I : the current or the new state |
||
279 | 16 | iri | |
280 | 23 | iri | h2. _gtkTextBufferSelectionRem |
281 | |||
282 | Delete the currently selected text |
||
283 | |||
284 | Prototype : *fun [ObjGtkWidget] ObjGtkWidget* |
||
285 | |||
286 | +Return+ : ObjGtkWidget : the same object or nil if error |
||
287 | |||
288 | 14 | iri | |
289 | 9 | iri | |
290 | 18 | iri | h1. Tags table |
291 | 9 | iri | |
292 | h2. _gtkTextBufferGetTagTable |
||
293 | |||
294 | Gets the tags table associated with a text buffer object. |
||
295 | |||
296 | Prototype : *fun [ObjGtkWidget] ObjGtkWidget* |
||
297 | |||
298 | +Return+ : ObjGtkWidget : the Scol tags table object if is already created or a new Scol object. Nil if error. |
||
299 | |||
300 | 2 | iri | Return [[Api]] |