ruby-****@sourc*****
ruby-****@sourc*****
2009年 2月 6日 (金) 00:24:41 JST
------------------------- REMOTE_ADDR = 74.15.84.244 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-itrsmrks ------------------------- @@ -147,72 +147,12 @@ Subsequently we've learnt how to manipulate the entire buffer. However, it is also useful to edit just a portion of a document. There are quite a number of such methods available to you: ---- insert(iter, text) - - Inserts the text at position iter. Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal. iter is invalidated when insertion occurs (because the buffer contents change), but the default signal handler revalidates it to point to the end of the inserted text. - * iter : a position in the buffer (Gtk::TextIter) - * text : UTF-8 format text to insert - * Returns: self - ---- insert(iter, text, tag1, tag2, tag3, ...) - - Inserts text into buffer at iter, applying an array of tags to the newly-inserted text. Equivalent to calling Gtk::TextBuffer#insert(iter, text), then Gtk::TextBuffer#apply_tag on the inserted text. - * iter: an iterator in buffer - * text: UTF-8 text - * tag1, tag2, tag3, ...: tags(tag name of String or Gtk::TextTag) - * Returns: self - ---- insert(iter, pixbuf) - - Inserts an image into the text buffer at iter. The image will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode "object replacement character" 0xFFFC. Note that the "slice" variants for obtaining portions of the buffer as a string include this character for pixbufs, but the "text" variants do not. e.g. see Gtk::TextBuffer#get_slice and Gtk::TextBuffer#get_text. - * iter: location to insert the pixbuf (Gtk::TextIter) - * pixbuf: a Gdk::Pixbuf - * Returns: self - ---- insert(iter, anchor) - - Inserts a child widget anchor into the text buffer at iter. The anchor will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode "object replacement character" 0xFFFC. Note that the "slice" variants for obtaining portions of the buffer as a string include this character for child anchors, but the "text" variants do not. e.g. see Gtk::TextBuffer#get_slice and Gtk::TextBuffer#get_text. Consider Gtk::TextBuffer#create_child_anchor as a more convenient alternative to this method. The buffer will add a reference to the anchor, so you can unref it after insertion. - * iter: location to insert the anchor (Gtk::TextIter) - * anchor: a Gtk::TextChildAnchor - * Returns: self - ---- insert_at_cursor(text) - - Simply calls Gtk::TextBuffer#insert, using the current cursor position as the insertion point. - * text: some text in UTF-8 format - * Returns: self - ---- insert_interactive(iter, text, default_editable) - - Like Gtk::TextBuffer#insert, but the insertion will not occur if iter is at a non-editable location in the buffer. Usually you want to prevent insertions at ineditable locations if the insertion results from a user action (is interactive). - default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result of Gtk::TextView#editable? is appropriate here. - * iter : a position in buffer (Gtk::TextIter) - * text : some UTF-8 text - * default_editable : default editability of buffer(true or false) - * Returns : true if the text was actually inserted - ---- insert_interactive_at_cursor(text, default_editable) - - Calls Gtk::TextBuffer#insert_interactive at the cursor position. - default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result of Gtk::TextView#editable? is appropriate here. - * text : text in UTF-8 format - * default_editable : default editability of buffer (true or false) - * Returns : true if text was actually inserted - ---- insert_range(iter, start, end) - - Copies text, tags, and pixbufs between start and end (the order of start and end doesn't matter) and inserts the copy at iter. Used instead of simply getting/inserting text because it preserves images and tags. If start and end are in a different buffer from buffer, the two buffers must share the same tag table. - Implemented via emissions of the insert_text and apply_tag signals, so expect those. - * iter: a position in buffer (Gtk::TextIter) - * start: a position in a Gtk::TextBuffer (Gtk::TextIter) - * end: another position in the same buffer as start (Gtk::TextIter) - * Returns: self - ---- insert_range_interactive(iter, start, end, default_editable) - - Same as Gtk::TextBuffer#insert_range, but does nothing if the insertion point isn't editable. The default_editable parameter indicates whether the text is editable at iter if no tags enclosing iter affect editability. Typically the result of Gtk::TextView#editable? is appropriate here. - * iter : a position in buffer (Gtk::TextIter) - * start : a position in a Gtk::TextBuffer (Gtk::TextIter) - * end : another position in the same buffer as start (Gtk::TextIter) - * default_editable : default editability of the buffer (true or false) - * Returns : true if an insertion was possible at iter +* insert(iter, text) +* insert(iter, text, tag1, tag2, tag3, ...) +* insert(iter, pixbuf) +* insert(iter, anchor) +* insert_at_cursor(text) +* insert_interactive(iter, text, default_editable) +* insert_interactive_at_cursor(text, default_editable) +* insert_range(iter, start, end) +* insert_range_interactive(iter, start, end, default_editable)