Project

General

Profile

Texts » History » Revision 30

Revision 29 (iri, 03/25/2011 12:09 PM) → Revision 30/31 (iri, 03/25/2011 12:23 PM)

{{toc}} 

 h2. _gtkTextLipsum 

 Returns a "LOREM IPSUM" string for the given length 

 Prototype : *fun [I] S* 

 Ask the given length (I) or nil or 0 to return the entire text. 

 +Return+ : S : the LOREM IPSUM. This function does never return nil, it always returns a no-empty string 

 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. _gtkTextNew 

 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. _gtkTextSetBuffer 

 Sets a text buffer object as the buffer being displayed by a text object 

 Protototype : *fun [ObjGtkWidget ObjGtkWidget] ObjGtkWidget* 

 table. 
 |*text*|ObjGtkWidget|any text object already created| 
 |*buffer*|ObjGtkWidget|any text buffer object already created| 

 +Return+ : ObjGtkWidget : the same text object or nil if an error occurs 

 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). 

 h2. _gtkTextInsertWidget 

 Insert a widget in a text object. 

 Prototype : *fun [ObjGtklWidget ObjGtklWidget I] ObjGtklWidget* 

 table. 
 |*text*|ObjGtklWidget|any text object already created| 
 |*child*|ObjGtklWidget|a widget to insert in the text object| 
 |*position*|I|a position where the widget will be inserted| 

 +Return+ : ObjGtklWidget : the same object or, if an error occurs, returns nil. 

 h2. _gtkTextScroll 

 Scrolls text object to the given position. 
 +NOTE+ : this function could be updated and its prototype could be modified. 

 Prototype : *fun [ObjGtkWidget I I I] I* 

 table. 
 |*text*|ObjGtkWidget|a valid text object| 
 |*position*|I|a position of a character| 
 |*alignx*|I|horizontal position displayed of this character : 0 to left, 100 to right, 50, to center, etc| 
 |*aligny*|I|vertical position displayed of this character : 0 to top, 100 to bottom, 50, to center, etc| 

 +Return+ : I : 1 if scrolling occured, else 0. If an error occurs, returns nil. 

 h2. _gtkTextSetBorderSize 

 Sets the width / heigth around the text in a text object 

 !http://www.scolring.org/files/divers/scolring_wiki_gtk_text_border_size.png! 
 ::: @_gtkTextSetBorderSize text [50 10 25 0];@ 

 Prototype : *fun [ObjGtkWidget [I I I I]] ObjGtkWidget* 

 table. 
 |*text*|ObjGtkWidget|a valid text object| 
 |*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| 

 +Return+ : ObjGtkWidget : the same text object or nil if error 

 h2. _gtkTextSetWrap 

 Sets the mode wrap 

 Prototype : *fun [ObjGtkWidget I] ObjGtkWidget* 

 table. 
 |*text*|ObjGtkWidget|a text object| | 
 |*mode*|I|SCOL_GTK_TEXT_WRAP_NONE|default, do not wrap lines; just make the text area wider| 
 | | |SCOL_GTK_TEXT_WRAP_CHAR|wrap text, breaking lines anywhere the cursor can appear| 
 | | |SCOL_GTK_TEXT_WRAP_WORD|wrap text, breaking lines in between words| 
 | | |SCOL_GTK_TEXT_WRAP_WORD_CHAR|wrap text, breaking lines in between words, or if that is not enough, also between graphemes| 

 +Return+ : ObjGtkWidget : the same object or nil if error. 

 h2. _gtkTextGetWrap 

 Returns the current wrap mode 

 Prototype : *fun [ObjGtkWidget] I* 

 +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). 

 h2. _gtkTextShowCursor 

 Sets whether the text cursor (the insertion point) is shown or hidden. 

 Prototype : *fun [ObjGtkWidget I] ObjGtkWidget* 

 table. 
 |*text*|ObjGtkWidget|a text object| 
 |*flag*|I|1 : shown, 0 : hidden| 

 +Return+ : ObjGtkWidget : the same text object or nil if error 



 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. _gtkTextBufferInsertPix 

 Insert an image into a text buffer object, at a given position. 

 Prototype : *fun [ObjGtkWidget P I I I I] ObjGtkWidget* 

 table. 
 |*buffer*|ObjGtkWidget|any valid text buffer object| 
 |*filename*|P|a valid read-reference filename (relative at the Scol partition, of course)| 
 |*position*|I|a position to insert the image| 
 |*width*|I|a given width, or nil to keep the original width| 
 |*height*|I|a given height, or nil to keep the original height| 
 |*ratio*|I|1 to preserve the image's aspect ratio, else 0 or other value| 

 +Return+ : ObjGtkWidget : the same 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. _gtkTextBufferGet 

 Returns the content to a text buffer object, without any invisible characters, without any embedded object. See _gtkTextBufferGetFull below too. 

 Prototype : *fun [ObjGtkWidget] S* 

 +Return+ : S : a string or nil if error. 

 h2. _gtkTextBufferGetFull 

 Returns from a buffer text object a string in the range [_start_, _end_]. 

 Prototype : *fun [ObjGtkWidget I I I I] S* 

 table. 
 |*buffer*|ObjGtkWidget|any text buffer object| | 
 |*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| | 
 |*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.| 
 |*flagA*|I|a flag, whether to include invisible text|SCOL_GTK_TEXT_WITH_HIDDENCHAR to include hidden characters, otherwise 0 or nil| 
 |*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| 

 +Return+ : S : the string or nil if error 

 h2. _gtkTextBufferIsModified 

 Get or Set if the text buffer has been modified since the last call (or its creation) 

 Prototype : *fun [ObjGtkWidget I] I* 

 table. 
 |*buffer*|ObjGtkWidget|a valid text buffer object| 
 |*value*|I|To get the current state, _value_ must be nil| 
 | | |To set a new state, _value_ must be 1 (true, is modified) or should be 0 (false, isn't modified)| 

 +Return+ : I : the current or the new state 

 h2. _gtkTextBufferSelectionRem 

 Delete the currently selected text 

 Prototype : *fun [ObjGtkWidget] ObjGtkWidget* 

 +Return+ : ObjGtkWidget : the same object or nil if error 



 h1. Tags table 

 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]]