// Generated by gmmproc 2.84.0 -- DO NOT MODIFY! #ifndef _GTKMM_TEXTBUFFER_H #define _GTKMM_TEXTBUFFER_H #include #include #include /* 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: #include #include #include #include #include #include #include #include #include #include #ifndef DOXYGEN_SHOULD_SKIP_THIS using GtkTextBuffer = struct _GtkTextBuffer; using GtkTextBufferClass = struct _GtkTextBufferClass; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ #ifndef DOXYGEN_SHOULD_SKIP_THIS namespace Gtk { class GTKMM_API TextBuffer_Class; } // namespace Gtk #endif //DOXYGEN_SHOULD_SKIP_THIS namespace Gtk { /** 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 * or a @link Gtk::TextConstIter const_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 { #ifndef DOXYGEN_SHOULD_SKIP_THIS public: using CppObjectType = TextBuffer; using CppClassType = TextBuffer_Class; using BaseObjectType = GtkTextBuffer; using BaseClassType = GtkTextBufferClass; // noncopyable TextBuffer(const TextBuffer&) = delete; TextBuffer& operator=(const TextBuffer&) = delete; private: friend class TextBuffer_Class; static CppClassType textbuffer_class_; protected: explicit TextBuffer(const Glib::ConstructParams& construct_params); explicit TextBuffer(GtkTextBuffer* castitem); #endif /* DOXYGEN_SHOULD_SKIP_THIS */ public: TextBuffer(TextBuffer&& src) noexcept; TextBuffer& operator=(TextBuffer&& src) noexcept; ~TextBuffer() noexcept override; /** Get the GType for this class, for use with the underlying GObject type system. */ static GType get_type() G_GNUC_CONST; #ifndef DOXYGEN_SHOULD_SKIP_THIS static GType get_base_type() G_GNUC_CONST; #endif ///Provides access to the underlying C GObject. GtkTextBuffer* gobj() { return reinterpret_cast(gobject_); } ///Provides access to the underlying C GObject. const GtkTextBuffer* gobj() const { return reinterpret_cast(gobject_); } ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. GtkTextBuffer* gobj_copy(); private: public: typedef TextIter iterator; typedef TextConstIter const_iterator; typedef TextTag Tag; typedef TextTagTable TagTable; typedef TextMark Mark; typedef TextChildAnchor ChildAnchor; protected: TextBuffer(); explicit TextBuffer(const Glib::RefPtr& tag_table); public: /** @addtogroup gtkmmEnums gtkmm Enums and Flags */ /** * @var NotifyFlags::BEFORE_INSERT * Be notified before text * is inserted into the underlying buffer. * * @var NotifyFlags::AFTER_INSERT * Be notified after text * has been inserted into the underlying buffer. * * @var NotifyFlags::BEFORE_DELETE * Be notified before text * is deleted from the underlying buffer. * * @var NotifyFlags::AFTER_DELETE * Be notified after text * has been deleted from the underlying buffer. */ /** Values for [callback@Gtk.TextBufferCommitNotify] to denote the * point of the notification. * * @newin{4,16} * * @ingroup gtkmmEnums * @par Bitwise operators: * TextBuffer::NotifyFlags operator|(TextBuffer::NotifyFlags, TextBuffer::NotifyFlags)
* TextBuffer::NotifyFlags operator&(TextBuffer::NotifyFlags, TextBuffer::NotifyFlags)
* TextBuffer::NotifyFlags operator^(TextBuffer::NotifyFlags, TextBuffer::NotifyFlags)
* TextBuffer::NotifyFlags operator~(TextBuffer::NotifyFlags)
* TextBuffer::NotifyFlags& operator|=(TextBuffer::NotifyFlags&, TextBuffer::NotifyFlags)
* TextBuffer::NotifyFlags& operator&=(TextBuffer::NotifyFlags&, TextBuffer::NotifyFlags)
* TextBuffer::NotifyFlags& operator^=(TextBuffer::NotifyFlags&, TextBuffer::NotifyFlags)
*/ enum class NotifyFlags { BEFORE_INSERT = 1 << 0, AFTER_INSERT = 1 << 1, BEFORE_DELETE = 1 << 2, AFTER_DELETE = 1 << 3 }; static Glib::RefPtr create(); static Glib::RefPtr create(const Glib::RefPtr& tag_table); /** Obtains the number of lines in the buffer. * * This value is cached, so the function is very fast. * * @return Number of lines in the buffer. */ int get_line_count() const; /** Gets the number of characters in the buffer. * * Note that characters and bytes are not the same, you can’t e.g. * expect the contents of the buffer in string form to be this * many bytes long. * * The character count is cached, so this function is very fast. * * @return Number of characters in the buffer. */ int get_char_count() const; /// See get_char_count(). int size() const; /** Get the `Gtk::TextTagTable` associated with this buffer. * * @return The buffer’s tag table. */ Glib::RefPtr get_tag_table(); /** Get the `Gtk::TextTagTable` associated with this buffer. * * @return The buffer’s tag table. */ Glib::RefPtr get_tag_table() const; /** 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); //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. */ 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. */ 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 paintable 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 const_iterator& range_begin, const const_iterator& range_end); /** 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 const_iterator& range_begin, const const_iterator& range_end, bool default_editable = true); 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); /* 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); /** 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. */ iterator backspace(const iterator& iter, bool interactive = true, bool default_editable = true); /** Returns the text in the range [ @a range_start, @a range_end). * * 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 range_start Start of a range. * @param range_end End of a range. * @param include_hidden_chars Whether to include invisible text. * @return An allocated UTF-8 string. */ Glib::ustring get_text(const const_iterator& range_start, const const_iterator& range_end, bool include_hidden_chars = true) const; /** 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; /** Returns the text in the range [ @a range_start, @a range_end). * * Excludes undisplayed text (text marked with tags that set the * invisibility attribute) if @a include_hidden_chars is false. * The returned string includes a 0xFFFC character whenever the * buffer contains embedded images, so byte and character indexes * into the returned string do correspond to byte and character * indexes into the buffer. Contrast with get_text(). * Note that 0xFFFC can occur in normal text as well, so it is not a * reliable indicator that a paintable or widget is in the buffer. * * @param range_start Start of a range. * @param range_end End of a range. * @param include_hidden_chars Whether to include invisible text. * @return An allocated UTF-8 string. */ Glib::ustring get_slice(const const_iterator& range_start, const const_iterator& range_end, bool include_hidden_chars = true) const; iterator insert_paintable(const iterator& pos, const Glib::RefPtr& paintable); iterator insert_child_anchor(const iterator& pos, const Glib::RefPtr& anchor); Glib::RefPtr create_child_anchor(const iterator& pos); /** Adds the mark at position @a where. * * The mark must not be added to another buffer, and if its name * is not nullptr then there must not be another mark in the buffer * with the same name. * * Emits the signal_mark_set() signal as notification * of the mark's initial placement. * * @param mark The mark to add. * @param where Location to place mark. */ void add_mark(const Glib::RefPtr& mark, const iterator& where); /** Creates a mark at position @a where. The mark can be retrieved by name using * 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 * ( @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 mark_name Name for mark. * @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 Glib::ustring& mark_name, const iterator& where, bool left_gravity = true); /** 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); /** Moves @a mark to the new location @a where. * * Emits the signal_mark_set() signal * as notification of the move. * * @param mark A `Gtk::TextMark`. * @param where New location for @a mark in @a buffer. */ void move_mark(const Glib::RefPtr& mark, const iterator& where); /** Deletes @a mark, so that it's no longer located anywhere in the * buffer. Removes the reference the buffer holds to the mark, so if * you don't keep a Glib::RefPtr to the mark, it will be freed. Even * if the mark isn't freed, most operations on @a mark become * invalid. There is no way to undelete a * mark. Gtk::TextMark::get_deleted() will return true after this * function has been called on a mark; Gtk::TextMark::get_deleted() * indicates that a mark no longer belongs to a buffer. The "mark_deleted" * signal will be emitted as notification after the mark is deleted. * * @param mark A `Gtk::TextMark` in @a buffer. */ void delete_mark(const Glib::RefPtr& mark); /** Returns the mark named @a name in buffer @a buffer, or nullptr if no such * mark exists in the buffer. * * @param name A mark name. * @return A `Gtk::TextMark`. */ Glib::RefPtr get_mark(const Glib::ustring& name); /** Returns the mark named @a name in buffer @a buffer, or nullptr if no such * mark exists in the buffer. * * @param name A mark name. * @return A `Gtk::TextMark`. */ Glib::RefPtr get_mark(const Glib::ustring& name) const; /** Moves the mark named @a name (which must exist) to location @a where. * * See move_mark() for details. * * @param name Name of a mark. * @param where New location for mark. */ void move_mark_by_name(const Glib::ustring& name, const iterator& where); /** Deletes the mark named @a name; the mark must exist. * * See delete_mark() for details. * * @param name Name of a mark in @a buffer. */ void delete_mark_by_name(const Glib::ustring& name); /** Returns the mark that represents the cursor (insertion point). * * Equivalent to calling get_mark() * to get the mark named “insert”, but very slightly more * efficient, and involves less typing. * * @return Insertion point mark. */ Glib::RefPtr get_insert(); /** Returns the mark that represents the selection bound. * * Equivalent to calling get_mark() * to get the mark named “selection_bound”, but very slightly * more efficient, and involves less typing. * * The currently-selected text in @a buffer is the region between the * “selection_bound” and “insert” marks. If “selection_bound” and * “insert” are in the same place, then there is no current selection. * get_selection_bounds() is another convenient * function for handling the selection, if you just want to know whether * there’s a selection and what its bounds are. * * @return Selection bound mark. */ Glib::RefPtr get_selection_bound(); /** This function moves the “insert” and “selection_bound” marks * simultaneously. * * If you move them to the same place in two steps with * move_mark(), you will temporarily select a * region in between their old and new locations, which can be pretty * inefficient since the temporarily-selected region will force stuff * to be recalculated. This function moves them as a unit, which can * be optimized. * * @param where Where to put the cursor. */ void place_cursor(const iterator& where); /** Emits the “apply-tag” signal on @a buffer. * * The default handler for the signal applies * @a tag to the given range. @a range_start and @a range_end do * not have to be in order. * * @param tag A `Gtk::TextTag`. * @param range_start One bound of range to be tagged. * @param range_end Other bound of range to be tagged. */ void apply_tag(const Glib::RefPtr& tag, const iterator& range_start, const iterator& range_end); /** Emits the “remove-tag” signal. * * The default handler for the signal removes all occurrences * of @a tag from the given range. @a range_start and @a range_end don’t have * to be in order. * * @param tag A `Gtk::TextTag`. * @param range_start One bound of range to be untagged. * @param range_end Other bound of range to be untagged. */ void remove_tag(const Glib::RefPtr& tag, const iterator& range_start, const iterator& range_end); /** Emits the “apply-tag” signal on @a buffer. * * Calls Gtk::TextTagTable::lookup() on the buffer’s * tag table to get a `Gtk::TextTag`, then calls * apply_tag(). * * @param name Name of a named `Gtk::TextTag`. * @param range_start One bound of range to be tagged. * @param range_end Other bound of range to be tagged. */ void apply_tag_by_name(const Glib::ustring& name, const iterator& range_start, const iterator& range_end); /** Emits the “remove-tag” signal. * * Calls Gtk::TextTagTable::lookup() on the buffer’s * tag table to get a `Gtk::TextTag`, then calls * remove_tag(). * * @param name Name of a `Gtk::TextTag`. * @param range_start One bound of range to be untagged. * @param range_end Other bound of range to be untagged. */ void remove_tag_by_name(const Glib::ustring& name, const iterator& range_start, const iterator& range_end); /** Removes all tags in the range between @a range_start and @a range_end. * * Be careful with this function; it could remove tags added in code * unrelated to the code you’re currently writing. That is, using this * function is probably a bad idea if you have two or more unrelated * code sections that add tags. * * @param range_start One bound of range to be untagged. * @param range_end Other bound of range to be untagged. */ void remove_all_tags(const iterator& range_start, const iterator& range_end); /** 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); /** 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); const_iterator get_iter_at_line_offset(int line_number, int char_offset) const; iterator get_iter_at_line_index(int line_number, int byte_index); const_iterator get_iter_at_line_index(int line_number, int byte_index) const; iterator get_iter_at_offset(int char_offset); const_iterator get_iter_at_offset(int char_offset) const; iterator get_iter_at_line(int line_number); const_iterator get_iter_at_line(int line_number) const; iterator begin(); const_iterator begin() const; iterator end(); const_iterator end() const; void get_bounds(iterator& range_begin, iterator& range_end); void get_bounds(const_iterator& range_begin, const_iterator& range_end) const; /** 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 a mark. * @param mark The @link Gtk::TextMark Gtk::TextBuffer::Mark@endlink * @result An iterator that points to the position of the @a mark. */ const_iterator get_iter_at_mark(const Glib::RefPtr& mark) const; /** 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); /** 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. */ const_iterator get_iter_at_child_anchor(const Glib::RefPtr& anchor) const; /** Indicates whether the buffer has been modified since the last call * to set_modified() set the modification flag to * false. * * Used for example to enable a “save” function in a text editor. * * @return true if the buffer has been modified. */ bool get_modified() const; /** Used to keep track of whether the buffer has been * modified since the last time it was saved. * * Whenever the buffer is saved to disk, call * `gtk_text_buffer_set_modified ( @a buffer, false)`. * When the buffer is modified, it will automatically * toggle on the modified bit again. When the modified * bit flips, the buffer emits the * signal_modified_changed() signal. * * @param setting Modification flag setting. */ void set_modified(bool setting = true); /** Indicates whether the buffer has some text currently selected. * * @return true if the there is text selected. */ bool get_has_selection() const; /** Adds @a clipboard to the list of clipboards in which the selection * contents of @a buffer are available. * * In most cases, @a clipboard will be the `Gdk::Clipboard` returned by * Gtk::Widget::get_primary_clipboard() for a view of @a buffer. * * @param clipboard A `Gdk::Clipboard`. */ void add_selection_clipboard(const Glib::RefPtr& clipboard); /** Removes a `Gdk::Clipboard` added with * add_selection_clipboard() * * @param clipboard A `Gdk::Clipboard` added to @a buffer by * add_selection_clipboard(). */ void remove_selection_clipboard(const Glib::RefPtr& clipboard); /** Copies the currently-selected text to a clipboard, * then deletes said text if it’s editable. * * @param clipboard The `Gdk::Clipboard` object to cut to. * @param default_editable Default editability of the buffer. */ void cut_clipboard(const Glib::RefPtr& clipboard, bool default_editable = true); /** Copies the currently-selected text to a clipboard. * * @param clipboard The `Gdk::Clipboard` object to copy to. */ void copy_clipboard(const Glib::RefPtr& clipboard); /** Pastes the contents of a clipboard. * * If @a override_location is nullptr, the pasted text will be inserted * at the cursor position, or the buffer selection will be replaced * if the selection is non-empty. * * @note pasting is asynchronous, that is, we’ll ask for the paste data * and return, and at some point later after the main loop runs, the paste * data will be inserted. * * @param clipboard The `Gdk::Clipboard` to paste from. * @param override_location Location to insert pasted text. * @param default_editable Whether the buffer is editable by default. */ void paste_clipboard(const Glib::RefPtr& clipboard, const iterator& override_location, bool default_editable = true); /// A paste_clipboard() convenience overload. void paste_clipboard(const Glib::RefPtr& clipboard, bool default_editable = true); /** Returns true if some text is selected; places the bounds * of the selection in @a range_start and @a range_end. * * If the selection has length 0, then @a range_start and @a range_end are filled * in with the same value. @a range_start and @a range_end will be in ascending order. * If @a range_start and @a range_end are nullptr, then they are not filled in, but the * return value still indicates whether text is selected. * * @param range_start Iterator to initialize with selection start. * @param range_end Iterator to initialize with selection end. * @return Whether the selection has nonzero length. */ bool get_selection_bounds(iterator& range_start, iterator& range_end); /** Returns true if some text is selected; places the bounds * of the selection in @a range_start and @a range_end. * * If the selection has length 0, then @a range_start and @a range_end are filled * in with the same value. @a range_start and @a range_end will be in ascending order. * If @a range_start and @a range_end are nullptr, then they are not filled in, but the * return value still indicates whether text is selected. * * @param range_start Iterator to initialize with selection start. * @param range_end Iterator to initialize with selection end. * @return Whether the selection has nonzero length. */ bool get_selection_bounds(const_iterator& range_start, const_iterator& range_end) const; /** Deletes the range between the “insert” and “selection_bound” marks, * that is, the currently-selected text. * * If @a interactive is true, the editability of the selection will be * considered (users can’t delete uneditable text). * * @param interactive Whether the deletion is caused by user interaction. * @param default_editable Whether the buffer is editable by default. * @return Whether there was a non-empty selection to delete. */ bool erase_selection(bool interactive = true, bool default_editable = true); // gtk_text_buffer_get_selection_content() gives us a ref. Don't add refreturn. /** Get a content provider for this buffer. * * It can be used to make the content of @a buffer available * in a `Gdk::Clipboard`, see Gdk::Clipboard::set_content(). * * @return A new `Gdk::ContentProvider`. */ Glib::RefPtr get_selection_content(); /** This function moves the “insert” and “selection_bound” marks * simultaneously. * * If you move them in two steps with * move_mark(), you will temporarily select a * region in between their old and new locations, which can be pretty * inefficient since the temporarily-selected region will force stuff * to be recalculated. This function moves them as a unit, which can * be optimized. * * @param ins Where to put the “insert” mark. * @param bound Where to put the “selection_bound” mark. */ void select_range(const iterator& ins, const iterator& bound); /** Gets whether there is an undoable action in the history. * * @return true if there is an undoable action. */ bool get_can_undo() const; /** Gets whether there is a redoable action in the history. * * @return true if there is a redoable action. */ bool get_can_redo() const; /** Gets whether the buffer is saving modifications to the buffer * to allow for undo and redo actions. * * See begin_irreversible_action() and * end_irreversible_action() to create * changes to the buffer that cannot be undone. * * @return true if undoing and redoing changes to the buffer is allowed. */ bool get_enable_undo() const; /** Sets whether or not to enable undoable actions in the text buffer. * * Undoable actions in this context are changes to the text content of * the buffer. Changes to tags and marks are not tracked. * * If enabled, the user will be able to undo the last number of actions * up to get_max_undo_levels(). * * See begin_irreversible_action() and * end_irreversible_action() to create * changes to the buffer that cannot be undone. * * @param enable_undo true to enable undo. */ void set_enable_undo(bool enable_undo = true); /** Gets the maximum number of undo levels to perform. * * If 0, unlimited undo actions may be performed. Note that this may * have a memory usage impact as it requires storing an additional * copy of the inserted or removed text within the text buffer. * * @return The max number of undo levels allowed (0 indicates unlimited). */ guint get_max_undo_levels() const; /** Sets the maximum number of undo levels to perform. * * If 0, unlimited undo actions may be performed. Note that this may * have a memory usage impact as it requires storing an additional * copy of the inserted or removed text within the text buffer. * * @param max_undo_levels The maximum number of undo actions to perform. */ void set_max_undo_levels(guint max_undo_levels); /** Undoes the last undoable action on the buffer, if there is one. */ void undo(); /** Redoes the next redoable action on the buffer, if there is one. */ void redo(); /** Denotes the beginning of an action that may not be undone. * * This will cause any previous operations in the undo/redo queue * to be cleared. * * This should be paired with a call to * end_irreversible_action() after the irreversible * action has completed. * * You may nest calls to begin_irreversible_action() * and end_irreversible_action() pairs. */ void begin_irreversible_action(); /** Denotes the end of an action that may not be undone. * * This will cause any previous operations in the undo/redo * queue to be cleared. * * This should be called after completing modifications to the * text buffer after begin_irreversible_action() * was called. * * You may nest calls to begin_irreversible_action() * and end_irreversible_action() pairs. */ void end_irreversible_action(); /** Called to indicate that the buffer operations between here and a * call to end_user_action() are part of a single * user-visible operation. * * The operations between begin_user_action() and * end_user_action() can then be grouped when creating * an undo stack. `Gtk::TextBuffer` maintains a count of calls to * begin_user_action() that have not been closed with * a call to end_user_action(), and emits the * “begin-user-action” and “end-user-action” signals only for the * outermost pair of calls. This allows you to build user actions * from other user actions. * * The “interactive” buffer mutation functions, such as * insert_interactive(), automatically call * begin/end user action around the buffer operations they perform, * so there's no need to add extra calls if you user action consists * solely of a single call to one of those functions. */ void begin_user_action(); /** Ends a user-visible operation. * * Should be paired with a call to * begin_user_action(). * See that function for a full explanation. */ void end_user_action(); /** A notification callback used by add_commit_notify(). * * For instance: * @code * void on_commit_notify(NotifyFlags flags, guint position, guint length); * @endcode * * You may not modify the %TextBuffer from a %SlotCommitNotify callback * and that is enforced by the %Gtk::TextBuffer API. * * A %SlotCommitNotify callback may be used to be notified about * changes to the underlying buffer right before-or-after the changes are * committed to the underlying B-Tree. This is useful if you want to observe * changes to the buffer without other signal handlers potentially modifying * state on the way to the default signal handler. * * When @a flags is Gtk::TextBuffer::NotifyFlags::BEFORE_INSERT, @a position is set to * the offset in characters from the start of the buffer where the insertion * will occur. @a length is set to the number of characters to be inserted. You * may not yet retrieve the text until it has been inserted. You may access the * text from Gtk::TextBuffer::NotifyFlags::AFTER_INSERT using get_slice(). * * When @a flags is Gtk::TextBuffer::NotifyFlags::AFTER_INSERT, @a position is set to * offset in characters where the insertion occurred and @a length is set * to the number of characters inserted. * * When @a flags is Gtk::TextBuffer::NotifyFlags::BEFORE_DELETE, @a position is set to * offset in characters where the deletion will occur and @a length is set * to the number of characters that will be removed. You may still retrieve * the text from this handler using @a position and @a length. * * When @a flags is Gtk::TextBuffer::NotifyFlags::AFTER_DELETE, @a length is set to * zero to denote that the delete-range has already been committed to the * underlying B-Tree. You may no longer retrieve the text that has been * deleted from the %Gtk::TextBuffer. * * @param flags The type of commit notification. * @param position The position of the text operation. * @param length The length of the text operation in characters. * * @newin{4,16} */ using SlotCommitNotify = sigc::slot; /** Adds a SlotCommitNotify to be called when a change * is to be made to the %Gtk::TextBuffer. * * Functions are explicitly forbidden from making changes to the * %Gtk::TextBuffer from this callback. It is intended for tracking * changes to the buffer only. * * It may be advantageous to use %add_commit_notify() over connecting * to signal_insert() or signal_erase() to avoid ordering issues with * other signal handlers which may further modify the %Gtk::TextBuffer. * * @newin{4,16} * * @param flags Which notifications should be dispatched to @a slot. * @param slot A SlotCommitNotify to call for commit notifications. * @return A handler id which may be used to remove the commit notify * callback using remove_commit_notify(). */ guint add_commit_notify(NotifyFlags flags, const SlotCommitNotify& slot); /** Removes the SlotCommitNotify handler previously registered with add_commit_notify(). * * @newin{4,16} * * @param commit_notify_handler The notify handler identifier returned from * add_commit_notify(). */ void remove_commit_notify(guint commit_notify_handler); /** * @par Slot Prototype: * void on_my_%insert(TextBuffer::iterator& pos, const Glib::ustring& text, int bytes) * * Flags: Run Last * * Emitted to insert text in a `Gtk::TextBuffer`. * * Insertion actually occurs in the default handler. * * Note that if your handler runs before the default handler * it must not invalidate the @a pos iter (or has to * revalidate it). The default signal handler revalidates * it to point to the end of the inserted text. * * See also: Gtk::TextBuffer::insert(), * Gtk::TextBuffer::insert_range(). * * @param pos Position to insert @a text in @a textbuffer. * @param text The UTF-8 text to be inserted. * @param bytes Length of the inserted text in bytes. */ Glib::SignalProxy signal_insert(); /** * @par Slot Prototype: * void on_my_%insert_paintable(TextBuffer::iterator& pos, const Glib::RefPtr& paintable) * * Flags: Run Last * * Emitted to insert a `Gdk::Paintable` in a `Gtk::TextBuffer`. * * Insertion actually occurs in the default handler. * * Note that if your handler runs before the default handler * it must not invalidate the @a pos iter (or has to * revalidate it). The default signal handler revalidates * it to be placed after the inserted @a paintable. * * See also: Gtk::TextBuffer::insert_paintable(). * * @param pos Position to insert @a paintable in @a textbuffer. * @param paintable The `Gdk::Paintable` to be inserted. */ Glib::SignalProxy&)> signal_insert_paintable(); /** * @par Slot Prototype: * void on_my_%insert_child_anchor(TextBuffer::iterator& pos, const Glib::RefPtr& anchor) * * Flags: Run Last * * Emitted to insert a `Gtk::TextChildAnchor` in a `Gtk::TextBuffer`. * * Insertion actually occurs in the default handler. * * Note that if your handler runs before the default handler * it must not invalidate the @a pos iter (or has to * revalidate it). The default signal handler revalidates * it to be placed after the inserted @a anchor. * * See also: Gtk::TextBuffer::insert_child_anchor(). * * @param pos Position to insert @a anchor in @a textbuffer. * @param anchor The `Gtk::TextChildAnchor` to be inserted. */ Glib::SignalProxy&)> signal_insert_child_anchor(); /** * @par Slot Prototype: * void on_my_%erase(TextBuffer::iterator& range_start, TextBuffer::iterator& range_end) * * Flags: Run Last * * Emitted to delete a range from a `Gtk::TextBuffer`. * * Note that if your handler runs before the default handler * it must not invalidate the @a range_start and @a range_end iters (or has * to revalidate them). The default signal handler revalidates * the @a range_start and @a range_end iters to both point to the location * where text was deleted. Handlers which run after the default * handler (see Glib::signal_connect_after()) do not have access to * the deleted text. * * See also: Gtk::TextBuffer::delete(). * * @param range_start The start of the range to be deleted. * @param range_end The end of the range to be deleted. */ Glib::SignalProxy signal_erase(); /** * @par Slot Prototype: * void on_my_%changed() * * Flags: Run Last * * Emitted when the content of a `Gtk::TextBuffer` has changed. */ Glib::SignalProxy signal_changed(); /** * @par Slot Prototype: * void on_my_%modified_changed() * * Flags: Run Last * * Emitted when the modified bit of a `Gtk::TextBuffer` flips. * * See also: Gtk::TextBuffer::set_modified(). */ Glib::SignalProxy signal_modified_changed(); /** * @par Slot Prototype: * void on_my_%mark_set(const TextBuffer::iterator& location, const Glib::RefPtr& mark) * * Flags: Run Last * * Emitted as notification after a `Gtk::TextMark` is set. * * See also: * Gtk::TextBuffer::create_mark(), * Gtk::TextBuffer::move_mark(). * * @param location The location of @a mark in @a textbuffer. * @param mark The mark that is set. */ Glib::SignalProxy&)> signal_mark_set(); /** * @par Slot Prototype: * void on_my_%mark_deleted(const Glib::RefPtr& mark) * * Flags: Run Last * * Emitted as notification after a `Gtk::TextMark` is deleted. * * See also: Gtk::TextBuffer::delete_mark(). * * @param mark The mark that was deleted. */ Glib::SignalProxy&)> signal_mark_deleted(); /** * @par Slot Prototype: * void on_my_%apply_tag(const Glib::RefPtr& tag, const TextBuffer::iterator& range_begin, const TextBuffer::iterator& range_end) * * Flags: Run Last * * Emitted to apply a tag to a range of text in a `Gtk::TextBuffer`. * * Applying actually occurs in the default handler. * * Note that if your handler runs before the default handler * it must not invalidate the @a range_begin and @a range_end iters (or has to * revalidate them). * * See also: * Gtk::TextBuffer::apply_tag(), * Gtk::TextBuffer::insert_with_tags(), * Gtk::TextBuffer::insert_range(). * * @param tag The applied tag. * @param range_begin The start of the range the tag is applied to. * @param range_end The end of the range the tag is applied to. */ Glib::SignalProxy&, const TextBuffer::iterator&, const TextBuffer::iterator&)> signal_apply_tag(); /** * @par Slot Prototype: * void on_my_%remove_tag(const Glib::RefPtr& tag, const TextBuffer::iterator& range_begin, const TextBuffer::iterator& range_end) * * Flags: Run Last * * Emitted to remove all occurrences of @a tag from a range * of text in a `Gtk::TextBuffer`. * * Removal actually occurs in the default handler. * * Note that if your handler runs before the default handler * it must not invalidate the @a range_begin and @a range_end iters (or has * to revalidate them). * * See also: Gtk::TextBuffer::remove_tag(). * * @param tag The tag to be removed. * @param range_begin The start of the range the tag is removed from. * @param range_end The end of the range the tag is removed from. */ Glib::SignalProxy&, const TextBuffer::iterator&, const TextBuffer::iterator&)> signal_remove_tag(); /** * @par Slot Prototype: * void on_my_%begin_user_action() * * Flags: Run Last * * Emitted at the beginning of a single user-visible * operation on a `Gtk::TextBuffer`. * * See also: * Gtk::TextBuffer::begin_user_action(), * Gtk::TextBuffer::insert_interactive(), * Gtk::TextBuffer::insert_range_interactive(), * Gtk::TextBuffer::delete_interactive(), * Gtk::TextBuffer::backspace(), * Gtk::TextBuffer::delete_selection(). */ Glib::SignalProxy signal_begin_user_action(); /** * @par Slot Prototype: * void on_my_%end_user_action() * * Flags: Run Last * * Emitted at the end of a single user-visible * operation on the `Gtk::TextBuffer`. * * See also: * Gtk::TextBuffer::end_user_action(), * Gtk::TextBuffer::insert_interactive(), * Gtk::TextBuffer::insert_range_interactive(), * Gtk::TextBuffer::delete_interactive(), * Gtk::TextBuffer::backspace(), * Gtk::TextBuffer::delete_selection(), * Gtk::TextBuffer::backspace(). */ Glib::SignalProxy signal_end_user_action(); /** * @par Slot Prototype: * void on_my_%paste_done(const Glib::RefPtr& clipboard) * * Flags: Run Last * * Emitted after paste operation has been completed. * * This is useful to properly scroll the view to the end * of the pasted text. See Gtk::TextBuffer::paste_clipboard() * for more details. * * @param clipboard The `Gdk::Clipboard` pasted from. */ Glib::SignalProxy&)> signal_paste_done(); /** * @par Slot Prototype: * void on_my_%redo() * * Flags: Run Last * * Emitted when a request has been made to redo the * previously undone operation. */ Glib::SignalProxy signal_redo(); /** * @par Slot Prototype: * void on_my_%undo() * * Flags: Run Last * * Emitted when a request has been made to undo the * previous operation or set of operations that have * been grouped together. */ Glib::SignalProxy signal_undo(); /** The GtkTextTagTable for the buffer. * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_tag_table() const; /** The text content of the buffer. * * Without child widgets and images, * see Gtk::TextBuffer::get_text() for more information. * * Default value: "" * * @return A PropertyProxy that allows you to get or set the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy< Glib::ustring > property_text() ; /** The text content of the buffer. * * Without child widgets and images, * see Gtk::TextBuffer::get_text() for more information. * * Default value: "" * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::ustring > property_text() const; /** Whether the buffer has some text currently selected. * * Default value: false * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< bool > property_has_selection() const; /** The position of the insert mark. * * This is an offset from the beginning of the buffer. * It is useful for getting notified when the cursor moves. * * Default value: 0 * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< int > property_cursor_position() const; /** Denotes that the buffer can undo the last applied action. * * Default value: false * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< bool > property_can_undo() const; /** Denotes that the buffer can reapply the last undone action. * * Default value: false * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< bool > property_can_redo() const; /** Denotes if support for undoing and redoing changes to the buffer is allowed. * * Default value: true * * @return A PropertyProxy that allows you to get or set the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy< bool > property_enable_undo() ; /** Denotes if support for undoing and redoing changes to the buffer is allowed. * * Default value: true * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< bool > property_enable_undo() const; private: friend TextMark; iterator get_iter_at_mark(GtkTextMark* mark); public: public: //C++ methods used to invoke GTK+ virtual functions: protected: //GTK+ Virtual Functions (override these to change behaviour): //Default Signal Handlers:: /// This is a default handler for the signal signal_insert(). virtual void on_insert(TextBuffer::iterator& pos, const Glib::ustring& text, int bytes); /// This is a default handler for the signal signal_insert_paintable(). virtual void on_insert_paintable(TextBuffer::iterator& pos, const Glib::RefPtr& paintable); /// This is a default handler for the signal signal_insert_child_anchor(). virtual void on_insert_child_anchor(TextBuffer::iterator& pos, const Glib::RefPtr& anchor); /// This is a default handler for the signal signal_erase(). virtual void on_erase(TextBuffer::iterator& range_start, TextBuffer::iterator& range_end); /// This is a default handler for the signal signal_changed(). virtual void on_changed(); /// This is a default handler for the signal signal_modified_changed(). virtual void on_modified_changed(); /// This is a default handler for the signal signal_mark_set(). virtual void on_mark_set(const TextBuffer::iterator& location, const Glib::RefPtr& mark); /// This is a default handler for the signal signal_mark_deleted(). virtual void on_mark_deleted(const Glib::RefPtr& mark); /// This is a default handler for the signal signal_apply_tag(). virtual void on_apply_tag(const Glib::RefPtr& tag, const TextBuffer::iterator& range_begin, const TextBuffer::iterator& range_end); /// This is a default handler for the signal signal_remove_tag(). virtual void on_remove_tag(const Glib::RefPtr& tag, const TextBuffer::iterator& range_begin, const TextBuffer::iterator& range_end); /// This is a default handler for the signal signal_begin_user_action(). virtual void on_begin_user_action(); /// This is a default handler for the signal signal_end_user_action(). virtual void on_end_user_action(); /// This is a default handler for the signal signal_paste_done(). virtual void on_paste_done(const Glib::RefPtr& clipboard); /// This is a default handler for the signal signal_redo(). virtual void on_redo(); /// This is a default handler for the signal signal_undo(). virtual void on_undo(); }; } // namespace Gtk namespace Gtk { /** @ingroup gtkmmEnums */ inline constexpr TextBuffer::NotifyFlags operator|(TextBuffer::NotifyFlags lhs, TextBuffer::NotifyFlags rhs) { return static_cast(static_cast(lhs) | static_cast(rhs)); } /** @ingroup gtkmmEnums */ inline constexpr TextBuffer::NotifyFlags operator&(TextBuffer::NotifyFlags lhs, TextBuffer::NotifyFlags rhs) { return static_cast(static_cast(lhs) & static_cast(rhs)); } /** @ingroup gtkmmEnums */ inline constexpr TextBuffer::NotifyFlags operator^(TextBuffer::NotifyFlags lhs, TextBuffer::NotifyFlags rhs) { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } /** @ingroup gtkmmEnums */ inline constexpr TextBuffer::NotifyFlags operator~(TextBuffer::NotifyFlags flags) { return static_cast(~static_cast(flags)); } /** @ingroup gtkmmEnums */ inline TextBuffer::NotifyFlags& operator|=(TextBuffer::NotifyFlags& lhs, TextBuffer::NotifyFlags rhs) { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } /** @ingroup gtkmmEnums */ inline TextBuffer::NotifyFlags& operator&=(TextBuffer::NotifyFlags& lhs, TextBuffer::NotifyFlags rhs) { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } /** @ingroup gtkmmEnums */ inline TextBuffer::NotifyFlags& operator^=(TextBuffer::NotifyFlags& lhs, TextBuffer::NotifyFlags rhs) { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } } // namespace Gtk #ifndef DOXYGEN_SHOULD_SKIP_THIS namespace Glib { template <> class GTKMM_API Value : public Glib::Value_Flags { public: static GType value_type() G_GNUC_CONST; }; } // namespace Glib #endif /* DOXYGEN_SHOULD_SKIP_THIS */ namespace Glib { /** A Glib::wrap() method for this object. * * @param object The C instance. * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. * @result A C++ instance that wraps this C instance. * * @relates Gtk::TextBuffer */ GTKMM_API Glib::RefPtr wrap(GtkTextBuffer* object, bool take_copy = false); } #endif /* _GTKMM_TEXTBUFFER_H */