[gtkmm] Add Gtk::Root, implemented by Gtk::Window



commit 458d5bbdb13da1716ccf2c90272205f5315094a1
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Tue Feb 19 11:08:23 2019 +0100

    Add Gtk::Root, implemented by Gtk::Window

 .gitignore              |  2 ++
 gtk/src/filelist.am     |  1 +
 gtk/src/gtk_vfuncs.defs | 21 +++++++++++++++++
 gtk/src/root.ccg        | 18 +++++++++++++++
 gtk/src/root.hg         | 61 +++++++++++++++++++++++++++++++++++++++++++++++++
 gtk/src/window.hg       |  4 +++-
 6 files changed, 106 insertions(+), 1 deletion(-)
---
diff --git a/.gitignore b/.gitignore
index 3b5eef8f..a1ba1ad9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -397,6 +397,8 @@ gtk/gtkmm/radiotoolbutton.cc
 gtk/gtkmm/radiotoolbutton.h
 gtk/gtkmm/range.cc
 gtk/gtkmm/range.h
+gtk/gtkmm/root.cc
+gtk/gtkmm/root.h
 gtk/gtkmm/recentinfo.cc
 gtk/gtkmm/recentinfo.h
 gtk/gtkmm/recentmanager.cc
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 7a20dce2..ecc030ee 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -146,6 +146,7 @@ gtkmm_files_any_hg =                \
        recentmanager.hg        \
        requisition.hg          \
        revealer.hg             \
+       root.hg \
        scale.hg                \
        scalebutton.hg          \
        scrollable.hg           \
diff --git a/gtk/src/gtk_vfuncs.defs b/gtk/src/gtk_vfuncs.defs
index aef02714..59b6afd4 100644
--- a/gtk/src/gtk_vfuncs.defs
+++ b/gtk/src/gtk_vfuncs.defs
@@ -448,6 +448,27 @@
   )
 )
 
+; GtkRoot
+
+(define-vfunc get_display
+  (of-object "GtkRoot")
+  (return-type "GdkDisplay*")
+)
+
+(define-vfunc get_renderer
+  (of-object "GtkRoot")
+  (return-type "GskRenderer*")
+)
+
+(define-vfunc get_surface_transform
+  (of-object "GtkRoot")
+  (return-type "none")
+  (parameters
+    '("int*" "x")
+    '("int*" "y")
+  )
+)
+
 ; GtkScrollable
 
 (define-vfunc get_border
diff --git a/gtk/src/root.ccg b/gtk/src/root.ccg
new file mode 100644
index 00000000..2464f638
--- /dev/null
+++ b/gtk/src/root.ccg
@@ -0,0 +1,18 @@
+/* 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>
+#include <gdkmm/display.h>
diff --git a/gtk/src/root.hg b/gtk/src/root.hg
new file mode 100644
index 00000000..3b242664
--- /dev/null
+++ b/gtk/src/root.hg
@@ -0,0 +1,61 @@
+/* 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/interface.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(glibmm/private/interface_p.h)
+_PINCLUDE(gdk/gdk.h)
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+extern "C"
+{
+typedef struct _GtkRootInterface GtkRootInterface;
+}
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Gdk
+{
+class Display;
+}
+
+namespace Gtk
+{
+
+/** Root widgets.
+ *
+ * %Gtk::Root is the interface implemented by all widgets that can act as a toplevel
+ * widget to a hierarchy of widgets. The root widget takes care of providing the
+ * connection to the windowing system and manages layout, drawing and event delivery
+ * for its widget hierarchy.
+ *
+ * The obvious example of a %Gtk::Root is Gtk::Window.
+ *
+ * @see Gtk::Window
+ * @newin{3,96}
+ */
+class Root : public Glib::Interface
+{
+  _CLASS_INTERFACE(Root, GtkRoot, GTK_ROOT, GtkRootInterface)
+
+public:
+#m4 _CONVERSION(`Glib::RefPtr<Gdk::Display>', `GdkDisplay*', __CONVERT_REFPTR_TO_P)
+  _WRAP_VFUNC(Glib::RefPtr<Gdk::Display> get_display(), "get_display", refreturn)
+  //?_WRAP_VFUNC(GskRenderer* get_renderer(), "get_renderer")
+  _WRAP_VFUNC(void get_surface_transform(int& x, int& y), "get_surface_transform")
+};
+
+} // namespace Gtk
diff --git a/gtk/src/window.hg b/gtk/src/window.hg
index 41207d2d..95ebaf9a 100644
--- a/gtk/src/window.hg
+++ b/gtk/src/window.hg
@@ -21,6 +21,7 @@
 #include <glibmm/object.h>
 #include <gdkmm/texture.h>
 #include <gtkmm/bin.h>
+#include <gtkmm/root.h>
 #include <gtkmm/application.h>
 #include <gtkmm/windowgroup.h>
 
@@ -47,9 +48,10 @@ class WindowGroup;
  * Gtk::manage() has no effect on Windows because they have no parent Containers.
  * @ingroup Widgets
  */
-class Window : public Bin
+class Window : public Bin, public Root
 {
   _CLASS_GTKOBJECT(Window,GtkWindow,GTK_WINDOW,Gtk::Bin,GtkBin)
+  _IMPLEMENTS_INTERFACE(Root)
   _UNMANAGEABLE
   _IGNORE(gtk_window_set_has_user_ref_count, gtk_window_set_destroy_with_parent)
 


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