Project

General

Profile

Texts » History » Version 23

iri, 03/23/2011 08:43 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
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 21 iri
h2. _gtkTextInsertWidget
49
50
Insert a widget in a text object.
51
52
Prototype : *fun [ObjGtklWidget ObjGtklWidget I] ObjGtklWidget*
53
54
table.
55
|*text*|ObjGtklWidget|any text object already created|
56
|*child*|ObjGtklWidget|a widget to insert in the text object|
57
|*position*|I|a position where the widget will be inserted|
58
59
+Return+ : ObjGtklWidget : the same object or, if an error occurs, returns nil.
60
61 7 iri
62 6 iri
h1. Buffers
63
64
h2. _gtkTextBufferNew
65
66
Create a new text buffer object.
67
68
Prototype : *fun [Chn ObjGtkWidget] ObjGtkWidget*
69
70
table.
71
|*channel*|Chn|A channel|
72
|*tagstable*|ObjGtkWidget|A tags table object or nil (in this case, a default table object will be created)|
73
74
+Return+ : ObjGtkWidget : a new text buffer object or nil if error
75
76
h2. _gtkTextBufferInsert
77
78
Insert a string in a position
79
80
Prototype : *fun [ObjGtkWidget S I] ObjGtkWidget*
81
82
table.
83
|*buffer*|ObjGtkWidget|Any buffer already created|
84
|*string*|S|Any string to insert|
85
|*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the end|
86
87
+Return+ : ObjGtkWidget : the same text buffer object or nil if error.
88
89 10 iri
h2. _gtkTextBufferInsertCopy
90
91
Copy a string from a buffer (between two positions) to a buffer.
92
*Bug*
93
94
Prototype : *fun [ObjGtkWidget I ObjGtkWidget I I] ObjGtkWidget*
95
96
table.
97 13 iri
|*buffer*|ObjGtkWidget|Any buffer already created (destination)|
98 10 iri
|*position*|I|Any string to insert|
99 13 iri
|*buffer*|ObjGtkWidget|Any other buffer already created (source)|
100 10 iri
|*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the begin|
101
|*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the end|
102
103
+Return+ : ObjGtkWidget : the same text buffer object or nil if error.
104
105 19 iri
h2. _gtkTextBufferInsertPix
106
107
Insert an image into a text buffer object, at a given position.
108
109
Prototype : *fun [ObjGtkWidget P I I I I] ObjGtkWidget*
110
111
table.
112
|*buffer*|ObjGtkWidget|any valid text buffer object|
113
|*filename*|P|a valid read-reference filename (relative at the Scol partition, of course)|
114
|*position*|I|a position to insert the image|
115
|*width*|I|a given width, or nil to keep the original width|
116
|*height*|I|a given height, or nil to keep the original height|
117
|*ratio*|I|1 to preserve the image's aspect ratio, else 0 or other value|
118
119
+Return+ : ObjGtkWidget : the same object or nil if error
120
121 8 iri
h2. _gtkTextBufferCount
122
123
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.
124
125
Prototype : *fun [ObjGtkWidget] [I I]*
126
127
+Return+ : [I I] : a tuple with the number of lines and the numbers of characters. If error, the function returns nil.
128
129 11 iri
h2. _gtkTextBufferRem
130
131
Removes text between _start_ and _end_ positions from a text buffer object.
132
133
Prototype : *fun [ObjGtkWidget I I] ObjGtkWidget*
134
135
table.
136
|*buffer*|ObjGtkWidget|any text buffer object already created|
137 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_|
138 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)|
139
140
+Return+ : ObjGtkWidget : the same text buffer object or nil if an error occurs.
141
142 14 iri
h2. _gtkTextBufferSet
143
144
Set a string to a text buffer object. The old content is overwritten.
145
146
Prototype : *fun [ObjGtkWidget S] ObjGtkWidget*
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
152
+Return+ : ObjGtkWidget : the same object or nil if an error occurs.
153
154 15 iri
h2. _gtkTextBufferSetFrom
155
156
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.
157
158
Prototype : *fun [ObjGtkWidget S I] ObjGtkWidget*
159
160
161
table.
162
|*buffer*|ObjGtkWidget|any text buffer object|
163
|*string*|S|any string to set. If nil, the buffer will be empty (as "")|
164
|*position*|I|a position to begin the treatment. If nil, _position_ will be at 0, if negative, it will be from the end.|
165
166
+Return+ : ObjGtkWidget : the same object or nil if an error occurs.
167
168 17 iri
h2. _gtkTextBufferGet
169
170
Returns the content to a text buffer object, without any invisible characters, without any embedded object. See _gtkTextBufferGetFull below too.
171
172
Prototype : *fun [ObjGtkWidget] S*
173
174
+Return+ : S : a string or nil if error.
175
176 16 iri
h2. _gtkTextBufferGetFull
177
178
Returns from a buffer text object a string in the range [_start_, _end_].
179
180
Prototype : *fun [ObjGtkWidget I I I I] S*
181
182
table.
183
|*buffer*|ObjGtkWidget|any text buffer object| |
184
|*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| |
185
|*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.|
186
|*flagA*|I|a flag, whether to include invisible text|SCOL_GTK_TEXT_WITH_HIDDENCHAR to include hidden characters, otherwise 0 or nil|
187
|*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|
188
189
+Return+ : S : the string or nil if error
190
191 22 iri
h2. _gtkTextBufferIsModified
192
193
Get or Set if the text buffer has been modified since the last call (or its creation)
194
195
Prototype : *fun [ObjGtkWidget I] I*
196
197
table.
198
|*buffer*|ObjGtkWidget|a valid text buffer object|
199
|*value*|I|To get the current state, _value_ must be nil|
200
| | |To set a new state, _value_ must be 1 (true, is modified) or should be 0 (false, isn't modified)|
201
202
+Return+ : I : the current or the new state
203 16 iri
204 23 iri
h2. _gtkTextBufferSelectionRem
205
206
Delete the currently selected text
207
208
Prototype : *fun [ObjGtkWidget] ObjGtkWidget*
209
210
+Return+ : ObjGtkWidget : the same object or nil if error
211
212 14 iri
213 9 iri
214 18 iri
h1. Tags table
215 9 iri
216
h2. _gtkTextBufferGetTagTable
217
218
Gets the tags table associated with a text buffer object.
219
220
Prototype : *fun [ObjGtkWidget] ObjGtkWidget*
221
222
+Return+ : ObjGtkWidget : the Scol tags table object if is already created or a new Scol object. Nil if error.
223
224 2 iri
Return [[Api]]