[gtkmm] Add some methods that use Gtk::Snapshot



commit 8a73a4ab1b04e3032b9986ecd210a746f1a25d86
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Tue Jan 31 18:43:11 2017 +0100

    Add some methods that use Gtk::Snapshot
    
    * gtk/src/cellarea.hg: Add snapshot() and snapshot_vfunc().
    * gtk/src/cellrenderer.hg: Add snapshot() and snapshot_vfunc().
    * gtk/src/checkmenuitem.hg: Add snapshot_indicator_vfunc().

 gtk/src/cellarea.ccg      |    2 +-
 gtk/src/cellarea.hg       |   15 +++++++++++----
 gtk/src/cellrenderer.ccg  |    1 +
 gtk/src/cellrenderer.hg   |   32 +++++++++++++++-----------------
 gtk/src/checkmenuitem.ccg |    1 +
 gtk/src/checkmenuitem.hg  |    9 ++++-----
 6 files changed, 33 insertions(+), 27 deletions(-)
---
diff --git a/gtk/src/cellarea.ccg b/gtk/src/cellarea.ccg
index 089dd2b..68966a8 100644
--- a/gtk/src/cellarea.ccg
+++ b/gtk/src/cellarea.ccg
@@ -16,7 +16,7 @@
  */
 
 #include <gtk/gtk.h>
