[gtkmm] Add Gtk::Text
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Add Gtk::Text
- Date: Tue, 14 May 2019 15:15:49 +0000 (UTC)
commit 2182a1c732e387096d5bfbe406b8b7daf548b093
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Tue May 14 17:12:57 2019 +0200
Add Gtk::Text
.gitignore | 2 +
gtk/gtkmm.h | 1 +
gtk/src/filelist.am | 1 +
gtk/src/text.ccg | 17 ++++++++
gtk/src/text.hg | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 144 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index 927cda83..fdaa32fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -491,6 +491,8 @@ gtk/gtkmm/styleprovider.cc
gtk/gtkmm/styleprovider.h
gtk/gtkmm/switch.cc
gtk/gtkmm/switch.h
+gtk/gtkmm/text.cc
+gtk/gtkmm/text.h
gtk/gtkmm/textbuffer.cc
gtk/gtkmm/textbuffer.h
gtk/gtkmm/textchildanchor.cc
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 3cacde6c..ea048ffa 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -258,6 +258,7 @@ extern const int gtkmm_micro_version;
#include <gtkmm/statusbar.h>
#include <gtkmm/stylecontext.h>
#include <gtkmm/switch.h>
+#include <gtkmm/text.h>
#include <gtkmm/textbuffer.h>
#include <gtkmm/textchildanchor.h>
#include <gtkmm/textiter.h>
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index e600c89d..62a9672f 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -188,6 +188,7 @@ gtkmm_files_any_hg = \
stylecontext.hg \
styleprovider.hg \
switch.hg \
+ text.hg \
textbuffer.hg \
textchildanchor.hg \
textiter.hg \
diff --git a/gtk/src/text.ccg b/gtk/src/text.ccg
new file mode 100644
index 00000000..3663c616
--- /dev/null
+++ b/gtk/src/text.ccg
@@ -0,0 +1,17 @@
+/* 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtk/gtk.h>
diff --git a/gtk/src/text.hg b/gtk/src/text.hg
new file mode 100644
index 00000000..077c92c7
--- /dev/null
+++ b/gtk/src/text.hg
@@ -0,0 +1,123 @@
+/* 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtkmm/widget.h>
+#include <gtkmm/editable.h>
+#include <gtkmm/entrybuffer.h>
+#include <pangomm/attrlist.h>
+#include <pangomm/tabarray.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/widget_p.h)
+
+namespace Gtk
+{
+
+/** 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 Text : public Widget, public Editable
+{
+ _CLASS_GTKOBJECT(Text, GtkText, GTK_TEXT, Gtk::Widget, GtkWidget)
+ _IMPLEMENTS_INTERFACE(Editable)
+public:
+ _CTOR_DEFAULT
+ _WRAP_CTOR(Text(const Glib::RefPtr<EntryBuffer>& buffer), gtk_text_new_with_buffer)
+
+ _WRAP_METHOD(Glib::RefPtr<EntryBuffer> get_buffer(), gtk_text_get_buffer, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const EntryBuffer> get_buffer() const, gtk_text_get_buffer, refreturn,
constversion)
+ _WRAP_METHOD(void set_buffer(const Glib::RefPtr<EntryBuffer>& buffer), gtk_text_set_buffer)
+
+ _WRAP_METHOD(void set_visibility(bool visible = true), gtk_text_set_visibility)
+ _WRAP_METHOD(bool get_visibility() const, gtk_text_get_visibility)
+ _WRAP_METHOD(void set_invisible_char(gunichar ch), gtk_text_set_invisible_char)
+ _WRAP_METHOD(void unset_invisible_char(), gtk_text_unset_invisible_char)
+ _WRAP_METHOD(gunichar get_invisible_char() const, gtk_text_get_invisible_char)
+ _WRAP_METHOD(void set_overwrite_mode(bool overwrite = true), gtk_text_set_overwrite_mode)
+ _WRAP_METHOD(bool get_overwrite_mode() const, gtk_text_get_overwrite_mode)
+ _WRAP_METHOD(void set_max_length(int max), gtk_text_set_max_length)
+ _WRAP_METHOD(int get_max_length() const, gtk_text_get_max_length)
+ _WRAP_METHOD(guint16 get_text_length() const, gtk_text_get_text_length)
+ _WRAP_METHOD(void set_activates_default(bool setting = true), gtk_text_set_activates_default)
+ _WRAP_METHOD(bool get_activates_default() const, gtk_text_get_activates_default)
+ _WRAP_METHOD(Glib::ustring get_placeholder_text() const, gtk_text_get_placeholder_text)
+ _WRAP_METHOD(void set_placeholder_text(const Glib::ustring& text), gtk_text_set_placeholder_text)
+
+ _WRAP_METHOD(void set_input_purpose(InputPurpose purpose), gtk_text_set_input_purpose)
+ _WRAP_METHOD(InputPurpose get_input_purpose() const, gtk_text_get_input_purpose)
+
+ _WRAP_METHOD(void set_input_hints(InputHints hints), gtk_text_set_input_hints)
+ _WRAP_METHOD(InputHints get_input_hints() const, gtk_text_get_input_hints)
+
+ _WRAP_METHOD(void set_attributes(Pango::AttrList& attrs), gtk_text_set_attributes)
+ _WRAP_METHOD(Pango::AttrList get_attributes() const, gtk_text_get_attributes)
+
+#m4 _CONVERSION(`PangoTabArray*',`Pango::TabArray',`Pango::TabArray(($3))')
+#m4 _CONVERSION(`const Pango::TabArray&',`PangoTabArray*',`const_cast<Pango::TabArray&>($3).gobj()')
+ _WRAP_METHOD(void set_tabs(const Pango::TabArray& tabs), gtk_text_set_tabs)
+ _WRAP_METHOD(Pango::TabArray get_tabs() const, gtk_text_get_tabs)
+
+ _WRAP_METHOD(void grab_focus_without_selecting(), gtk_text_grab_focus_without_selecting)
+
+ // no_default_handler because GtkTextClass is private.
+ _WRAP_SIGNAL(void populate_popup(Widget* widget), "populate-popup", no_default_handler)
+
+ // Action signals
+ _IGNORE_SIGNAL(activate, move-cursor, insert-at-cursor, delete-from-cursor,
+ backspace, cut-clipboard, copy-clipboard, paste-clipboard, toggle-overwrite,
+ preedit-changed, insert-emoji)
+
+ _WRAP_PROPERTY("buffer", Glib::RefPtr<EntryBuffer>)
+ _WRAP_PROPERTY("max-length", int)
+ _WRAP_PROPERTY("visibility", bool)
+ _WRAP_PROPERTY("invisible-char", gunichar)
+ _WRAP_PROPERTY("invisible-char-set", bool)
+ _WRAP_PROPERTY("activates-default", bool)
+ _WRAP_PROPERTY("scroll-offset", int)
+ _WRAP_PROPERTY("truncate-multiline", bool)
+ _WRAP_PROPERTY("overwrite-mode", bool)
+ _WRAP_PROPERTY("im-module", Glib::ustring)
+ _WRAP_PROPERTY("placeholder-text", Glib::ustring)
+ _WRAP_PROPERTY("input-purpose", InputPurpose)
+ _WRAP_PROPERTY("input-hints", InputHints)
+ _WRAP_PROPERTY("attributes", Pango::AttrList)
+ _WRAP_PROPERTY("populate-all", bool)
+ _WRAP_PROPERTY("tabs", Pango::TabArray)
+ _WRAP_PROPERTY("enable-emoji-completion", bool)
+ _WRAP_PROPERTY("propagate-text-width", bool)
+};
+
+} //namespace Gtk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]