[gtkmm] CellRenderer: Derive from CellSizeRequest instead of SizeRequest.



commit 828d2ab6cd8f30acbffc740da0b7307971fe5d4a
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Sep 20 15:44:40 2010 +0200

    CellRenderer: Derive from CellSizeRequest instead of SizeRequest.
    
      * gtk/src/filelist.am:
    * gtk/src/requisition.[hg|ccg]: Moved the simple Requisition typedef here
      from sizerequest.hg. We should wrap this properly, however.
    * gtk/src/sizerequest.[hg|ccg]: Include it.
    * gtk/src/cellsizerequest.[hg|ccg]: Added CellSizeRequest, like SizeRequest
      but for CellRenderer.
      * gtk/src/cellrenderer.hg: Derive from CellSizeRequest instead of
      SizeRequest.

 ChangeLog                                 |   15 +++++++-
 gtk/src/cellrenderer.hg                   |   30 +++-------------
 gtk/src/cellsizerequest.ccg               |   21 +++++++++++
 gtk/src/cellsizerequest.hg                |   57 +++++++++++++++++++++++++++++
 gtk/src/enums.hg                          |    2 +-
 gtk/src/filelist.am                       |    2 +
 gtk/src/gtk_signals.defs                  |    3 +-
 gtk/src/requisition.ccg                   |   18 +++++++++
 gtk/src/requisition.hg                    |   30 +++++++++++++++
 gtk/src/sizerequest.hg                    |    7 +---
 tools/extra_defs_gen/generate_defs_gtk.cc |    1 +
 11 files changed, 152 insertions(+), 34 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6180fa1..a6ff16b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,17 @@
-2010-09-20  Murray Cumming  <murrayc murrayc com>>
+2010-09-20  Murray Cumming  <murrayc murrayc com>
+
+	CellRenderer: Derive from CellSizeRequest instead of SizeRequest.
+
+  * gtk/src/filelist.am:
+	* gtk/src/requisition.[hg|ccg]: Moved the simple Requisition typedef here
+  from sizerequest.hg. We should wrap this properly, however.
+	* gtk/src/sizerequest.[hg|ccg]: Include it.
+	* gtk/src/cellsizerequest.[hg|ccg]: Added CellSizeRequest, like SizeRequest
+  but for CellRenderer.
+  * gtk/src/cellrenderer.hg: Derive from CellSizeRequest instead of
+  SizeRequest.
+
+2010-09-20  Murray Cumming  <murrayc murrayc com>
 
 	CellRenderer: Derive from SizeRequest.
 
diff --git a/gtk/src/cellrenderer.hg b/gtk/src/cellrenderer.hg
index ce49169..a0cef64 100644
--- a/gtk/src/cellrenderer.hg
+++ b/gtk/src/cellrenderer.hg
@@ -20,7 +20,7 @@ _CONFIGINCLUDE(gtkmmconfig.h)
 #include <gtkmm/object.h>
 #include <gtkmm/widget.h>
 #include <gtkmm/celleditable.h>
-#include <gtkmm/sizerequest.h>
+#include <gtkmm/cellsizerequest.h>
 
 _DEFS(gtkmm,gtk)
 _PH_INCLUDE(gtkmm/private/object_p.h)
@@ -41,12 +41,14 @@ _WRAP_ENUM(CellRendererMode, GtkCellRendererMode)
  */
 class CellRenderer :
   public Gtk::Object,
