[gtkmm] Gtk: Update for the latest gtk4 (Add NoSelection, etc.)



commit 039ed92c259c42e01aa8fab5f5d67072e1924ebe
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Sun Nov 3 19:12:36 2019 +0100

    Gtk: Update for the latest gtk4 (Add NoSelection, etc.)

 .gitignore                 |  4 ++-
 gtk/gtkmm.h                |  1 +
 gtk/src/filelist.am        |  1 +
 gtk/src/iconinfo.ccg       | 10 --------
 gtk/src/iconinfo.hg        | 17 -------------
 gtk/src/icontheme.hg       |  5 ----
 gtk/src/modelbutton.hg     | 15 +++++++----
 gtk/src/noselection.ccg    | 17 +++++++++++++
 gtk/src/noselection.hg     | 62 ++++++++++++++++++++++++++++++++++++++++++++++
 gtk/src/shortcutlabel.hg   |  8 +++---
 gtk/src/singleselection.hg |  3 +++
 gtk/src/text.hg            |  2 +-
 gtk/src/widget.hg          |  8 +++---
 13 files changed, 107 insertions(+), 46 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 93b6f689..1f837c24 100644
--- a/.gitignore
+++ b/.gitignore
@@ -378,6 +378,8 @@ gtk/gtkmm/native.cc
 gtk/gtkmm/native.h
 gtk/gtkmm/nativedialog.cc
 gtk/gtkmm/nativedialog.h
+gtk/gtkmm/noselection.cc
+gtk/gtkmm/noselection.h
 gtk/gtkmm/notebook.cc
 gtk/gtkmm/notebook.h
 gtk/gtkmm/notebookpage.cc
@@ -476,9 +478,9 @@ gtk/gtkmm/shortcutsshortcut.cc
 gtk/gtkmm/shortcutsshortcut.h
 gtk/gtkmm/shortcutswindow.cc
 gtk/gtkmm/shortcutswindow.h
-gtk/gtkmm/sizegroup.cc
 gtk/gtkmm/singleselection.cc
 gtk/gtkmm/singleselection.h
+gtk/gtkmm/sizegroup.cc
 gtk/gtkmm/sizegroup.h
 gtk/gtkmm/snapshot.cc
 gtk/gtkmm/snapshot.h
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 7ee1548f..114c525b 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -201,6 +201,7 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/menushell.h>
 #include <gtkmm/messagedialog.h>
 #include <gtkmm/modelbutton.h>
+#include <gtkmm/noselection.h>
 #include <gtkmm/notebook.h>
 #include <gtkmm/object.h>
 #include <gtkmm/overlay.h>
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index d24ecf5c..3ca2e22b 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -136,6 +136,7 @@ gtkmm_files_any_hg =                \
        modelbutton.hg \
        native.hg \
        nativedialog.hg \
+       noselection.hg \
        notebook.hg             \
        notebookpage.hg \
        orientable.hg           \
diff --git a/gtk/src/iconinfo.ccg b/gtk/src/iconinfo.ccg
index 15b2f555..d7493623 100644
--- a/gtk/src/iconinfo.ccg
+++ b/gtk/src/iconinfo.ccg
@@ -20,13 +20,3 @@
 
 #include <gtk/gtk.h>
 #include <gtkmm/icontheme.h>