-
+#include <gtkmm/snapshot.h>
 
 namespace //anonymous namespace
 {
diff --git a/gtk/src/cellarea.hg b/gtk/src/cellarea.hg
index 80e5527..98fb16b 100644
--- a/gtk/src/cellarea.hg
+++ b/gtk/src/cellarea.hg
@@ -25,6 +25,7 @@ _PINCLUDE(gtkmm/private/object_p.h)
 
 namespace Gtk
 {
+class Snapshot;
 
 //TODO: This documentation omits the examples from the C documentation. We should translate them to C++.
 /** An abstract base class for laying out CellRenderers.
@@ -157,10 +158,10 @@ public:
   _IGNORE(gtk_cell_area_foreach_alloc)
 
   _WRAP_METHOD(int event(const Glib::RefPtr<CellAreaContext>& context, Widget& widget, GdkEvent* gdk_event, 
const Gdk::Rectangle& cell_area,  GtkCellRendererState  flags), gtk_cell_area_event)
-  //TODO: Implement when GtkSnapshot has been wrapped in gtkmm:
-  //_WRAP_METHOD(void snapshot(const Glib::RefPtr<CellAreaContext>& context, Widget& widget,
-  //   Snapshot& snapshot, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area,
-  //   CellRendererState flags,  bool paint_focus), gtk_cell_area_snapshot)
+
+  _WRAP_METHOD(void snapshot(const Glib::RefPtr<CellAreaContext>& context, Widget& widget,
+     Snapshot& snapshot, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area,
+     CellRendererState flags,  bool paint_focus), gtk_cell_area_snapshot)
 
   _WRAP_METHOD(void get_cell_allocation(const Glib::RefPtr<CellAreaContext>& context, Widget& widget, 
CellRenderer& renderer,  const Gdk::Rectangle& cell_area, Gdk::Rectangle& allocation), 
gtk_cell_area_get_cell_allocation)
 
@@ -239,6 +240,12 @@ protected:
   _WRAP_SIGNAL(void remove_editable(CellRenderer* renderer, CellEditable* editable), "remove-editable", 
no_default_handler)
   _WRAP_SIGNAL(void focus_changed(CellRenderer* renderer, const Glib::ustring& path), "focus-changed", 
no_default_handler)
 
+#m4 _CONVERSION(`GtkSnapshot*',`Snapshot&',`*Glib::wrap($3)')
+#m4 _CONVERSION(`const GdkRectangle*',`const Gdk::Rectangle&',`Glib::wrap($3)')
+  _WRAP_VFUNC(void snapshot(const Glib::RefPtr<CellAreaContext>& context, Widget& widget,
+     Snapshot& snapshot, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area,
+     CellRendererState flags,  bool paint_focus), snapshot)
+
 //TODO: Wrap these vfuncs, mentioned in the GtkCellAreaContext overview documentation?
 //  GtkCellAreaContext *(* create_context)                 (GtkCellArea             *area);
 //  GtkCellAreaContext *(* copy_context)                   (GtkCellArea             *area,
diff --git a/gtk/src/cellrenderer.ccg b/gtk/src/cellrenderer.ccg
index 51bb986..843a9ba 100644
--- a/gtk/src/cellrenderer.ccg
+++ b/gtk/src/cellrenderer.ccg
@@ -16,6 +16,7 @@
  */
 
 #include <gtk/gtk.h>
+#include <gtkmm/snapshot.h>
 
 namespace Gtk
 {
diff --git a/gtk/src/cellrenderer.hg b/gtk/src/cellrenderer.hg
index 03e9d70..f7b1944 100644
--- a/gtk/src/cellrenderer.hg
+++ b/gtk/src/cellrenderer.hg
@@ -26,6 +26,7 @@ _PH_INCLUDE(gtk/gtk.h)
 
 namespace Gtk
 {
+class Snapshot;
 
 _WRAP_ENUM(CellRendererState, GtkCellRendererState)
 _WRAP_ENUM(CellRendererMode, GtkCellRendererMode)
@@ -55,13 +56,12 @@ public:
   //TODO: Use a return value intead?
   _WRAP_METHOD(void get_aligned_area(Widget& widget, CellRendererState flags, const Gdk::Rectangle& 
cell_area, Gdk::Rectangle& aligned_area), gtk_cell_renderer_get_aligned_area)
 
-  //TODO: Implement when GtkSnapshot has been wrapped in gtkmm:
-  //_WRAP_METHOD(void snapshot(
-  //                Snapshot& snapshot,
-  //                Widget& widget,
-  //                const Gdk::Rectangle& background_area,
-  //                const Gdk::Rectangle& cell_area,
-  //                CellRendererState flags), gtk_cell_renderer_snapshot)
+  _WRAP_METHOD(void snapshot(
+                  Snapshot& snapshot,
+                  Widget& widget,
+                  const Gdk::Rectangle& background_area,
+                  const Gdk::Rectangle& cell_area,
+                  CellRendererState flags), gtk_cell_renderer_snapshot)
 
   _WRAP_METHOD(bool activate(
                   GdkEvent* event,
@@ -141,22 +141,20 @@ public:
 protected:
   _CTOR_DEFAULT()
 
-#m4 _CONVERSION(`const GdkRectangle*',`const Gdk::Rectangle&',`Glib::wrap($3)')
-#m4 _CONVERSION(`GdkRectangle*',`const Gdk::Rectangle&',`Glib::wrap($3)')
-
   _WRAP_VFUNC(SizeRequestMode get_request_mode() const, get_request_mode)
   _WRAP_VFUNC(void get_preferred_width(Widget& widget, int& minimum_width, int& natural_width) const, 
get_preferred_width, custom_vfunc_callback)
   _WRAP_VFUNC(void get_preferred_height_for_width(Widget& widget, int width, int& minimum_height, int& 
natural_height) const, get_preferred_height_for_width, custom_vfunc_callback)
   _WRAP_VFUNC(void get_preferred_height(Widget& widget, int& minimum_height, int& natural_height) const, 
get_preferred_height, custom_vfunc_callback)
   _WRAP_VFUNC(void get_preferred_width_for_height(Widget& widget, int height, int& minimum_width, int& 
natural_width) const, get_preferred_width_for_height, custom_vfunc_callback)
 
-  //TODO: Implement when GtkSnapshot has been wrapped in gtkmm:
-  //_WRAP_VFUNC(void snapshot(
-  //                Snapshot& snapshot,
-  //                Widget& widget,
-  //                const Gdk::Rectangle& background_area,
-  //                const Gdk::Rectangle& cell_area,
-  //                CellRendererState flags), snapshot)
+#m4 _CONVERSION(`GtkSnapshot*',`Snapshot&',`*Glib::wrap($3)')
+#m4 _CONVERSION(`const GdkRectangle*',`const Gdk::Rectangle&',`Glib::wrap($3)')
+  _WRAP_VFUNC(void snapshot(
+                  Snapshot& snapshot,
+                  Widget& widget,
+                  const Gdk::Rectangle& background_area,
+                  const Gdk::Rectangle& cell_area,
+                  CellRendererState flags), snapshot)
 
   _WRAP_VFUNC(bool activate(
                   GdkEvent* event,
diff --git a/gtk/src/checkmenuitem.ccg b/gtk/src/checkmenuitem.ccg
index 7ff9f42..347e0a9 100644
--- a/gtk/src/checkmenuitem.ccg
+++ b/gtk/src/checkmenuitem.ccg
@@ -18,6 +18,7 @@
 
 #include <gtk/gtk.h>
 #include <gtkmm/label.h>
+#include <gtkmm/snapshot.h>
 
 namespace Gtk
 {
diff --git a/gtk/src/checkmenuitem.hg b/gtk/src/checkmenuitem.hg
index bf61936..eaa061f 100644
--- a/gtk/src/checkmenuitem.hg
+++ b/gtk/src/checkmenuitem.hg
@@ -23,6 +23,7 @@ _PINCLUDE(gtkmm/private/menuitem_p.h)
 
 namespace Gtk
 {
+class Snapshot;
 
 /** A menu item that maintains the state of a boolean value in addition to a Gtk::MenuItem's usual role in 
activating application code.
  * A check box indicating the state of the boolean value is displayed at the left side of the Gtk::MenuItem.
@@ -57,14 +58,12 @@ public:
   _WRAP_PROPERTY("draw-as-radio", bool)
 
 protected:
-  //TODO: Implement when GtkSnapshot has been wrapped in gtkmm:
-  /* Triggered when the item is redrawn (e.g. after being toggled)
+#m4 _CONVERSION(`GtkSnapshot*',`Snapshot&',`*Glib::wrap($3)')
+  /** Triggered when the item is redrawn (e.g. after being toggled).
    * Override this vfunc if you want to implement your own check item
    * look. Otherwise, you most likely don't care about it.
-   * The GdkRectangle specifies the area of the widget which will get
-   * redrawn.
    */
-  //_WRAP_VFUNC(void snapshot_indicator(Snapshot& snapshot), snapshot_indicator)
+  _WRAP_VFUNC(void snapshot_indicator(Snapshot& snapshot), snapshot_indicator)
 };
 
 } //namespace Gtk


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