-  public SizeRequest
+  public CellSizeRequest
 {
   _CLASS_GTKOBJECT(CellRenderer,GtkCellRenderer,GTK_CELL_RENDERER,Gtk::Object,GtkObject)
-  _IMPLEMENTS_INTERFACE(SizeRequest)
+  _IMPLEMENTS_INTERFACE(CellSizeRequest)
 public:
 
+  _IGNORE(gtk_cell_renderer_get_size) //Deprecated
+
   _WRAP_METHOD(void render(
                   const Glib::RefPtr<Gdk::Window>& window,
                   Widget& widget,
@@ -143,28 +145,6 @@ public:
 protected:
   _CTOR_DEFAULT()
 
-  /** Override this in derived CellRenderers.
-   *
-   * Obtains the width and height needed to render the cell. Used by view widgets
-   * to determine the appropriate size for the cell_area passed to
-   * render().  If @a cell_area is not 0, fills in the x and y
-   * offsets (if set) of the cell relative to this location.  Please note that the
-   * values set in @a width and @a height, as well as those in @a x_offset and @a y_offset
-   * are inclusive of the xpad and ypad properties.
-   *
-   * @param widget The widget the renderer is rendering to.
-   * @param cell_area The area a cell will be allocated, or 0.
-   * @param x_offset x offset of cell relative to @a cell_area.
-   * @param y_offset y offset of cell relative to @a cell_area.
-   * @param width Width needed to render a cell.
-   * @param height Height needed to render a cell.
-   **/
-  _WRAP_VFUNC(void get_size(
-                  Widget& widget,
-                  const Gdk::Rectangle* cell_area,
-                  int* x_offset, int* y_offset,
-                  int* width,    int* height) const, get_size)
-
 #m4begin
 dnl This extra conversion does the extra reference, often needed by code for vfuncs and signal.
 _CONVERSION(`GdkDrawable*',`const Glib::RefPtr<Gdk::Drawable>&', `Glib::wrap($3, true)')
diff --git a/gtk/src/cellsizerequest.ccg b/gtk/src/cellsizerequest.ccg
new file mode 100644
index 0000000..e672a84
--- /dev/null
+++ b/gtk/src/cellsizerequest.ccg
@@ -0,0 +1,21 @@
+// -*- c++ -*-
+/* $Id: sizerequest.ccg,v 1.1 2003/01/21 13:38:48 murrayc Exp $ */
+
+/* Copyright 2010 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, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtk/gtk.h>
diff --git a/gtk/src/cellsizerequest.hg b/gtk/src/cellsizerequest.hg
new file mode 100644
index 0000000..5a730b0
--- /dev/null
+++ b/gtk/src/cellsizerequest.hg
@@ -0,0 +1,57 @@
+/* $Id: sizerequest.hg,v 1.3 2006/05/18 17:53:15 murrayc Exp $ */
+
+/* Copyright (C) 2010 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, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/interface.h>
+#include <gtkmm/widget.h>
+#include <gtkmm/enums.h>
+#include <gtkmm/requisition.h>
+_DEFS(gtkmm,gtk)
+_PINCLUDE(glibmm/private/interface_p.h)
+
+
+namespace Gtk
+{
+
+//TODO: Documentation.
+typedef GtkRequisition Requisition;
+
+/** TODO.
+ *
+ * @newin{3,0}
+ */
+class CellSizeRequest : public Glib::Interface
+{
+  _CLASS_INTERFACE(CellSizeRequest, GtkCellSizeRequest, GTK_CELL_SIZE_REQUEST, GtkCellSizeRequestIface)
+
+  //TODO: vfuncs
+
+public:
+  _WRAP_METHOD(SizeRequestMode get_request_mode() const, gtk_cell_size_request_get_request_mode)
+  _WRAP_METHOD(void get_width(Widget& widget, int& minimum_width, int& natural_width) const, gtk_cell_size_request_get_width)
+  _WRAP_METHOD(void get_height_for_width(Widget& widget, int width, int& minimum_height, int& natural_height) const, gtk_cell_size_request_get_height_for_width)
+  _WRAP_METHOD(void get_height(Widget& widget, int& minimum_height, int& natural_height) const, gtk_cell_size_request_get_height)
+  _WRAP_METHOD(void get_width_for_height(Widget& widget, int height, int& minimum_width, int& natural_width) const, gtk_cell_size_request_get_width_for_height)
+  _WRAP_METHOD(void get_size(Widget& widget, Requisition& minimum_size, Requisition& natural_size) const, gtk_cell_size_request_get_size)
+
+  //There are no signals or properties.
+  //TODO: vfuncs
+
+};
+
+} // namespace Gtk
diff --git a/gtk/src/enums.hg b/gtk/src/enums.hg
index edeb528..6280f17 100644
--- a/gtk/src/enums.hg
+++ b/gtk/src/enums.hg
@@ -100,7 +100,7 @@ _WRAP_ENUM(WrapMode, GtkWrapMode)
 _WRAP_ENUM(SortType, GtkSortType)
 _WRAP_ENUM(PageOrientation, GtkPageOrientation)
 _WRAP_ENUM(SensitivityType, GtkSensitivityType)
-
+_WRAP_ENUM(SizeRequestMode, GtkSizeRequestMode)
 
 #ifdef GTKMM_MAEMO_EXTENSIONS_ENABLED
 namespace Hildon
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 2d4b08c..b6b9f3c 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -45,6 +45,7 @@ gtkmm_files_any_hg =		\
 	cellrendererspinner.hg	\
 	cellrenderertext.hg	\
 	cellrenderertoggle.hg	\
+  cellsizerequest.hg \
 	cellview.hg		\
 	checkbutton.hg		\
 	checkmenuitem.hg	\
@@ -122,6 +123,7 @@ gtkmm_files_any_hg =		\
 	recentfilter.hg		\
 	recentinfo.hg		\
 	recentmanager.hg	\
+  requisition.hg \
 	ruler.hg		\
 	scale.hg		\
 	scalebutton.hg		\
diff --git a/gtk/src/gtk_signals.defs b/gtk/src/gtk_signals.defs
index 90cf68d..66fc019 100644
--- a/gtk/src/gtk_signals.defs
+++ b/gtk/src/gtk_signals.defs
@@ -9545,6 +9545,8 @@
   (construct-only #f)
 )
 
+;; From GtkCellSizeRequest
+
 ;; From GtkClipboard
 
 (define-signal owner-change
@@ -44458,4 +44460,3 @@
   (writable #t)
   (construct-only #f)
 )
-
diff --git a/gtk/src/requisition.ccg b/gtk/src/requisition.ccg
new file mode 100644
index 0000000..04fe2a1
--- /dev/null
+++ b/gtk/src/requisition.ccg
@@ -0,0 +1,18 @@
+/* $Id: requisition.hg,v 1.3 2006/05/18 17:53:15 murrayc Exp $ */
+
+/* Copyright (C) 2010 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, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
diff --git a/gtk/src/requisition.hg b/gtk/src/requisition.hg
new file mode 100644
index 0000000..55f376f
--- /dev/null
+++ b/gtk/src/requisition.hg
@@ -0,0 +1,30 @@
+/* $Id: requisition.hg,v 1.3 2006/05/18 17:53:15 murrayc Exp $ */
+
+/* Copyright (C) 2010 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, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtk/gtk.h> //TODO: Remove when we wrap it properly.
+_DEFS(gtkmm,gtk)
+
+namespace Gtk
+{
+
+//TODO: Documentation.
+//TODO: Wrap this properly.
+typedef GtkRequisition Requisition;
+
+} //namespace Gtk
diff --git a/gtk/src/sizerequest.hg b/gtk/src/sizerequest.hg
index 57ff25c..d032ff5 100644
--- a/gtk/src/sizerequest.hg
+++ b/gtk/src/sizerequest.hg
@@ -19,7 +19,7 @@
 
 #include <glibmm/interface.h>
 #include <gtkmm/enums.h>
-#include <gtk/gtk.h>
+#include <gtkmm/requisition.h>
 _DEFS(gtkmm,gtk)
 _PINCLUDE(glibmm/private/interface_p.h)
 
@@ -27,11 +27,6 @@ _PINCLUDE(glibmm/private/interface_p.h)
 namespace Gtk
 {
 
-//TODO: Documentation.
-typedef GtkRequisition Requisition;
-
-_WRAP_ENUM(SizeRequestMode, GtkSizeRequestMode)
-
 /** TODO.
  *
  * @newin{3,0}
diff --git a/tools/extra_defs_gen/generate_defs_gtk.cc b/tools/extra_defs_gen/generate_defs_gtk.cc
index 084f980..892818c 100644
--- a/tools/extra_defs_gen/generate_defs_gtk.cc
+++ b/tools/extra_defs_gen/generate_defs_gtk.cc
@@ -82,6 +82,7 @@ int main(int argc, char** argv)
             << get_defs( GTK_TYPE_CELL_RENDERER_PROGRESS )
             << get_defs( GTK_TYPE_CELL_RENDERER_SPIN )
             << get_defs( GTK_TYPE_CELL_RENDERER_SPINNER )
+            << get_defs( GTK_TYPE_CELL_SIZE_REQUEST )
             << get_defs( GTK_TYPE_CLIPBOARD )
             << get_defs( GTK_TYPE_COLOR_BUTTON )
             << get_defs( GTK_TYPE_COLOR_SELECTION )



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