[gtkmm] Gtk::CellRenderer::get_aligned_area(): Return value instead of output par



commit 8314a1c8efc7900abd7c32df6887db51f3a9ae75
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Tue Jul 11 18:58:40 2017 +0200

    Gtk::CellRenderer::get_aligned_area(): Return value instead of output par
    
    Let the returned rectangle be the return value of get_aligned_area(),
    although gtk_cell_renderer_get_aligned_area() has an output parameter and
    return type void.
    Add implementation of the get_state() overload without a Widget parameter.
    That was apparently forgotten when get_state() was added.

 gtk/src/cellrenderer.ccg |   10 ++++++++++
 gtk/src/cellrenderer.hg  |   29 +++++++++++++----------------
 2 files changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/gtk/src/cellrenderer.ccg b/gtk/src/cellrenderer.ccg
index 843a9ba..dd3d01f 100644
--- a/gtk/src/cellrenderer.ccg
+++ b/gtk/src/cellrenderer.ccg
@@ -21,6 +21,16 @@
 namespace Gtk
 {
 
+Gdk::Rectangle CellRenderer::get_aligned_area(Widget& widget, CellRendererState flags,
+  const Gdk::Rectangle& cell_area) const
+{
+  GdkRectangle gdk_aligned_area;
+  gtk_cell_renderer_get_aligned_area(const_cast<GtkCellRenderer*>(gobj()), widget.gobj(),
+    static_cast<GtkCellRendererState>(flags), cell_area.gobj(), &gdk_aligned_area);
+
+  return Glib::wrap(&gdk_aligned_area);
+}
+
 Glib::PropertyProxy_Base CellRenderer::_property_renderable()
 {
   g_assert_not_reached();
diff --git a/gtk/src/cellrenderer.hg b/gtk/src/cellrenderer.hg
index 745f9b3..e0481ec 100644
--- a/gtk/src/cellrenderer.hg
+++ b/gtk/src/cellrenderer.hg
@@ -53,8 +53,18 @@ public:
   _WRAP_METHOD(void get_preferred_width_for_height(Widget& widget, int height, int& minimum_width, int& 
natural_width) const, gtk_cell_renderer_get_preferred_width_for_height)
   _WRAP_METHOD(void get_preferred_size(Widget& widget, Requisition& minimum_size, Requisition& natural_size) 
const, gtk_cell_renderer_get_preferred_size)
 
-  //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)
+  /** Gets the aligned area used by this %CellRenderer inside @a cell_area.
+   * Used for finding the appropriate edit and focus rectangle.
+   *
+   * @newin{3,0}
+   *
+   * @param widget The Gtk::Widget this cell will be rendering to.
+   * @param flags Render flags.
+   * @param cell_area Cell area which would be passed to snapshot().
+   * @returns The space inside @a cell_area that would acually be used to render.
+   */
+  Gdk::Rectangle get_aligned_area(Widget& widget, CellRendererState flags, const Gdk::Rectangle& cell_area) 
const;
+  _IGNORE(gtk_cell_renderer_get_aligned_area)
 
   _WRAP_METHOD(void snapshot(
                   Snapshot& snapshot,
@@ -95,20 +105,7 @@ public:
 
   _WRAP_METHOD(void stop_editing(bool canceled = false), gtk_cell_renderer_stop_editing)
 
-  _WRAP_METHOD(StateFlags get_state(Widget& widget, CellRendererState cell_state) const, 
gtk_cell_renderer_get_state)
-
-
-  /** Translates the cell renderer state to StateFlags,
-   * based on the cell renderer and
-   * the given CellRendererState.
-   *
-   * @param cell_state The cell renderer state.
-   *
-   * @result The widget state flags applying to the cell renderer.
-   *
-   * @newin{3,0}
-   */
-  StateFlags get_state(CellRendererState cell_state) const;
+  _WRAP_METHOD(StateFlags get_state(Widget& widget{?}, CellRendererState cell_state) const, 
gtk_cell_renderer_get_state)
 
   /** Returns the property that this CellRenderer renders.
    * For instance, property_text for CellRendererText, and property_active for CellRendererToggle


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