GtkTextBuffer
An object for storing and editing text.
Object Hierarchy
Direct Subclasses
Description
A GtkTextBuffer stores text, which can be edited. The
text can then be displayed in one or more GtkTextView
widgets. Text in a buffer can be marked with
GtkTextTag widgets which apply attributes to a range
of text.
Text in PHP-GTK 2 is UTF-8. This means that one character can be encoded
as multiple bytes. Character counts are usually referred to as offsets,
while byte counts are called indexes. If you confuse these two, things
will work fine with ASCII, but as soon as your buffer contains multibyte
characters, bad things will happen.
A combination of GtkTextBuffer and
GtkTextView widgets should be used as instead of the
deprecated GtkText widget.
Example 119. Simple use of GtkTextBuffer.
<?php
// Create a new window.
$window = new GtkWindow();
// Properly handle closing of the window.
$window->connect_simple('destroy', array('Gtk', 'main_quit'));
// Create a new buffer and a new view to show the buffer.
$textBuffer = new GtkTextBuffer();
$textView = new GtkTextView();
// Add some text to the buffer.
$textBuffer->set_text('Hello World!');
// Add the buffer to the view and make sure no one edits the text.
$textView->set_buffer($textBuffer);
$textView->set_editable(false);
// Add the view to the window, show everything, and start the main loop.
$window->add($textView);
$window->show_all();
Gtk::main();
?> |
See also:GtkTextView,
GtkTextTag, GtkTextTagTable,
GtkTextIter, GtkTextMark,
GtkTextChildAnchor
Fields
tag_table:
Signals
"apply-tag"
"begin-user-action"
"changed"
"delete-range"
"end-user-action"
"insert-child-anchor"
"insert-pixbuf"
"insert-text"
"mark-deleted"
"mark-set"
"modified-changed"
"remove-tag"