ruby-****@sourc*****
ruby-****@sourc*****
2012年 9月 4日 (火) 04:59:00 JST
------------------------- REMOTE_ADDR = 70.49.49.99 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-itrsmrks ------------------------- @@ -31,6 +31,20 @@ Text marks can be accessed in two ways. You can retrieve a text mark at a specific Gtk::TextIter location. It is also possible to set up text mark with a string as its name, which makes it easy to keep track of. + +=== Creating a text mark: + +:create_mark(mark_name, iter, left_gravity) + Creates a mark at position iter. If mark_name is nil, the mark is anonymous; otherwise, the mark can be retrieved by name using Gtk::TextBuffer#get_mark. If a mark has left gravity, and text is inserted at the mark's current location, the mark will be moved to the left of the newly-inserted text. If the mark has right gravity (left_gravity = false), the mark will end up on the right of newly-inserted text. The standard left-to-right cursor is a mark with right gravity (when you type, the cursor stays on the right side of the text you're typing). The caller of this method does not own a reference to the returned Gtk::TextMark, so you can ignore the return value if you like. Marks are owned by the buffer and go away when the buffer does. Emits the "mark_set" signal as notification of the mark's initial placement. + + * mark_name: name for mark(String), or nil + * iter: location to place mark (Gtk::TextIter) + * left_gravity: true if the mark has left gravity, false if the mark has right gravity + * Returns: the new Gtk::TextMark + + + + Two default text marks are always available by GTK+ for every Gtk::TextBuffer: ((*insert*)) and ((*selection_bound.*)) The insert text mark refers to the current cursor position within the buffer. The selection_bound text mark refers to the boundary of selected (highlighted) text if there is any selected text. If there isn't any text selected these two marks will point to the same position. The ((*insert*)) and ((*selection_bound*)) text marks are extremely useful. They can be set to automatically select or deselect text within a buffer and help you figure out where text should be inserted within the buffer.