/* Copyright (C) 1998-2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or(at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ // This is for including the config header before any code (such as // the #ifndef GTKMM_DISABLE_DEPRECATED in deprecated classes) is generated: _CONFIGINCLUDE(gtkmmconfig.h) #include #include #include #include #include #include #include #include #include _DEFS(gtkmm,gtk) _PINCLUDE(glibmm/private/object_p.h) namespace Gtk { class GTKMM_API TextMark; class GTKMM_API TextIter; /** Multi-line attributed text that can be displayed by one or more Gtk::TextView widgets. * * Text in a buffer can be marked with tags. A @link Gtk::TextTag Gtk::TextBuffer::Tag@endlink is an attribute that can be applied to some range of text. For example, a tag * might be called "bold" and make the text inside the tag bold. However, the tag concept is more general than that; tags don't * have to affect appearance. They can instead affect the behavior of mouse and key presses, "lock" a range of text so the user * can't edit it, or countless other things. A tag is represented by a @link Gtk::TextTag Gtk::TextBuffer::Tag@endlink object. * One @link Gtk::TextTag Gtk::TextBuffer::Tag@endlink can be applied to any number of text ranges in any number of @link Gtk::TextBuffer Gtk::TextBuffers@endlink. * * Each tag is stored in a @link Gtk::TextTagTable Gtk::TextBuffer::TagTable@endlink. A tag table defines a set of tags that can be used together. Each buffer has one tag * table associated with it; only tags from that tag table can be used with the buffer. A single tag table can be shared between * multiple buffers, however. * * Most text manipulation is accomplished with iterators, represented by an @link Gtk::TextIter iterator@endlink. The iterator can * be used to navigate over characters, words, lines, and sentences. * * But iterators can't be used to preserve positions across buffer modifications. To preserve a position, the * @link Gtk::TextMark Gtk::TextBuffer::Mark@endlink object is ideal. There are two marks built-in to GtkTextBuffer; these are * named "insert" and "selection_bound" and refer to the insertion point and the boundary of the selection which is not the * insertion point. If no text is selected, these two marks will be in the same position. You can manipulate what is selected and * where the cursor appears by moving these marks around. * * Text buffers always contain at least one line, but may be empty (that is, buffers can contain zero characters). The last line * in the text buffer never ends in a line separator (such as newline); the other lines in the buffer always end in a line * separator. Line separators count as characters when computing character counts and character offsets. Note that some Unicode * line separators are represented with multiple bytes in UTF-8, and the two-character sequence "\r\n" is also considered a line * separator. * * @ingroup TextView */ class GTKMM_API TextBuffer : public Glib::Object { _CLASS_GOBJECT(TextBuffer, GtkTextBuffer, GTK_TEXT_BUFFER, Glib::Object, GObject, , , GTKMM_API) _IGNORE(gtk_text_buffer_get_iter_at_line_offset, gtk_text_buffer_get_iter_at_line_index, gtk_text_buffer_get_iter_at_offset, gtk_text_buffer_get_iter_at_line, gtk_text_buffer_get_start_iter, gtk_text_buffer_get_end_iter, gtk_text_buffer_get_bounds, gtk_text_buffer_get_iter_at_mark, gtk_text_buffer_get_selection_bounds, gtk_text_buffer_insert_interactive, gtk_text_buffer_insert, gtk_text_buffer_insert_at_cursor, gtk_text_buffer_insert_interactive_at_cursor, gtk_text_buffer_insert_with_tags, gtk_text_buffer_insert_with_tags_by_name, gtk_text_buffer_get_iter_at_child_anchor, gtk_text_buffer_insert_markup) public: typedef TextIter iterator; typedef TextTag Tag; typedef TextTagTable TagTable; typedef TextMark Mark; typedef TextChildAnchor ChildAnchor; protected: _CTOR_DEFAULT() explicit TextBuffer(const Glib::RefPtr& tag_table); public: _WRAP_CREATE() _WRAP_CREATE(const Glib::RefPtr& tag_table) _WRAP_METHOD(int get_line_count() const, gtk_text_buffer_get_line_count) _WRAP_METHOD(int get_char_count() const, gtk_text_buffer_get_char_count) /// See get_char_count(). int size() const; _WRAP_METHOD(Glib::RefPtr get_tag_table(), gtk_text_buffer_get_tag_table, refreturn) _WRAP_METHOD(Glib::RefPtr get_tag_table() const, gtk_text_buffer_get_tag_table, refreturn, constversion) /** Removes the current contents of the buffer, and inserts @a text instead. * @param text The text to put in the buffer. */ void set_text(const Glib::ustring& text); /** Removes the current contents of the buffer, and inserts @a text instead. * @param text_begin The start of a UTF8 character array. * @param text_end The end of the UTF8 character array. */ void set_text(const char* text_begin, const char* text_end); _IGNORE(gtk_text_buffer_set_text) //TODO: Make all insert() methods have the same return type: /** Inserts @a text at position @a pos. * Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal. * The @a pos iterator is invalidated when insertion occurs (because the buffer contents change). * * @param pos An iterator pointing to the position at which the text should be inserted. * @param text The text to be inserted in the buffer. * @result An iterator that points to the end of the inserted text. */ iterator insert(const iterator& pos, const Glib::ustring& text); /** Inserts text at position @a pos. * Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal. * The @a pos iterator is invalidated when insertion occurs (because the buffer contents change). * * @param pos An iterator pointing to the position at which the text should be inserted. * @param text_begin The start of a UTF8 character array. * @param text_end The end of the UTF8 character array. * @result An iterator that points to the end of the inserted text. */ iterator insert(const iterator& pos, const char* text_begin, const char* text_end); /** Inserts @a text, using the current cursor position as the insertion point. * Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal. * * @param text The text to be inserted in the buffer. * @result An iterator that points to the end of the inserted text. */ void insert_at_cursor(const Glib::ustring& text); /** Inserts text, using the current cursor position as the insertion point. * Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal. * * @param text_begin The start of a UTF8 character array. * @param text_end The end of the UTF8 character array. * @result An iterator that points to the end of the inserted text. */ void insert_at_cursor(const char* text_begin, const char* text_end); /** Like insert(), but the insertion will not occur if @a 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). * * @a default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. * Typically the result of Gtk::TextView::get_editable() is appropriate here. * * @param pos An iterator pointing to the position at which the text should be inserted. * @param text The text to be inserted in the buffer. * @param default_editable Default editability of buffer * @result Whether text was actually inserted */ std::pair insert_interactive( const iterator& pos, const Glib::ustring& text, bool default_editable = true); /** Like insert(), but the insertion will not occur if @a pos 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). * * @a default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. * Typically the result of Gtk::TextView::get_editable() is appropriate here. * * @param pos An iterator pointing to the position at which the text should be inserted. * @param text_begin The start of a UTF8 character array. * @param text_end The end of the UTF8 character array. * @param default_editable Default editability of buffer. * @result Whether text was actually inserted */ std::pair insert_interactive( const iterator& pos, const char* text_begin, const char* text_end, bool default_editable = true); /** Calls insert_interactive() at the cursor position. * * @a default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. * Typically the result of Gtk::TextView::get_editable() is appropriate here. * * @param text The text to be inserted in the buffer. * @param default_editable Default editability of buffer * @result Whether text was actually inserted */ bool insert_interactive_at_cursor(const Glib::ustring& text, bool default_editable = true); /** Calls insert_interactive() at the cursor position. * * @a default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. * Typically the result of Gtk::TextView::get_editable() is appropriate here. * * @param text_begin The start of a UTF8 character array. * @param text_end The end of the UTF8 character array. * @param default_editable Default editability of buffer * @result Whether text was actually inserted */ bool insert_interactive_at_cursor(const char* text_begin, const char* text_end, bool default_editable = true); /** Copies text, tags, and pixbufs between @a range_begin and @a range_end (the order of range_begin and range_begin doesn't * matter) and inserts the copy at @a pos. Used instead of simply getting/inserting text because it preserves images and tags. * If range_begin and range_end are in a different buffer, the two buffers must share the same tag table. * * Implemented via emissions of the insert_text and apply_tag signals, so expect those. * * @param pos An iterator pointing to the position at which the text should be inserted. * @param range_begin A position in a buffer. * @param range_end Another position in the same buffer as @a range_begin. * @result Whether text was actually inserted */ iterator insert(const iterator& pos, const iterator& range_begin, const iterator& range_end); _IGNORE(gtk_text_buffer_insert_range) /** Same as insert_range(), but does nothing if the insertion point isn't editable. * * The @a default_editable parameter indicates whether the text is editable at @a pos if no tags enclosing @a pos affect editability. * Typically the result of Gtk::TextView::get_editable() is appropriate here. * * @param pos An iterator pointing to the position at which the text should be inserted. * @param range_begin A position in a buffer. * @param range_end Another position in the same buffer as @a range_begin. * @param default_editable Default editability of buffer. * @result Whether text was actually inserted */ std::pair insert_interactive(const iterator& pos, const iterator& range_begin, const iterator& range_end, bool default_editable = true); _IGNORE(gtk_text_buffer_insert_range_interactive) iterator insert_with_tag(const iterator& pos, const Glib::ustring& text, const Glib::RefPtr& tag); iterator insert_with_tag(const iterator& pos, const char* text_begin, const char* text_end, const Glib::RefPtr& tag); iterator insert_with_tag(const iterator& pos, const Glib::ustring& text, const Glib::ustring& tag_name); iterator insert_with_tag(const iterator& pos, const char* text_begin, const char* text_end, const Glib::ustring& tag_name); /** Inserts text into buffer at @a pos, applying the list of tags to the newly-inserted text. * Equivalent to calling insert(), then apply_tag() on the inserted text; This is just a convenience function. * * @param pos An iterator pointing to the position at which the text should be inserted. * @param text The text to be inserted in the buffer. * @param tags A standard C++ container of @link Gtk::TextTag Gtk::TextBuffer::Tags@endlink. * @result Whether text was actually inserted */ iterator insert_with_tags(const iterator& pos, const Glib::ustring& text, const std::vector< Glib::RefPtr >& tags); /** Inserts text into buffer at @a pos, applying the list of tags to the newly-inserted text. * Equivalent to calling insert(), then apply_tag() on the inserted text; This is just a convenience function. * * @param pos An iterator pointing to the position at which the text should be inserted. * @param text_begin The start of a UTF8 character array. * @param text_end The end of the UTF8 character array. * @param tags A standard C++ container of @link Gtk::TextTag Gtk::TextBuffer::Tags@endlink. * @result Whether text was actually inserted */ iterator insert_with_tags(const iterator& pos, const char* text_begin, const char* text_end, const std::vector< Glib::RefPtr >& tags); /** Inserts text into buffer at @a pos, applying the list of tags to the newly-inserted text. * Equivalent to calling insert(), then apply_tag() on the inserted text; This is just a convenience function. * * @param pos An iterator pointing to the position at which the text should be inserted. * @param text The text to be inserted in the buffer. * @param tag_names A standard C++ container of tag names. * @result Whether text was actually inserted */ iterator insert_with_tags_by_name(const iterator& pos, const Glib::ustring& text, const std::vector& tag_names); /** Equivalent to calling insert(), then apply_tag() on the inserted text; This is just a convenience function. * * @param pos An iterator pointing to the position at which the text should be inserted. * @param text_begin The start of a UTF8 character array. * @param text_end The end of the UTF8 character array. * @param tag_names A standard C++ container of tag names. * @result Whether text was actually inserted */ iterator insert_with_tags_by_name(const iterator& pos, const char* text_begin, const char* text_end, const std::vector& tag_names); /** Inserts text in @a markup at position @a pos. * Emits the "insert_text" signal, possibly multiple times; insertion actually occurs in the * default handler for the signal. The @a pos iterator will point to the end of the * inserted text on return. * * @param pos Location to insert the markup. * @param markup The text containing pango markup to be inserted in the buffer. * @result An iterator that points to the end of the inserted markup text. */ iterator insert_markup(const iterator& pos, const Glib::ustring& markup); /** Inserts markup text at position @a pos. * Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal. * The @a pos iterator will point to the end of the inserted text on return. * * @param pos Location to insert the markup. * @param markup_begin The start of a UTF8 character array containing pango markup. * @param markup_end The end of the UTF8 character array containing pango markup. * @result An iterator that points to the end of the inserted markup text. */ iterator insert_markup(const iterator& pos, const char* markup_begin, const char* markup_end); /* Deletes all text between @a range_begin and @a range_end. The order of range_begin and range_end is not actually relevant. * This function actually emits the "delete_range" signal, and the default handler of that signal deletes the text. * Because the buffer is modified, all outstanding iterators become invalid after calling this function. * @param range_begin * @param range_end * @result An iterator that points to the location where text was deleted. */ iterator erase(const iterator& range_begin, const iterator& range_end); _IGNORE(gtk_text_buffer_delete) /* Deletes all editable text between @a range_begin and @a range_end. The order of range_begin and range_end is not actually relevant. * This function actually emits the "delete_range" signal, and the default handler of that signal deletes the text. * Because the buffer is modified, all outstanding iterators become invalid after calling this function. * * @a default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. * Typically the result of Gtk::TextView::get_editable() is appropriate here. * * @param range_begin * @param range_end * @param default_editable Default editability of buffer * @result An iterator that points to the location where text was deleted, or end() is no text was deleted. */ std::pair erase_interactive(const iterator& range_begin, const iterator& range_end, bool default_editable = true); _IGNORE(gtk_text_buffer_delete_interactive) /** Performs the appropriate action as if the user hit the delete * key with the cursor at the position specified by @a iter. In the * normal case a single character will be deleted, but when * combining accents are involved, more than one character can * be deleted, and when precomposed character and accent combinations * are involved, less than one character will be deleted. * * Because the buffer is modified, all outstanding iterators become * invalid after calling this method; however, this method returns * a valid iterator that points to the location where text was deleted. * * @param iter A position in the buffer. * @param interactive Whether the deletion is caused by user interaction. * @param default_editable Whether the buffer is editable by default. * @result An iterator to the location where text was deleted, if the buffer was modified. * * @newin{2,6} */ iterator backspace(const iterator& iter, bool interactive = true, bool default_editable = true); _IGNORE(gtk_text_buffer_backspace) _WRAP_METHOD(Glib::ustring get_text(const iterator& range_start, const iterator& range_end, bool include_hidden_chars = true) const, gtk_text_buffer_get_text) /** Returns all the text in the buffer. Excludes undisplayed * text (text marked with tags that set the invisibility attribute) if * @a include_hidden_chars is false. Does not include characters * representing embedded images, so byte and character indexes into * the returned string do not correspond to byte * and character indexes into the buffer. Contrast with * get_slice(). * * @param include_hidden_chars Whether to include invisible text. * @return An allocated UTF-8 string. */ Glib::ustring get_text(bool include_hidden_chars = true) const; _WRAP_METHOD(Glib::ustring get_slice(const iterator& range_start, const iterator& range_end, bool include_hidden_chars = true) const, gtk_text_buffer_get_slice) iterator insert_pixbuf(const iterator& pos, const Glib::RefPtr& pixbuf); _IGNORE(gtk_text_buffer_insert_pixbuf) iterator insert_child_anchor(const iterator& pos, const Glib::RefPtr& anchor); _IGNORE(gtk_text_buffer_insert_child_anchor) Glib::RefPtr create_child_anchor(const iterator& pos); _IGNORE(gtk_text_buffer_create_child_anchor) _WRAP_METHOD(void add_mark(const Glib::RefPtr& mark, const iterator& where), gtk_text_buffer_add_mark) _WRAP_METHOD(Glib::RefPtr create_mark(const Glib::ustring& mark_name, const iterator& where, bool left_gravity = true), gtk_text_buffer_create_mark, refreturn) /** Create an anonymous mark. */ /** Creates an anonymous mark at position @a where. * * 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 * ( @a 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). * * Emits the "mark_set" signal as notification of the mark's initial * placement. * @param where Location to place mark. * @param left_gravity Whether the mark has left gravity. * @return The new Gtk::TextMark object. */ Glib::RefPtr create_mark(const iterator& where, bool left_gravity = true); _WRAP_METHOD(void move_mark(const Glib::RefPtr& mark, const iterator& where), gtk_text_buffer_move_mark) _WRAP_METHOD(void delete_mark(const Glib::RefPtr& mark), gtk_text_buffer_delete_mark) _WRAP_METHOD(Glib::RefPtr get_mark(const Glib::ustring& name), gtk_text_buffer_get_mark, refreturn) _WRAP_METHOD(Glib::RefPtr get_mark(const Glib::ustring& name) const, gtk_text_buffer_get_mark, refreturn, constversion) _WRAP_METHOD(void move_mark_by_name(const Glib::ustring& name, const iterator& where), gtk_text_buffer_move_mark_by_name) _WRAP_METHOD(void delete_mark_by_name(const Glib::ustring& name), gtk_text_buffer_delete_mark_by_name) _WRAP_METHOD(Glib::RefPtr get_insert(), gtk_text_buffer_get_insert, refreturn) _WRAP_METHOD(Glib::RefPtr get_selection_bound(), gtk_text_buffer_get_selection_bound, refreturn) _WRAP_METHOD(void place_cursor(const iterator& where), gtk_text_buffer_place_cursor) _WRAP_METHOD(void apply_tag(const Glib::RefPtr& tag, const iterator& range_start, const iterator& range_end), gtk_text_buffer_apply_tag) _WRAP_METHOD(void remove_tag(const Glib::RefPtr& tag, const iterator& range_start, const iterator& range_end), gtk_text_buffer_remove_tag) _WRAP_METHOD(void apply_tag_by_name(const Glib::ustring& name, const iterator& range_start, const iterator& range_end), gtk_text_buffer_apply_tag_by_name) _WRAP_METHOD(void remove_tag_by_name(const Glib::ustring& name, const iterator& range_start, const iterator& range_end), gtk_text_buffer_remove_tag_by_name) _WRAP_METHOD(void remove_all_tags(const iterator& range_start, const iterator& range_end), gtk_text_buffer_remove_all_tags) /** Creates a tag and adds it to the tag table for buffer. Equivalent to calling Gtk::TextBuffer::Tag::create() and then adding * the tag to the buffer's tag table. * A tag called @a tag_name must not already exist in the tag table for this buffer. * * @param tag_name The name for the new tag. * @result The new tag. */ Glib::RefPtr create_tag(const Glib::ustring& tag_name); _IGNORE(gtk_text_buffer_create_tag) /** Creates an anoymous tag and adds it to the tag table for buffer. Equivalent to calling Gtk::TextBuffer::Tag::create() and then adding * the tag to the buffer's tag table. * * @result The new tag. */ Glib::RefPtr create_tag(); iterator get_iter_at_line_offset(int line_number, int char_offset); iterator get_iter_at_line_index(int line_number, int byte_index); iterator get_iter_at_offset(int char_offset); iterator get_iter_at_line(int line_number); iterator begin(); iterator end(); void get_bounds(iterator& range_begin, iterator& range_end); /** Get the current position of a mark. * @param mark The @link Gtk::TextMark Gtk::TextBuffer::Mark@endlink * @result An iterator that points to the position of the @a mark. */ iterator get_iter_at_mark(const Glib::RefPtr& mark); /** Get the current position of an anchor. * @param anchor A @link Gtk::TextChildAnchor Gtk::TextBuffer::Anchor@endlink that appears in the buffer. * @result An iterator that points to the position of the @a anchor. */ iterator get_iter_at_child_anchor(const Glib::RefPtr& anchor); _WRAP_METHOD(bool get_modified() const, gtk_text_buffer_get_modified) _WRAP_METHOD(void set_modified(bool setting = true), gtk_text_buffer_set_modified) _WRAP_METHOD(bool get_has_selection() const, gtk_text_buffer_get_has_selection) _WRAP_METHOD(void add_selection_clipboard(const Glib::RefPtr& clipboard), gtk_text_buffer_add_selection_clipboard) _WRAP_METHOD(void remove_selection_clipboard(const Glib::RefPtr& clipboard), gtk_text_buffer_remove_selection_clipboard) _WRAP_METHOD(void cut_clipboard(const Glib::RefPtr& clipboard, bool default_editable = true), gtk_text_buffer_cut_clipboard) _WRAP_METHOD(void copy_clipboard(const Glib::RefPtr& clipboard), gtk_text_buffer_copy_clipboard) void paste_clipboard(const Glib::RefPtr& clipboard, const iterator& override_location, bool default_editable = true); void paste_clipboard(const Glib::RefPtr& clipboard, bool default_editable = true); _IGNORE(gtk_text_buffer_paste_clipboard) _WRAP_METHOD(bool get_selection_bounds(iterator& range_start, iterator& range_end) const, gtk_text_buffer_get_selection_bounds) _WRAP_METHOD(bool erase_selection(bool interactive = true, bool default_editable = true), gtk_text_buffer_delete_selection) _WRAP_METHOD(void select_range(const iterator& ins, const iterator& bound), gtk_text_buffer_select_range) /* Called to specify atomic user actions, used to implement undo */ _WRAP_METHOD(void begin_user_action(), gtk_text_buffer_begin_user_action) _WRAP_METHOD(void end_user_action(), gtk_text_buffer_end_user_action) _WRAP_METHOD(Glib::RefPtr get_copy_target_list() const, gtk_text_buffer_get_copy_target_list, refreturn) _WRAP_METHOD(Glib::RefPtr get_paste_target_list() const, gtk_text_buffer_get_paste_target_list, refreturn) /** For instance,
* guint8* on_serialize(const Glib::RefPtr& content_buffer, const iterator& start, const iterator& end, gsize& length); * * @param content_buffer The TextBuffer to serialize. It may be different from * the TextBuffer where the serialize format is registered. * @param start Start of the block of text to serialize. * @param end End of the block of text to serialize. * @param[out] length The length of the serialized data. * @return A newly-allocated array of guint8 which contains the serialized data, or 0 if an error occurred. */ typedef sigc::slot&, const iterator&, const iterator&, gsize&> SlotSerialize; /** For instance,
* bool on_deserialize(const Glib::RefPtr& content_buffer, iterator& iter, const guint8* data, gsize length, bool create_tags); * * @param content_buffer The TextBuffer to deserialize into. It may be different * from the TextBuffer where the deserialize format is registered. * @param iter Insertion point for the deserialized text. * @param data Data to deserialize. * @param length Length of data. * @param create_tags true if deserializing may create tags. * @return true on success, false otherwise. * @throw Glib::Error If the deserialize slot throws a Glib::Error or an object * derived from Glib::Error, the exception will be propagated out from * the calling deserialize() method. */ typedef sigc::slot&, iterator&, const guint8*, gsize, bool> SlotDeserialize; /** This function registers a rich text serialization @a slot along with * its @a mime_type with this TextBuffer. * * @newin{3,16} * * @param mime_type The format’s mime-type. * @param slot The serialize slot to register. * @return The newly registered format’s mime-type. */ Glib::ustring register_serialize_format(const Glib::ustring& mime_type, const SlotSerialize& slot); _IGNORE(gtk_text_buffer_register_serialize_format) _WRAP_METHOD(Glib::ustring register_serialize_tagset(const Glib::ustring& tagset_name), gtk_text_buffer_register_serialize_tagset) /** This function registers a rich text deserialization @a slot along with * its @a mime_type with this TextBuffer. * * @newin{3,16} * * @param mime_type The format’s mime-type. * @param slot The deserialize slot to register. * @return The newly registered format’s mime-type. */ Glib::ustring register_deserialize_format(const Glib::ustring& mime_type, const SlotDeserialize& slot); _IGNORE(gtk_text_buffer_register_deserialize_format) _WRAP_METHOD(Glib::ustring register_deserialize_tagset(const Glib::ustring& tagset_name), gtk_text_buffer_register_deserialize_tagset) _WRAP_METHOD(void unregister_serialize_format(const Glib::ustring& format), gtk_text_buffer_unregister_serialize_format) _WRAP_METHOD(void unregister_deserialize_format(const Glib::ustring& format), gtk_text_buffer_unregister_deserialize_format) _WRAP_METHOD(void set_can_create_tags(const Glib::ustring& format, bool can_create_tags = true), gtk_text_buffer_deserialize_set_can_create_tags) _WRAP_METHOD(bool get_can_create_tags(const Glib::ustring& format) const, gtk_text_buffer_deserialize_get_can_create_tags) std::vector get_serialize_formats() const; _IGNORE(gtk_text_buffer_get_serialize_formats) std::vector get_deserialize_formats() const; _IGNORE(gtk_text_buffer_get_deserialize_formats) _WRAP_METHOD(guint8* serialize(const Glib::RefPtr& content_buffer, const Glib::ustring& format, const iterator& range_start, const iterator& range_end, gsize& length), gtk_text_buffer_serialize) _WRAP_METHOD(bool deserialize(const Glib::RefPtr& content_buffer, const Glib::ustring& format, iterator& iter, const guint8* data, gsize length), gtk_text_buffer_deserialize, errthrow) #m4begin dnl // HACK: Override the default conversion to deal correctly dnl // with non-0-terminated strings in insert_text_callback(). _CONVERSION(`const char*',`const Glib::ustring&',`Glib::ustring(p1, p1 + p2)') #m4end _WRAP_SIGNAL(void insert(const TextBuffer::iterator& pos, const Glib::ustring& text, int bytes), "insert_text") #m4 _CONVERSION(`GdkPixbuf*',`const Glib::RefPtr&', Glib::wrap($3, true)) _WRAP_SIGNAL(void insert_pixbuf(const TextBuffer::iterator& pos, const Glib::RefPtr& pixbuf), "insert_pixbuf") #m4 _CONVERSION(`GtkTextChildAnchor*',`const Glib::RefPtr&',`Glib::wrap($3, true)') _WRAP_SIGNAL(void insert_child_anchor(const TextBuffer::iterator& pos, const Glib::RefPtr& anchor), "insert_child_anchor") _WRAP_SIGNAL(void erase(const TextBuffer::iterator& range_start, const TextBuffer::iterator& range_end), "delete_range") _WRAP_SIGNAL(void changed(), "changed") _WRAP_SIGNAL(void modified_changed(), "modified_changed") #m4 _CONVERSION(`GtkTextMark*',`const Glib::RefPtr&',`Glib::wrap($3, true)') _WRAP_SIGNAL(void mark_set(const TextBuffer::iterator& location, const Glib::RefPtr& mark), "mark_set") #m4 _CONVERSION(`GtkTextTag*',`const Glib::RefPtr&',`Glib::wrap($3, true)') _WRAP_SIGNAL(void mark_deleted(const Glib::RefPtr& mark), "mark_deleted") _WRAP_SIGNAL(void apply_tag(const Glib::RefPtr& tag, const TextBuffer::iterator& range_begin, const TextBuffer::iterator& range_end), "apply_tag") _WRAP_SIGNAL(void remove_tag(const Glib::RefPtr& tag, const TextBuffer::iterator& range_begin, const TextBuffer::iterator& range_end), "remove_tag") _WRAP_SIGNAL(void begin_user_action(), "begin_user_action") _WRAP_SIGNAL(void end_user_action(), "end_user_action") #m4 _CONVERSION(`GtkClipboard*',`const Glib::RefPtr&', Glib::wrap($3, true)) #m4 _CONVERSION(`const Glib::RefPtr&', `GtkClipboard*', Glib::unwrap($3)) _WRAP_SIGNAL(void paste_done(const Glib::RefPtr& clipboard), "paste_done") _WRAP_PROPERTY("tag-table", Glib::RefPtr) _WRAP_PROPERTY("text", Glib::ustring) _WRAP_PROPERTY("has-selection", bool) _WRAP_PROPERTY("cursor-position", int) _WRAP_PROPERTY("copy-target-list", Glib::RefPtr) _WRAP_PROPERTY("paste-target-list", Glib::RefPtr) }; } // namespace Gtk