-
-namespace Gtk
-{
-
-IconInfo::IconInfo(const Glib::RefPtr<IconTheme>& icon_theme, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
-: Glib::Object((GObject*)gtk_icon_info_new_for_pixbuf(Glib::unwrap(icon_theme), pixbuf->gobj()))
-{
-}
-
-} // namespace Gtk
diff --git a/gtk/src/iconinfo.hg b/gtk/src/iconinfo.hg
index f24999b1..973ffa24 100644
--- a/gtk/src/iconinfo.hg
+++ b/gtk/src/iconinfo.hg
@@ -20,7 +20,6 @@
 #include <gtkmm/stylecontext.h>
 #include <gdkmm/rectangle.h>
 #include <gdkmm/paintable.h>
-#include <gdkmm/pixbuf.h>
 #include <gdkmm/rgba.h>
 #include <gdkmm/types.h>
 #include <giomm/asyncresult.h>
@@ -38,23 +37,7 @@ class IconInfo : public Glib::Object
 {
   _CLASS_GOBJECT(IconInfo, GtkIconInfo, GTK_ICON_INFO, Glib::Object, GObject)
 
-protected:
-  // Can't use _WRAP_CTOR(), because there are no properties that correspond
-  // to the constructor's parameters.
-  IconInfo(const Glib::RefPtr<IconTheme>& icon_theme, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf);
-  _IGNORE(gtk_icon_info_new_for_pixbuf)
-
 public:
-  /** Creates an %IconInfo for a Gdk::Pixbuf.
-   *
-   * @newin{3,92}
-   *
-   * @param icon_theme A Gtk::IconTheme.
-   * @param pixbuf The pixbuf to wrap in an %IconInfo.
-   * @return A RefPtr to a new %IconInfo.
-   */
-  _WRAP_CREATE(const Glib::RefPtr<IconTheme>& icon_theme, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
-
   _WRAP_METHOD(int get_base_size() const, gtk_icon_info_get_base_size)
   _WRAP_METHOD(int get_base_scale() const, gtk_icon_info_get_base_scale)
 
diff --git a/gtk/src/icontheme.hg b/gtk/src/icontheme.hg
index 81b6a602..57ab1163 100644
--- a/gtk/src/icontheme.hg
+++ b/gtk/src/icontheme.hg
@@ -116,7 +116,6 @@ public:
    * <a href="http://www.freedesktop.org/wiki/Specifications/icon-theme-spec";>Icon Theme Specification</a>.
    * The standard contexts are listed in the
    * <a href="http://www.freedesktop.org/wiki/Specifications/icon-naming-spec";>Icon Naming Specification</a>.
-   * Also see list_contexts().
    *
    * @param context A string identifying a particular type of icon,
    *        or an empty string to list all icons.
@@ -125,9 +124,6 @@ public:
    */
   _WRAP_METHOD(std::vector<Glib::ustring> list_icons(const Glib::ustring& context{NULL} = {}) const, 
gtk_icon_theme_list_icons)
 
-  _WRAP_METHOD(std::vector<Glib::ustring> list_contexts() const, gtk_icon_theme_list_contexts)
-
-  _WRAP_METHOD(Glib::ustring get_example_icon_name() const, gtk_icon_theme_get_example_icon_name)
   _WRAP_METHOD(bool rescan_if_needed(), gtk_icon_theme_rescan_if_needed)
 
   // no_default_handler because GtkIconThemeClass is private.
@@ -135,4 +131,3 @@ public:
 };
 
 } // namespace Gtk
-
diff --git a/gtk/src/modelbutton.hg b/gtk/src/modelbutton.hg
index 314bc49b..3189538a 100644
--- a/gtk/src/modelbutton.hg
+++ b/gtk/src/modelbutton.hg
@@ -14,13 +14,14 @@
  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <gtkmm/button.h>
+#include <gtkmm/widget.h>
+#include <gtkmm/actionable.h>
 #include <gtkmm/popover.h>
 #include <gtkmm/sizegroup.h>
 #include <giomm/icon.h>
 
 _DEFS(gtkmm,gtk)
-_PINCLUDE(gtkmm/private/button_p.h)
+_PINCLUDE(gtkmm/private/widget_p.h)
 
 namespace Gtk
 {
@@ -58,9 +59,10 @@ _WRAP_ENUM(ButtonRole, GtkButtonRole)
  *
  * @ingroup Widgets
  */
-class ModelButton : public Button
+class ModelButton : public Widget, public Actionable
 {
-  _CLASS_GTKOBJECT(ModelButton, GtkModelButton, GTK_MODEL_BUTTON, Gtk::Button, GtkButton)
+  _CLASS_GTKOBJECT(ModelButton, GtkModelButton, GTK_MODEL_BUTTON, Gtk::Widget, GtkWidget)
+  _IMPLEMENTS_INTERFACE(Actionable)
 
 public:
   _CTOR_DEFAULT
@@ -76,7 +78,10 @@ public:
   _WRAP_PROPERTY("accel", Glib::ustring)
   _WRAP_PROPERTY("indicator-size-group", Glib::RefPtr<SizeGroup>)
 
-  // ModelButton has no methods, signals nor vfuncs.
+  // no_default_handler because the wrapped C signal has no default handler.
+  _WRAP_SIGNAL(void clicked(), "clicked", no_default_handler)
+
+  // ModelButton has no methods nor vfuncs.
 };
 
 } //namespace Gtk
diff --git a/gtk/src/noselection.ccg b/gtk/src/noselection.ccg
new file mode 100644
index 00000000..3663c616
--- /dev/null
+++ b/gtk/src/noselection.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/noselection.hg b/gtk/src/noselection.hg
new file mode 100644
index 00000000..4aae6fbd
--- /dev/null
+++ b/gtk/src/noselection.hg
@@ -0,0 +1,62 @@
+/* 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 <glibmm/object.h>
+#include <glibmm/refptr.h>
+#include <giomm/listmodel.h>
+#include <gtkmm/selectionmodel.h>
+#include <gtk/gtk.h> // Declares GtkNoSelection and GtkNoSelectionClass
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gtk
+{
+/** A selection model that does not allow selecting anything.
+ *
+ * %Gtk::NoSelection is an implementation of the Gtk::SelectionModel interface 
+ * that does not allow selecting anything.
+ *
+ * This model is meant to be used as a simple wrapper to Gio::ListModels when a
+ * Gtk::SelectionModel is required.
+ *
+ * @see SelectionModel
+ * @newin{3,96}
+ */
+class NoSelection : public Glib::Object, public Gio::ListModel, public SelectionModel
+{
+  _CLASS_GOBJECT(NoSelection, GtkNoSelection, GTK_NO_SELECTION, Glib::Object, GObject)
+  _IMPLEMENTS_INTERFACE(Gio::ListModel)
+  _IMPLEMENTS_INTERFACE(SelectionModel)
+  _STRUCT_NOT_HIDDEN
+
+protected:
+  _CTOR_DEFAULT()
+  _WRAP_CTOR(NoSelection(const Glib::RefPtr<Gio::ListModel>& model), gtk_no_selection_new)
+
+public:
+  _WRAP_CREATE()
+  _WRAP_CREATE(const Glib::RefPtr<Gio::ListModel>& model)
+
+  _WRAP_METHOD(Glib::RefPtr<Gio::ListModel> get_model(), gtk_no_selection_get_model, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Gio::ListModel> get_model() const, gtk_no_selection_get_model, refreturn, 
constversion)
+
+  _WRAP_PROPERTY("model", Glib::RefPtr<Gio::ListModel>)
+
+  // There are no signals or vfuncs.
+};
+
+} // namespace Gtk
diff --git a/gtk/src/shortcutlabel.hg b/gtk/src/shortcutlabel.hg
index f28e2684..7b9be4b9 100644
--- a/gtk/src/shortcutlabel.hg
+++ b/gtk/src/shortcutlabel.hg
@@ -14,10 +14,10 @@
  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <gtkmm/box.h>
