// Generated by gmmproc 2.84.0 -- DO NOT MODIFY! #ifndef _GTKMM_TEXT_H #define _GTKMM_TEXT_H #include #include /* Copyright (C) 2019 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 . */ #include #include #include #include #include #include #ifndef DOXYGEN_SHOULD_SKIP_THIS using GtkText = struct _GtkText; using GtkTextClass = struct _GtkTextClass; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ #ifndef DOXYGEN_SHOULD_SKIP_THIS namespace Gtk { class GTKMM_API Text_Class; } // namespace Gtk #endif //DOXYGEN_SHOULD_SKIP_THIS namespace Gtk { //TODO: Derive from (and implement) AccessibleText when we can break ABI. /** A simple single-line text entry field. * * The %Gtk::Text widget is a single-line text entry widget. * A fairly large set of key bindings are supported by default. If the * entered text is longer than the allocation of the widget, the widget * will scroll so that the cursor position is visible. * * When using an entry for passwords and other sensitive information, * it can be put into “password mode” using set_visibility(). * In this mode, entered text is displayed using an “invisible” character. * By default, GTK picks the best invisible character that is available * in the current font, but it can be changed with set_invisible_char(). * * If you are looking to add icons or progress display in an entry, look * at Gtk::Entry. There are other alternatives for more specialized use cases, * such as Gtk::SearchEntry. * If you need multi-line editable text, look at Gtk::TextView. * * @see Entry, TextView * @newin{3,96} * * @ingroup Widgets */ class GTKMM_API Text : public Widget, public Editable { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef Text CppObjectType; typedef Text_Class CppClassType; typedef GtkText BaseObjectType; typedef GtkTextClass BaseClassType; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ Text(Text&& src) noexcept; Text& operator=(Text&& src) noexcept; // noncopyable Text(const Text&) = delete; Text& operator=(const Text&) = delete; ~Text() noexcept override; #ifndef DOXYGEN_SHOULD_SKIP_THIS private: friend GTKMM_API class Text_Class; static CppClassType text_class_; protected: explicit Text(const Glib::ConstructParams& construct_params); explicit Text(GtkText* castitem); #endif /* DOXYGEN_SHOULD_SKIP_THIS */ public: /** 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. GtkText* gobj() { return reinterpret_cast(gobject_); } /// Provides access to the underlying C GObject. const GtkText* gobj() const { return reinterpret_cast(gobject_); } private: public: Text(); explicit Text(const Glib::RefPtr& buffer); /** Get the entry buffer object which holds the text for * this widget. * * @return The entry buffer object. */ Glib::RefPtr get_buffer(); /** Get the entry buffer object which holds the text for * this widget. * * @return The entry buffer object. */ Glib::RefPtr get_buffer() const; /** Set the entry buffer object which holds the text for * this widget. * * @param buffer An entry buffer object. */ void set_buffer(const Glib::RefPtr& buffer); /** Sets whether the contents of the text widget are visible or not. * * When visibility is set to false, characters are displayed * as the invisible char, and it will also appear that way when * the text in the widget is copied to the clipboard. * * By default, GTK picks the best invisible character available * in the current font, but it can be changed with * set_invisible_char(). * * Note that you probably want to set property_input_purpose() * to [enum@Gtk.InputPurpose.password] or [enum@Gtk.InputPurpose.pin] * to inform input methods about the purpose of this widget, in addition * to setting visibility to false. * * @param visible True if the contents of the text widget are displayed * as plain text. */ void set_visibility(bool visible = true); /** Retrieves whether the text is visible. * * @return True if the text is visible. */ bool get_visibility() const; /** Sets the character to use when in “password mode”. * * By default, GTK picks the best invisible char available in the * current font. If you set the invisible char to 0, then the user * will get no feedback at all; there will be no text on the screen * as they type. * * @param ch A Unicode character. */ void set_invisible_char(gunichar ch); /** Unsets the invisible char. * * After calling this, the default invisible char is used again. */ void unset_invisible_char(); /** Retrieves the character displayed when visibility is set to false. * * Note that GTK does not compute this value unless it needs it, * so the value returned by this function is not very useful unless * it has been explicitly set with set_invisible_char(). * * @return The current invisible char, or 0, if @a text does not * show invisible text at all. */ gunichar get_invisible_char() const; /** Sets whether the text is overwritten when typing. * * @param overwrite New value. */ void set_overwrite_mode(bool overwrite = true); /** Gets whether text is overwritten when typing. * * See set_overwrite_mode(). * * @return Whether text is overwritten when typing. */ bool get_overwrite_mode() const; /** Sets the maximum allowed length of the contents. * * If the current contents are longer than the given length, * they will be truncated to fit. * * This is equivalent to getting @a self's `Gtk::EntryBuffer` and * calling Gtk::EntryBuffer::set_max_length() on it. * * @param max The maximum length of the text, or 0 for no maximum. * (other than the maximum length of entries.) The value passed * in will be clamped to the range 0-65536. */ void set_max_length(int max); /** Retrieves the maximum allowed length of the contents. * * See set_max_length(). * * This is equivalent to getting @a self's `Gtk::EntryBuffer` and * calling Gtk::EntryBuffer::get_max_length() on it. * * @return The maximum allowed number of characters, or 0 if * there is no limit. */ int get_max_length() const; /** Retrieves the length of the contents. * * This is equivalent to getting @a self's `Gtk::EntryBuffer` * and calling Gtk::EntryBuffer::get_length() on it. * * @return The length of the contents, in characters. */ guint16 get_text_length() const; /** Sets whether pressing Enter will activate * the default widget. * * This usually means that the dialog containing @a self will * be closed, since the default widget is usually one of * the dialog buttons. * * @param setting True to activate window’s default widget on * Enter keypress. */ void set_activates_default(bool setting = true); /** Returns whether pressing Enter will activate * the default widget for the window containing the widget. * * See set_activates_default(). * * @return True if @a self will activate the default widget. */ bool get_activates_default() const; /** Retrieves the text that will be displayed when the text widget * is empty and unfocused * * See set_placeholder_text(). * * @return The placeholder text. */ Glib::ustring get_placeholder_text() const; /** Sets the text to be displayed when the text widget is * empty and unfocused. * * This can be used to give a visual hint of the expected * contents of the text widget. * * @param text A string to be displayed when @a self * is empty and unfocused. */ void set_placeholder_text(const Glib::ustring& text); /** Sets the input purpose of the text widget. * * The input purpose can be used by on-screen keyboards * and other input methods to adjust their behaviour. * * @param purpose The input purpose. */ void set_input_purpose(InputPurpose purpose); /** Gets the input purpose of the text widget. * * @return The input purpose. */ InputPurpose get_input_purpose() const; /** Sets hints that allow input methods to fine-tune their behaviour. * * @param hints Input hints. */ void set_input_hints(InputHints hints); /** Gets the input hints of the text widget. * * @return The input hints. */ InputHints get_input_hints() const; /** Apply attributes to the contents of the text widget. * * @param attrs A list of style attributes. */ void set_attributes(Pango::AttrList& attrs); /** Gets the attribute list that was set on the text widget. * * See set_attributes(). * * @return The attribute list. */ Pango::AttrList get_attributes() const; /** Sets tab stops for the text widget. * * @param tabs Tab stops. */ void set_tabs(const Pango::TabArray& tabs); /** Gets the tab stops for the text widget. * * See set_tabs(). * * @return The tab stops. */ Pango::TabArray get_tabs() const; /** Causes the text widget to have the keyboard focus. * * It behaves like Gtk::Widget::grab_focus(), * except that it does not select the contents of @a self. * * You only want to call this on some special entries * which the user usually doesn't want to replace all * text in, such as search-as-you-type entries. * * @return True if focus is now inside @a self. */ bool grab_focus_without_selecting(); /** Sets a menu model to add to the context menu of the text widget. * * @param model A menu model. */ void set_extra_menu(const Glib::RefPtr& model); /** Gets the extra menu model of the text widget. * * See set_extra_menu(). * * @return The menu model. */ Glib::RefPtr get_extra_menu(); /** Gets the extra menu model of the text widget. * * See set_extra_menu(). * * @return The menu model. */ Glib::RefPtr get_extra_menu() const; /** Sets whether Emoji completion is enabled. * * If it is, typing ':', followed by a recognized keyword, * will pop up a window with suggested Emojis matching the * keyword. * * @param enable_emoji_completion True to enable Emoji completion. */ void set_enable_emoji_completion(bool enable_emoji_completion = true); /** Returns whether Emoji completion is enabled. * * @return True if Emoji completion is enabled. */ bool get_enable_emoji_completion() const; /** Sets whether the text widget should grow and shrink with the content. * * @param propagate_text_width True to propagate the text width. */ void set_propagate_text_width(bool propagate_text_width = true); /** Returns whether the text widget will grow and shrink * with the content. * * @return True if @a self will propagate the text width. */ bool get_propagate_text_width() const; /** Sets whether pasted text should be truncated to the first line. * * @param truncate_multiline True to truncate multi-line text. */ void set_truncate_multiline(bool truncate_multiline = true); /** Returns whether pasted text will be truncated to the first line. * * @return True if @a self will truncate pasted multi-line text. */ bool get_truncate_multiline() const; // Action signals // no_default_handler because GtkTextClass is private. /** * @par Slot Prototype: * void on_my_%activate() * * Flags: Run Last, Action * * Emitted when the user hits the Enter key. * * The default bindings for this signal are all forms * of the Enter key. * * @newin{4,18} */ Glib::SignalProxy signal_activate(); /** The `Gtk::EntryBuffer` object which stores the text. * * @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::RefPtr > property_buffer() ; /** The `Gtk::EntryBuffer` object which stores the text. * * @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_buffer() const; /** Maximum number of characters that are allowed. * * Zero indicates no limit. * * Default value: 0 * * @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< int > property_max_length() ; /** Maximum number of characters that are allowed. * * Zero indicates no limit. * * 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_max_length() const; /** If false, the text is masked with the “invisible char”. * * 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_visibility() ; /** If false, the text is masked with the “invisible char”. * * 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_visibility() const; /** The character to used when masking contents (in “password mode”). * * Default value: 42 * * @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< gunichar > property_invisible_char() ; /** The character to used when masking contents (in “password mode”). * * Default value: 42 * * @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< gunichar > property_invisible_char() const; /** Whether the invisible char has been set. * * Default value: false * * @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_invisible_char_set() ; /** Whether the invisible char has been set. * * 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_invisible_char_set() const; /** Whether to activate the default widget when Enter is pressed. * * Default value: false * * @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_activates_default() ; /** Whether to activate the default widget when Enter is pressed. * * 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_activates_default() const; /** Number of pixels scrolled of the screen to the left. * * 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_scroll_offset() const; /** When true, pasted multi-line text is truncated to the first line. * * Default value: false * * @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_truncate_multiline() ; /** When true, pasted multi-line text is truncated to the first line. * * 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_truncate_multiline() const; /** If text is overwritten when typing. * * Default value: false * * @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_overwrite_mode() ; /** If text is overwritten when typing. * * 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_overwrite_mode() const; /** Which input method module should be used. * * See Gtk::IMMulticontext. * * Setting this to a non-nullptr value overrides the system-wide * input method. See the Gtk::Settings::property_gtk_im_module() * setting. * * 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_im_module() ; /** Which input method module should be used. * * See Gtk::IMMulticontext. * * Setting this to a non-nullptr value overrides the system-wide * input method. See the Gtk::Settings::property_gtk_im_module() * setting. * * 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_im_module() const; /** The text that will be displayed in the `Gtk::Text` when it is empty * and unfocused. * * 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_placeholder_text() ; /** The text that will be displayed in the `Gtk::Text` when it is empty * and unfocused. * * 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_placeholder_text() const; /** The purpose of this text field. * * This information can be used by on-screen keyboards and other input * methods to adjust their behaviour. * * Note that setting the purpose to [enum@Gtk.InputPurpose.password] * or [enum@Gtk.InputPurpose.pin] is independent from setting * property_visibility(). * * Default value: Gtk::InputPurpose::FREE_FORM * * @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< InputPurpose > property_input_purpose() ; /** The purpose of this text field. * * This information can be used by on-screen keyboards and other input * methods to adjust their behaviour. * * Note that setting the purpose to [enum@Gtk.InputPurpose.password] * or [enum@Gtk.InputPurpose.pin] is independent from setting * property_visibility(). * * Default value: Gtk::InputPurpose::FREE_FORM * * @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< InputPurpose > property_input_purpose() const; /** Additional hints that allow input methods to fine-tune * their behaviour. * * Default value: Gtk::InputHints::NONE * * @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< InputHints > property_input_hints() ; /** Additional hints that allow input methods to fine-tune * their behaviour. * * Default value: Gtk::InputHints::NONE * * @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< InputHints > property_input_hints() const; /** A list of Pango attributes to apply to the text. * * This is mainly useful to change the size or weight of the text. * * The `Pango::Attribute`'s @a start_index and @a end_index must refer to the * `Gtk::EntryBuffer` text, i.e. without the preedit string. * * @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< Pango::AttrList > property_attributes() ; /** A list of Pango attributes to apply to the text. * * This is mainly useful to change the size or weight of the text. * * The `Pango::Attribute`'s @a start_index and @a end_index must refer to the * `Gtk::EntryBuffer` text, i.e. without the preedit string. * * @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< Pango::AttrList > property_attributes() const; /** Custom tabs for this text widget. * * @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< Pango::TabArray > property_tabs() ; /** Custom tabs for this text widget. * * @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< Pango::TabArray > property_tabs() const; /** Whether to suggest Emoji replacements. * * Default value: false * * @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_emoji_completion() ; /** Whether to suggest Emoji replacements. * * 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_enable_emoji_completion() const; /** Whether the widget should grow and shrink with the content. * * Default value: false * * @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_propagate_text_width() ; /** Whether the widget should grow and shrink with the content. * * 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_propagate_text_width() const; /** A menu model whose contents will be appended to the context menu. * * @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::RefPtr > property_extra_menu() ; /** A menu model whose contents will be appended to the context menu. * * @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_extra_menu() const; public: public: //C++ methods used to invoke GTK+ virtual functions: protected: //GTK+ Virtual Functions (override these to change behaviour): //Default Signal Handlers:: }; } //namespace Gtk 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::Text */ GTKMM_API Gtk::Text* wrap(GtkText* object, bool take_copy = false); } //namespace Glib #endif /* _GTKMM_TEXT_H */