[gtkmm] Gtk::Application, Widget, Window: Add new methods, remove signal_event()



commit eaab8da95a3a6c86297f47eab615e48e80ab542f
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Mon Nov 19 18:28:52 2018 +0100

    Gtk::Application, Widget, Window: Add new methods, remove signal_event()
    
    * gtk/src/application.hg: Add property_screensaver_active().
    * gtk/src/eventcontrollerscroll.hg: signal_scroll() handlers return a bool.
    * gtk/src/widget.[ccg|hg]: Add observe_children(), observe_controllers().
    Remove signal_event(). signal_size_allocate() handlers take int width and
    int height instead of a Gtk::Allocation.
    * gtk/src/window.[ccg|hg]: Add get_toplevels().
    * tools/m4/convert_gtk.m4: Add conversion for Gio::ListModel.
    * demos/gtk-demo/example_drawingarea.cc: Update
    on_drawingarea_scribble_size_allocate().

 demos/gtk-demo/example_drawingarea.cc |  4 ++--
 gtk/src/application.hg                |  3 +--
 gtk/src/eventcontrollerscroll.hg      |  2 +-
 gtk/src/widget.ccg                    |  1 +
 gtk/src/widget.hg                     | 18 +++++++++++-------
 gtk/src/window.ccg                    |  1 +
 gtk/src/window.hg                     |  6 ++++++
 tools/m4/convert_gtk.m4               |  3 +++
 8 files changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/demos/gtk-demo/example_drawingarea.cc b/demos/gtk-demo/example_drawingarea.cc
index d258354a..bc037234 100644
--- a/demos/gtk-demo/example_drawingarea.cc
+++ b/demos/gtk-demo/example_drawingarea.cc
@@ -27,7 +27,7 @@ protected:
   void on_drawingarea_scribble_draw(const Cairo::RefPtr<Cairo::Context>& cr, int width, int height);
 
   //signal handlers:
-  void on_drawingarea_scribble_size_allocate(const Gtk::Allocation& allocation, int baseline);
+  void on_drawingarea_scribble_size_allocate(int width, int height, int baseline);
   void on_drawingarea_scribble_drag_begin(double start_x, double start_y);
   void on_drawingarea_scribble_drag_update(double offset_x, double offset_y);
   void on_drawingarea_scribble_drag_end(double offset_x, double offset_y);
@@ -178,7 +178,7 @@ void Example_DrawingArea::scribble_create_surface()
 }
 
 void Example_DrawingArea::on_drawingarea_scribble_size_allocate(
-  const Gtk::Allocation& /* allocation */, int /* baseline */)
+  int /* width */, int /* height */, int /* baseline */)
 {
   scribble_create_surface();
 }
diff --git a/gtk/src/application.hg b/gtk/src/application.hg
index 46bc884a..ff008aa8 100644
--- a/gtk/src/application.hg
+++ b/gtk/src/application.hg
@@ -18,11 +18,9 @@
 _CONFIGINCLUDE(gtkmmconfig.h)
 
 #include <vector>
-
 #include <giomm/application.h>
 #include <giomm/menumodel.h>
 #include <giomm/menu.h>
-#include <vector>
 
 _DEFS(gtkmm,gtk)
 _PINCLUDE(giomm/private/application_p.h)
@@ -300,6 +298,7 @@ public:
   _WRAP_PROPERTY("app-menu", Glib::RefPtr<Gio::MenuModel>)
   _WRAP_PROPERTY("menubar", Glib::RefPtr<Gio::MenuModel>)
   _WRAP_PROPERTY("register-session", bool)
+  _WRAP_PROPERTY("screensaver-active", bool, newin "3,94")
   _WRAP_PROPERTY("active-window", Window*)
 
   _WRAP_SIGNAL(void window_added(Window* window), "window-added")
diff --git a/gtk/src/eventcontrollerscroll.hg b/gtk/src/eventcontrollerscroll.hg
index 9b0090b6..ee9983c5 100644
--- a/gtk/src/eventcontrollerscroll.hg
+++ b/gtk/src/eventcontrollerscroll.hg
@@ -77,7 +77,7 @@ public:
 
   // no_default_handler because GtkEventControllerScrollClass is private.
   _WRAP_SIGNAL(void scroll_begin(), "scroll-begin", no_default_handler)
-  _WRAP_SIGNAL(void scroll(double dx, double dy), "scroll", no_default_handler)
+  _WRAP_SIGNAL(bool scroll(double dx, double dy), "scroll", no_default_handler)
   _WRAP_SIGNAL(void scroll_end(), "scroll-end", no_default_handler)
   _WRAP_SIGNAL(void decelerate(double vel_x, double vel_y), "decelerate", no_default_handler)
 
diff --git a/gtk/src/widget.ccg b/gtk/src/widget.ccg
index 0a8bba4a..87524458 100644
--- a/gtk/src/widget.ccg
+++ b/gtk/src/widget.ccg
@@ -16,6 +16,7 @@
  */
 
 #include <glibmm/vectorutils.h>
+#include <giomm/listmodel.h>
 
 #include <gdkmm/contentformats.h>
 #include <gdkmm/frameclock.h>
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index 3d8b9d8d..94d28c44 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -46,6 +46,11 @@ _CONFIGINCLUDE(gtkmmconfig.h)
 _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/object_p.h)
 
