Project

General

Profile

Texts » History » Version 31

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