+#include <gtkmm/widget.h>
 
 _DEFS(gtkmm,gtk)
-_PINCLUDE(gtkmm/private/box_p.h)
+_PINCLUDE(gtkmm/private/widget_p.h)
 
 namespace Gtk
 {
@@ -32,9 +32,9 @@ namespace Gtk
  *
  * @ingroup Widgets
  */
-class ShortcutLabel : public Box
+class ShortcutLabel : public Widget
 {
-  _CLASS_GTKOBJECT(ShortcutLabel, GtkShortcutLabel, GTK_SHORTCUT_LABEL, Box, GtkBox)
+  _CLASS_GTKOBJECT(ShortcutLabel, GtkShortcutLabel, GTK_SHORTCUT_LABEL, Widget, GtkWidget)
 
 public:
   _CTOR_DEFAULT
diff --git a/gtk/src/singleselection.hg b/gtk/src/singleselection.hg
index f306431a..eeb995f9 100644
--- a/gtk/src/singleselection.hg
+++ b/gtk/src/singleselection.hg
@@ -49,6 +49,9 @@ public:
   _WRAP_CREATE()
   _WRAP_CREATE(const Glib::RefPtr<Gio::ListModel>& model)
 
+  _WRAP_METHOD(Glib::RefPtr<Gio::ListModel> get_model(), gtk_single_selection_get_model, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Gio::ListModel> get_model() const, gtk_single_selection_get_model, 
refreturn, constversion)
+
   _WRAP_METHOD(guint get_selected() const, gtk_single_selection_get_selected)
   _WRAP_METHOD(void set_selected(guint position), gtk_single_selection_set_selected)
 
diff --git a/gtk/src/text.hg b/gtk/src/text.hg
index 59f71e6d..2b941984 100644
--- a/gtk/src/text.hg
+++ b/gtk/src/text.hg
@@ -91,7 +91,7 @@ public:
   _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)
+  _WRAP_METHOD(bool grab_focus_without_selecting(), gtk_text_grab_focus_without_selecting)
 
   _WRAP_METHOD(void set_extra_menu(const Glib::RefPtr<Gio::MenuModel>& model), gtk_text_set_extra_menu)
   _WRAP_METHOD(Glib::RefPtr<Gio::MenuModel> get_extra_menu(), gtk_text_get_extra_menu, refreturn)
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index d10a3998..c6e35853 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -190,7 +190,7 @@ public:
 
   _WRAP_METHOD(bool is_focus() const, gtk_widget_is_focus)
   _WRAP_METHOD(bool has_visible_focus() const, gtk_widget_has_visible_focus)
-  _WRAP_METHOD(void grab_focus(), gtk_widget_grab_focus)
+  _WRAP_METHOD(bool grab_focus(), gtk_widget_grab_focus)
   _WRAP_METHOD(void set_focus_on_click(bool focus_on_click = true), gtk_widget_set_focus_on_click)
   _WRAP_METHOD(bool get_focus_on_click() const, gtk_widget_get_focus_on_click)
   _WRAP_METHOD(void set_can_target(bool can_target = true), gtk_widget_set_can_target)
@@ -581,8 +581,10 @@ public:
    * @param name The name of the action to activate.
    * @param args Parameters to use. If the action does not expect parameters,
    *             use the activate_action() overload without the @a args argument.
+   * @return <tt>true</tt> if the action was activated, <tt>false</tt> if the
+   *         action does not exist.
    */
-  _WRAP_METHOD(void activate_action(const Glib::ustring& name, const Glib::VariantBase& args{?}), 
gtk_widget_activate_action_variant)
+  _WRAP_METHOD(bool activate_action(const Glib::ustring& name, const Glib::VariantBase& args{?}), 
gtk_widget_activate_action_variant)
   _IGNORE(gtk_widget_activate_action)
   _WRAP_METHOD(void activate_default(), gtk_widget_activate_default)
 
@@ -773,7 +775,7 @@ protected:
   _WRAP_VFUNC(SizeRequestMode get_request_mode() const, get_request_mode)
   _WRAP_VFUNC(void measure(Orientation orientation, int for_size, int& minimum, int& natural,
     int& minimum_baseline, int& natural_baseline) const, measure, custom_vfunc_callback)
-  _WRAP_VFUNC(void grab_focus(), grab_focus)
+  _WRAP_VFUNC(bool grab_focus(), grab_focus)
   _WRAP_VFUNC(Glib::RefPtr<Atk::Object> get_accessible(), "get_accessible", refreturn, ifdef 
GTKMM_ATKMM_ENABLED)
 
   _WRAP_VFUNC(void compute_expand(bool& hexpand_p, bool& vexpand_p), compute_expand,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]