+namespace Gio
+{
+class ListModel;
+}
+
 namespace Gdk
 {
 class ContentFormats;
@@ -569,6 +574,11 @@ public:
   _WRAP_METHOD(Widget* get_prev_sibling(), gtk_widget_get_prev_sibling)
   _WRAP_METHOD(const Widget* get_prev_sibling() const, gtk_widget_get_prev_sibling, constversion)
 
+  _WRAP_METHOD(Glib::RefPtr<Gio::ListModel> observe_children(), gtk_widget_observe_children)
+  _WRAP_METHOD(Glib::RefPtr<const Gio::ListModel> observe_children() const, gtk_widget_observe_children, 
constversion)
+  _WRAP_METHOD(Glib::RefPtr<Gio::ListModel> observe_controllers(), gtk_widget_observe_controllers)
+  _WRAP_METHOD(Glib::RefPtr<const Gio::ListModel> observe_controllers() const, 
gtk_widget_observe_controllers, constversion)
+
   _WRAP_METHOD(void insert_after(Widget& parent, Widget& previous_sibling{?}), gtk_widget_insert_after)
   _WRAP_METHOD(void insert_before(Widget& parent, Widget& next_sibling{?}), gtk_widget_insert_before)
 
@@ -599,11 +609,7 @@ public:
   //_WRAP(meth|sig|impl,void unrealize_(),gtk_widget_unrealize,"unrealize")
   _WRAP_SIGNAL(void unrealize(),"unrealize")
 
-#m4 _CONVERSION(`const Allocation&',`const GdkRectangle*',`($3.gobj())')
-#m4 _CONVERSION(`const GdkRectangle*',`const Allocation&',`Glib::wrap($3)')
-#m4 _CONVERSION(`Allocation&',`GdkRectangle*',`($3.gobj())')
-#m4 _CONVERSION(`GdkRectangle*',`Allocation&',`Glib::wrap($3)')
-  _WRAP_SIGNAL(void size_allocate(const Allocation& allocation, int baseline), "size_allocate")
+  _WRAP_SIGNAL(void size_allocate(int width, int height, int baseline), "size_allocate")
 
   _WRAP_SIGNAL(void state_flags_changed(Gtk::StateFlags previous_state_flags), "state-flags-changed")
 
@@ -620,8 +626,6 @@ public:
   _WRAP_SIGNAL(bool mnemonic_activate(bool group_cycling), "mnemonic_activate")
   _WRAP_SIGNAL(void grab_focus(), "grab_focus")
   _WRAP_SIGNAL(bool focus(DirectionType direction), "focus")
-#m4 _CONVERSION(`GdkEvent*',`const Glib::RefPtr<Gdk::Event>&',`Glib::wrap($3, true)')
-  _WRAP_SIGNAL(bool event(const Glib::RefPtr<Gdk::Event>& gdk_event), "event", deprecated)
 
 #m4begin
 dnl// Hook in special code to catch explicit uses of gtk_object_destroy() by
diff --git a/gtk/src/window.ccg b/gtk/src/window.ccg
index d091c1f3..f55d346c 100644
--- a/gtk/src/window.ccg
+++ b/gtk/src/window.ccg
@@ -17,6 +17,7 @@
  */
 
 #include <glibmm/vectorutils.h>
+#include <giomm/listmodel.h>
 
 #include <gtkmm/accelgroup.h>
 #include <gdkmm/monitor.h>
diff --git a/gtk/src/window.hg b/gtk/src/window.hg
index c3cb85bc..2f74a16d 100644
--- a/gtk/src/window.hg
+++ b/gtk/src/window.hg
@@ -27,6 +27,11 @@
 _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/bin_p.h)
 
+namespace Gio
+{
+class ListModel;
+}
+
 namespace Gtk
 {
 
@@ -251,6 +256,7 @@ dnl
 
   _WRAP_METHOD(bool get_modal() const, gtk_window_get_modal)
 
+  _WRAP_METHOD(static Glib::RefPtr<Gio::ListModel> get_toplevels(), gtk_window_get_toplevels, refreturn)
 #m4 _CONVERSION(`GList*',`std::vector<Window*>',`Glib::ListHandler<Window*>::list_to_vector($3, 
Glib::OWNERSHIP_SHALLOW)')
   _WRAP_METHOD(static std::vector<Window*> list_toplevels(), gtk_window_list_toplevels)
 
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index 447e81b6..9357eb41 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -556,6 +556,9 @@ _CONVERSION(`const Glib::RefPtr<const Gio::MenuModel>&',`GMenuModel*',__CONVERT_
 _CONVERSION(`GMenuModel*',`Glib::RefPtr<Gio::MenuModel>',`Glib::wrap($3)')
 _CONVERSION(`GMenuModel*',`Glib::RefPtr<const Gio::MenuModel>',`Glib::wrap($3)')
 
+_CONVERSION(`GListModel*',`Glib::RefPtr<Gio::ListModel>',`Glib::wrap($3)')
+_CONVERSION(`GListModel*',`Glib::RefPtr<const Gio::ListModel>',`Glib::wrap($3)')
+
 _CONVERSION(`const 
Glib::RefPtr<Gio::ActionGroup>&',`GActionGroup*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gio::ActionGroup))
 _CONVERSION(`GActionGroup*',`Glib::RefPtr<Gio::ActionGroup>',`Glib::wrap($3)')
 _CONVERSION(`GActionGroup*',`Glib::RefPtr<const Gio::ActionGroup>',`Glib::wrap($3)')


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