[gtkmm] Add Gtk::Inscription
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Add Gtk::Inscription
- Date: Fri, 29 Jul 2022 14:25:58 +0000 (UTC)
commit dd21f446edecf01c8bea0c549a0ccc5258bc0966
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Fri Jul 29 16:21:51 2022 +0200
Add Gtk::Inscription
gtk/gtkmm/meson.build | 1 +
gtk/src/filelist.am | 1 +
gtk/src/gtk_docs_override.xml | 1 +
gtk/src/gtk_signals.defs | 122 ++++++++++++++++++++++++++++++
gtk/src/inscription.ccg | 19 +++++
gtk/src/inscription.hg | 93 +++++++++++++++++++++++
tools/extra_defs_gen/generate_defs_gtk.cc | 1 +
tools/m4/convert_gtk.m4 | 1 +
8 files changed, 239 insertions(+)
---
diff --git a/gtk/gtkmm/meson.build b/gtk/gtkmm/meson.build
index a04013ab..fb07733d 100644
--- a/gtk/gtkmm/meson.build
+++ b/gtk/gtkmm/meson.build
@@ -147,6 +147,7 @@ gtkmm_any_hg_ccg_basenames = [
'iconview',
'image',
'infobar',
+ 'inscription',
'label',
'layoutchild',
'layoutmanager',
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 0c60e49a..42e3e3e6 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -131,6 +131,7 @@ gtkmm_files_any_hg = \
iconview.hg \
image.hg \
infobar.hg \
+ inscription.hg \
label.hg \
layoutchild.hg \
layoutmanager.hg \
diff --git a/gtk/src/gtk_docs_override.xml b/gtk/src/gtk_docs_override.xml
index 4ab4d355..5b13732f 100644
--- a/gtk/src/gtk_docs_override.xml
+++ b/gtk/src/gtk_docs_override.xml
@@ -148,6 +148,7 @@
<substitute_enumerator_name from_prefix="GTK_STRING_FILTER_MATCH_MODE_"
to_prefix="Gtk::StringFilter::MatchMode::" />
<substitute_enumerator_name from_prefix="GDK_SCROLL_UNIT_" to_prefix="Gdk::ScrollUnit::" />
<substitute_enumerator_name from_prefix="GTK_CONTENT_FIT_" to_prefix="Gtk::ContentFit::" />
+<substitute_enumerator_name from_prefix="GTK_INSCRIPTION_OVERFLOW_" to_prefix="Gtk::Inscription::Overflow::"
/>
<!-- GdkWindowWindowClass is not wrapped in gtkmm. Don't substitute its enumerator names. -->
<substitute_enumerator_name from="GDK_INPUT_ONLY" to="GDK_INPUT_ONLY" />
<substitute_enumerator_name from="GDK_INPUT_OUTPUT" to="GDK_INPUT_OUTPUT" />
diff --git a/gtk/src/gtk_signals.defs b/gtk/src/gtk_signals.defs
index 349549ec..3ec9d466 100644
--- a/gtk/src/gtk_signals.defs
+++ b/gtk/src/gtk_signals.defs
@@ -6132,6 +6132,117 @@
(default-value "FALSE")
)
+;; From GtkInscription
+
+(define-property attributes
+ (of-object "GtkInscription")
+ (prop-type "GParamBoxed")
+ (docs "")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+)
+
+(define-property markup
+ (of-object "GtkInscription")
+ (prop-type "GParamString")
+ (docs "")
+ (readable #f)
+ (writable #t)
+ (construct-only #f)
+ (default-value "")
+)
+
+(define-property min-chars
+ (of-object "GtkInscription")
+ (prop-type "GParamUInt")
+ (docs "")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "3")
+)
+
+(define-property min-lines
+ (of-object "GtkInscription")
+ (prop-type "GParamUInt")
+ (docs "")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "1")
+)
+
+(define-property nat-chars
+ (of-object "GtkInscription")
+ (prop-type "GParamUInt")
+ (docs "")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "0")
+)
+
+(define-property nat-lines
+ (of-object "GtkInscription")
+ (prop-type "GParamUInt")
+ (docs "")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "0")
+)
+
+(define-property text
+ (of-object "GtkInscription")
+ (prop-type "GParamString")
+ (docs "")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "")
+)
+
+(define-property text-overflow
+ (of-object "GtkInscription")
+ (prop-type "GParamEnum")
+ (docs "")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "GTK_INSCRIPTION_OVERFLOW_CLIP")
+)
+
+(define-property wrap-mode
+ (of-object "GtkInscription")
+ (prop-type "GParamEnum")
+ (docs "")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "PANGO_WRAP_WORD_CHAR")
+)
+
+(define-property xalign
+ (of-object "GtkInscription")
+ (prop-type "GParamFloat")
+ (docs "")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "0")
+)
+
+(define-property yalign
+ (of-object "GtkInscription")
+ (prop-type "GParamFloat")
+ (docs "")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "0.5")
+)
+
;; From GtkKeyvalTrigger
(define-property keyval
@@ -7908,6 +8019,7 @@
(readable #t)
(writable #t)
(construct-only #f)
+ (deprecated #t)
(default-value "TRUE")
)
@@ -7921,6 +8033,16 @@
(default-value "TRUE")
)
+(define-property content-fit
+ (of-object "GtkPicture")
+ (prop-type "GParamEnum")
+ (docs "")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "GTK_CONTENT_FIT_CONTAIN")
+)
+
;; From GtkPopover
(define-signal closed
diff --git a/gtk/src/inscription.ccg b/gtk/src/inscription.ccg
new file mode 100644
index 00000000..854f458c
--- /dev/null
+++ b/gtk/src/inscription.ccg
@@ -0,0 +1,19 @@
+/* Copyright 2022 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>
+
+using Overflow = Gtk::Inscription::Overflow;
diff --git a/gtk/src/inscription.hg b/gtk/src/inscription.hg
new file mode 100644
index 00000000..2e5da2b2
--- /dev/null
+++ b/gtk/src/inscription.hg
@@ -0,0 +1,93 @@
+/* Copyright (C) 2022 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/>.
+ */
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/widget_p.h)
+
+#include <gtkmm/widget.h>
+#include <pangomm/attrlist.h>
+#include <pangomm/layout.h> // for Pango::WrapMode
+
+namespace Gtk
+{
+
+/** %Gtk::Inscription is a widget to show text in a predefined area.
+ *
+ * You likely want to use Gtk::Label instead as this widget is intended only
+ * for a small subset of use cases. The main scenario envisaged is inside lists
+ * such as Gtk::ColumnView.
+ *
+ * While a Gtk::Label sizes itself depending on the text that is displayed,
+ * %Gtk::Inscription is given a size and inscribes the given text into that
+ * space as well as it can.
+ *
+ * Users of this widget should take care to plan behaviour for the common case
+ * where the text doesn't fit exactly in the allocated space.
+ *
+ * @ingroup Widgets
+ * @newin{4,8}
+ */
+class GTKMM_API Inscription : public Widget
+{
+ _CLASS_GTKOBJECT(Inscription, GtkInscription, GTK_INSCRIPTION, Gtk::Widget, GtkWidget, , , GTKMM_API)
+ _DO_NOT_DERIVE_GTYPE dnl// GtkInscription is a final type
+ _STRUCT_NOT_HIDDEN
+public:
+ _WRAP_ENUM(Overflow, GtkInscriptionOverflow, decl_prefix GTKMM_API)
+
+ _CTOR_DEFAULT
+
+ /** Creates a new %Gtk::Inscription with the given text.
+ * @param text The text.
+ */
+ _WRAP_CTOR(Inscription(const Glib::ustring& text), gtk_inscription_new)
+
+ _WRAP_METHOD(Glib::ustring get_text() const, gtk_inscription_get_text)
+ _WRAP_METHOD(void set_text(const Glib::ustring& text{NULL}), gtk_inscription_set_text)
+ _WRAP_METHOD(Pango::AttrList get_attributes() const, gtk_inscription_get_attributes)
+ _WRAP_METHOD(void set_attributes(Pango::AttrList& attrs), gtk_inscription_set_attributes)
+ _WRAP_METHOD(void set_markup(const Glib::ustring& markup{NULL}), gtk_inscription_set_markup)
+ _WRAP_METHOD(Inscription::Overflow get_text_overflow() const, gtk_inscription_get_text_overflow)
+ _WRAP_METHOD(void set_text_overflow(Overflow overflow), gtk_inscription_set_text_overflow)
+ _WRAP_METHOD(Pango::WrapMode get_wrap_mode() const, gtk_inscription_get_wrap_mode)
+ _WRAP_METHOD(void set_wrap_mode(Pango::WrapMode wrap_mode), gtk_inscription_set_wrap_mode)
+ _WRAP_METHOD(unsigned int get_min_chars() const, gtk_inscription_get_min_chars)
+ _WRAP_METHOD(void set_min_chars(unsigned int min_chars), gtk_inscription_set_min_chars)
+ _WRAP_METHOD(unsigned int get_nat_chars() const, gtk_inscription_get_nat_chars)
+ _WRAP_METHOD(void set_nat_chars(unsigned int nat_chars), gtk_inscription_set_nat_chars)
+ _WRAP_METHOD(unsigned int get_min_lines() const, gtk_inscription_get_min_lines)
+ _WRAP_METHOD(void set_min_lines(unsigned int min_lines), gtk_inscription_set_min_lines)
+ _WRAP_METHOD(unsigned int get_nat_lines() const, gtk_inscription_get_nat_lines)
+ _WRAP_METHOD(void set_nat_lines(unsigned int nat_lines), gtk_inscription_set_nat_lines)
+ _WRAP_METHOD(float get_xalign() const, gtk_inscription_get_xalign)
+ _WRAP_METHOD(void set_xalign(float xalign), gtk_inscription_set_xalign)
+ _WRAP_METHOD(float get_yalign() const, gtk_inscription_get_yalign)
+ _WRAP_METHOD(void set_yalign(float yalign), gtk_inscription_set_yalign)
+
+ _WRAP_PROPERTY("attributes", Pango::AttrList)
+ _WRAP_PROPERTY("markup", Glib::ustring)
+ _WRAP_PROPERTY("min-chars", unsigned int)
+ _WRAP_PROPERTY("min-lines", unsigned int)
+ _WRAP_PROPERTY("nat-chars", unsigned int)
+ _WRAP_PROPERTY("nat-lines", unsigned int)
+ _WRAP_PROPERTY("text", Glib::ustring)
+ _WRAP_PROPERTY("text-overflow", Inscription::Overflow)
+ _WRAP_PROPERTY("wrap-mode", Pango::WrapMode)
+ _WRAP_PROPERTY("xalign", float)
+ _WRAP_PROPERTY("yalign", float)
+};
+
+} // namespace Gtk
diff --git a/tools/extra_defs_gen/generate_defs_gtk.cc b/tools/extra_defs_gen/generate_defs_gtk.cc
index 1d510e47..59d6e283 100644
--- a/tools/extra_defs_gen/generate_defs_gtk.cc
+++ b/tools/extra_defs_gen/generate_defs_gtk.cc
@@ -149,6 +149,7 @@ int main(int /* argc */, char** /* argv */)
<< get_defs( GTK_TYPE_ICON_PAINTABLE )
<< get_defs( GTK_TYPE_ICON_THEME )
<< get_defs( GTK_TYPE_ICON_VIEW )
+ << get_defs( GTK_TYPE_INSCRIPTION )
<< get_defs( GTK_TYPE_KEYVAL_TRIGGER )
<< get_defs( GTK_TYPE_LABEL )
<< get_defs( GTK_TYPE_LAYOUT_CHILD )
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index 6d5b8c0a..21eeb2c0 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -58,6 +58,7 @@ _CONV_INCLASS_ENUM(Gtk,Filter,Match)
_CONV_INCLASS_ENUM(Gtk,FontChooser,Level)
_CONV_INCLASS_ENUM(Gtk,Image,Type)
_CONV_ENUM(Gtk,IconSize)
+_CONV_INCLASS_ENUM(Gtk,Inscription,Overflow)
_CONV_ENUM(Gtk,Justification)
_CONV_ENUM(Gtk,License)
_CONV_ENUM(Gtk,MessageType)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]