Texts » History » Revision 15
Revision 14 (iri, 03/20/2011 08:22 PM) → Revision 15/31 (iri, 03/21/2011 02:31 PM)
{{toc}}
h1. Texts
Widget that displays a text string, typically on multi lines.
!>http://library.gnome.org/devel/gtk/2.21/multiline-text.png!
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.
h2. _gtkTextView
Create a new text object.
Prototype : *fun [Chn ObjGtkWidget S] [ObjGtkWidgetObjGtkWidget]*
table.
|*channel*|Chn|a channel. Can not be nil|
|*buffer*|ObjGtkWidget|a text buffer object. It can be nil; in this case, a default buffer will be created|
|*content*|S|an initial content. It can be nil|
+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.
h2. _gtkTextGetBuffer
Return the current buffer object.
Prototype : *fun [ObjGtkWidget] ObjGtkWidget*
Text object -> buffer object.
h2. _gtkTextGetEditable
Return if a text object is editable or not.
Prototype : *fun [ObjGtkWidget] I*
+Return+ : I : 1 if editable, else 0. Nil if error (object is nil).
h2. _gtkTextSetEditable
Set if a text object is editable or not.
Prototype : *fun [ObjGtkWidget I] ObjGtkWidget*
Set the integer to 1 if the text must be editable, 0 otherwise
+Return+ : ObjGtkWidget : the same text object or nil if error (object is nil).
h1. Buffers
h2. _gtkTextBufferNew
Create a new text buffer object.
Prototype : *fun [Chn ObjGtkWidget] ObjGtkWidget*
table.
|*channel*|Chn|A channel|
|*tagstable*|ObjGtkWidget|A tags table object or nil (in this case, a default table object will be created)|
+Return+ : ObjGtkWidget : a new text buffer object or nil if error
h2. _gtkTextBufferInsert
Insert a string in a position
Prototype : *fun [ObjGtkWidget S I] ObjGtkWidget*
table.
|*buffer*|ObjGtkWidget|Any buffer already created|
|*string*|S|Any string to insert|
|*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the end|
+Return+ : ObjGtkWidget : the same text buffer object or nil if error.
h2. _gtkTextBufferInsertCopy
Copy a string from a buffer (between two positions) to a buffer.
*Bug*
Prototype : *fun [ObjGtkWidget I ObjGtkWidget I I] ObjGtkWidget*
table.
|*buffer*|ObjGtkWidget|Any buffer already created (destination)|
|*position*|I|Any string to insert|
|*buffer*|ObjGtkWidget|Any other buffer already created (source)|
|*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the begin|
|*position*|I|A position. If nil, negative or greater than the current length of the buffer, the position will be the end|
+Return+ : ObjGtkWidget : the same text buffer object or nil if error.
h2. _gtkTextBufferCount
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.
Prototype : *fun [ObjGtkWidget] [I I]*
+Return+ : [I I] : a tuple with the number of lines and the numbers of characters. If error, the function returns nil.
h2. _gtkTextBufferRem
Removes text between _start_ and _end_ positions from a text buffer object.
Prototype : *fun [ObjGtkWidget I I] ObjGtkWidget*
table.
|*buffer*|ObjGtkWidget|any text buffer object already created|
|*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_|
|*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)|
+Return+ : ObjGtkWidget : the same text buffer object or nil if an error occurs.
h2. _gtkTextBufferSet
Set a string to a text buffer object. The old content is overwritten.
Prototype : *fun [ObjGtkWidget S] ObjGtkWidget*
table.
|*buffer*|ObjGtkWidget|any text buffer object|
|*string*|S|any string to set. If nil, the buffer will be empty (as "")|
+Return+ : ObjGtkWidget : the same object or nil if an error occurs.
h2. _gtkTextBufferSetFrom
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.
Prototype : *fun [ObjGtkWidget S I] ObjGtkWidget*
table.
|*buffer*|ObjGtkWidget|any text buffer object|
|*string*|S|any string to set. If nil, the buffer will be empty (as "")|
|*position*|I|a position to begin the treatment. If nil, _position_ will be at 0, if negative, it will be from the end.|
+Return+ : ObjGtkWidget : the same object or nil if an error occurs.
h2. _gtkTextBufferGetTagTable
Gets the tags table associated with a text buffer object.
Prototype : *fun [ObjGtkWidget] ObjGtkWidget*
+Return+ : ObjGtkWidget : the Scol tags table object if is already created or a new Scol object. Nil if error.
Return [[Api]]