[gtkmm] Fix the build of the demos (and they even run).



commit 0cdf7e5e6fbfaa1cd68f4d387fff827577a783da
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Sep 28 16:07:58 2010 +0200

    Fix the build of the demos (and they even run).
    
    * gtk/src/gtk_signals.defs: Regenerated.
    * gtk/src/widget.hg: Added get_allocated_width()/height().
      * gtk/src/container.hg: Comment out propagate_expose() because of GTK+
      bug #630800.
    * demos/gtk-demo/example_drawingarea.cc:
    * demos/gtk-demo/example_pixbufs.cc:
    * demos/pixbuf-demo.cc: Change the expose_event handlers to
      draw handlers.

 ChangeLog                             |   13 ++
 demos/gtk-demo/example_drawingarea.cc |   44 +++----
 demos/gtk-demo/example_pixbufs.cc     |   15 +--
 demos/pixbuf-demo.cc                  |   17 +--
 gtk/src/container.hg                  |    4 +-
 gtk/src/frame.hg                      |    6 +-
 gtk/src/gtk_signals.defs              |  214 +++++++++++++++++++++++---------
 gtk/src/layout.hg                     |    4 -
 gtk/src/printoperation.hg             |    4 +-
 gtk/src/scale.hg                      |   31 +++---
 gtk/src/widget.hg                     |    9 ++
 tools/m4/convert_gtk.m4               |    2 -
 12 files changed, 227 insertions(+), 136 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 62f8ccb..1580393 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2010-09-28  Murray Cumming  <murrayc murrayc com>
 
+	Fix the build of the demos (and they even run).
+
+	* gtk/src/gtk_signals.defs: Regenerated.
+	* gtk/src/widget.hg: Added get_allocated_width()/height().
+  * gtk/src/container.hg: Comment out propagate_expose() because of GTK+
+  bug #630800.
+	* demos/gtk-demo/example_drawingarea.cc:
+	* demos/gtk-demo/example_pixbufs.cc:
+	* demos/pixbuf-demo.cc: Change the expose_event handlers to
+  draw handlers.
+
+2010-09-28  Murray Cumming  <murrayc murrayc com>
+
 	Fix the build with the latest GTK+ from git master.
 
 	* gtk/gtkmm/private/object_p.h: Add this back for now, to avoid making
diff --git a/demos/gtk-demo/example_drawingarea.cc b/demos/gtk-demo/example_drawingarea.cc
index 1393278..ebc7dfb 100644
--- a/demos/gtk-demo/example_drawingarea.cc
+++ b/demos/gtk-demo/example_drawingarea.cc
@@ -5,7 +5,7 @@
  *
  * This demo has two drawing areas. The checkerboard area shows
  * how you can just draw something; all you have to do is write
- * a signal handler for expose_event, as shown here.
+ * a signal handler for draw, as shown here.
  *
  * The "scribble" area is a bit more advanced, and shows how to handle
  * events such as button presses and mouse motion. Click the mouse
@@ -23,8 +23,8 @@ public:
 
 protected:
   //signal handlers:
-  bool on_drawingarea_checkerboard_expose_event(GdkEventExpose* event);
-  bool on_drawingarea_scribble_expose_event(GdkEventExpose* event);
+  bool on_drawingarea_checkerboard_draw(const Cairo::RefPtr<Cairo::Context>& cr);
+  bool on_drawingarea_scribble_draw(const Cairo::RefPtr<Cairo::Context>& cr);
   bool on_drawingarea_scribble_configure_event(GdkEventConfigure* event);
   bool on_drawingarea_scribble_motion_notify_event(GdkEventMotion* event);
   bool on_drawingarea_scribble_button_press_event(GdkEventButton* event);
@@ -69,8 +69,8 @@ Example_DrawingArea::Example_DrawingArea()
   m_DrawingArea_Checkerboard.set_size_request(100, 100);
   m_Frame_Checkerboard.add(m_DrawingArea_Checkerboard);
 
-  m_DrawingArea_Checkerboard.signal_expose_event().connect(
-      sigc::mem_fun(*this, &Example_DrawingArea::on_drawingarea_checkerboard_expose_event));
+  m_DrawingArea_Checkerboard.signal_draw().connect(
+      sigc::mem_fun(*this, &Example_DrawingArea::on_drawingarea_checkerboard_draw));
 
   /*
    * Create the scribble area
@@ -86,8 +86,8 @@ Example_DrawingArea::Example_DrawingArea()
   m_Frame_Scribble.add(m_DrawingArea_Scribble);
 
   /* Signals used to handle backing pixmap */
-  m_DrawingArea_Scribble.signal_expose_event().connect(
-      sigc::mem_fun(*this, &Example_DrawingArea::on_drawingarea_scribble_expose_event));
+  m_DrawingArea_Scribble.signal_draw().connect(
+      sigc::mem_fun(*this, &Example_DrawingArea::on_drawingarea_scribble_draw));
   m_DrawingArea_Scribble.signal_configure_event().connect(
       sigc::mem_fun(*this, &Example_DrawingArea::on_drawingarea_scribble_configure_event));
 
@@ -111,32 +111,27 @@ Example_DrawingArea::~Example_DrawingArea()
 {
 }
 
-bool Example_DrawingArea::on_drawingarea_checkerboard_expose_event(GdkEventExpose* event)
+bool Example_DrawingArea::on_drawingarea_checkerboard_draw(const Cairo::RefPtr<Cairo::Context>& cr)
 {
   enum { CHECK_SIZE = 10, SPACING = 2 };
 
-  /* At the start of an expose handler, a clip region of event->area
-   * is set on the window, and event->area has been cleared to the
+  /* At the start of a draw handler, a clip region has been set on
+   * the Cairo context, and the contents have been cleared to the
    * widget's background color. The docs for
-   * gdk_window_begin_paint_region() give more details on how this
+   * Gdk::Window::begin_paint_region() give more details on how this
    * works.
    */
 
-  Glib::RefPtr<Gdk::Window> window = get_window();
-  Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
-
-  const Gdk::Rectangle rectangle(&(event->area));
-  Gdk::Cairo::add_rectangle_to_path(cr, rectangle);
-  cr->clip();
-
   int xcount = 0;
+
+  const int width = m_DrawingArea_Checkerboard.get_allocated_width();
+  const int height = m_DrawingArea_Checkerboard.get_allocated_height();
   int i = SPACING;
-  const int width = m_DrawingArea_Checkerboard.get_allocation().get_width();
   while (i < width)
   {
     int j = SPACING;
     int ycount = xcount % 2; /* start with even/odd depending on row */
-    while (j < m_DrawingArea_Checkerboard.get_allocation().get_height())
+    while (j < height)
     {
       if (ycount % 2)
         cr->set_source_rgb(0.45777, 0, 0.45777);
@@ -164,15 +159,10 @@ bool Example_DrawingArea::on_drawingarea_checkerboard_expose_event(GdkEventExpos
   return true;
 }
 
-bool Example_DrawingArea::on_drawingarea_scribble_expose_event(GdkEventExpose* event)
+bool Example_DrawingArea::on_drawingarea_scribble_draw(const Cairo::RefPtr<Cairo::Context>& cr)
 {
-  Glib::RefPtr<Gdk::Window> window = get_window();
-  Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
   cr->set_source(m_surface, 0, 0); //TODO: Add =0 default parameters to cairomm.
-
-  const Gdk::Rectangle rectangle(&(event->area));
-  Gdk::Cairo::add_rectangle_to_path(cr, rectangle);
-  cr->clip();
+  cr->paint();
 
   return false;
 }
diff --git a/demos/gtk-demo/example_pixbufs.cc b/demos/gtk-demo/example_pixbufs.cc
index 1106f67..d283b31 100644
--- a/demos/gtk-demo/example_pixbufs.cc
+++ b/demos/gtk-demo/example_pixbufs.cc
@@ -53,7 +53,7 @@ protected:
   virtual void load_pixbufs();
 
   //signal handlers:
-  virtual bool on_drawingarea_expose(GdkEventExpose *event);
+  virtual bool on_drawingarea_draw(const Cairo::RefPtr<Cairo::Context>& cr);
   virtual bool on_timeout();
 
   //Member widgets:
@@ -86,7 +86,7 @@ Example_Pixbufs::Example_Pixbufs()
 
   set_size_request(m_back_width, m_back_height);
   m_refPixbuf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, FALSE, 8, m_back_width, m_back_height);
-  m_DrawingArea.signal_expose_event().connect(sigc::mem_fun(*this, &Example_Pixbufs::on_drawingarea_expose));
+  m_DrawingArea.signal_draw().connect(sigc::mem_fun(*this, &Example_Pixbufs::on_drawingarea_draw));
   add(m_DrawingArea);
 
   m_TimeoutConnection = Glib::signal_timeout().connect(
@@ -123,16 +123,11 @@ void Example_Pixbufs::load_pixbufs()
   }
 }
 
-/* Expose callback for the drawing area */
-bool Example_Pixbufs::on_drawingarea_expose(GdkEventExpose *event)
+/* Draw callback for the drawing area */
+bool Example_Pixbufs::on_drawingarea_draw(const Cairo::RefPtr<Cairo::Context>& cr)
 {
-  Glib::RefPtr<Gdk::Window> window = get_window();
-  Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
   Gdk::Cairo::set_source_pixbuf(cr, m_refPixbuf_Background);
-
-  const Gdk::Rectangle rectangle(&(event->area));
-  Gdk::Cairo::add_rectangle_to_path(cr, rectangle);
-  cr->fill();
+  cr->paint();
 
   return true;
 }
diff --git a/demos/pixbuf-demo.cc b/demos/pixbuf-demo.cc
index ae21484..34275c1 100644
--- a/demos/pixbuf-demo.cc
+++ b/demos/pixbuf-demo.cc
@@ -74,7 +74,7 @@ public:
   virtual ~DemoRenderArea();
 
 protected:
-  virtual bool on_expose_event(GdkEventExpose* event);
+  virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
 
 private:
   Glib::RefPtr<const Gdk::Pixbuf>                 background_;
@@ -123,25 +123,20 @@ DemoRenderArea::~DemoRenderArea()
 {}
 
 /*
- * Expose event handler of the widget.  Just fill the exposed
+ * Draw handler of the widget.  Just fill the exposed
  * area with the corresponding pixmap data from current_frame_.
  */
-bool DemoRenderArea::on_expose_event(GdkEventExpose* event)
+bool DemoRenderArea::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
 {
-  Glib::RefPtr<Gdk::Window> window = get_window();
-  Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
   Gdk::Cairo::set_source_pixbuf(cr, current_frame_);
-
-  const Gdk::Rectangle rectangle(&(event->area));
-  Gdk::Cairo::add_rectangle_to_path(cr, rectangle);
-  cr->fill();
+  cr->paint();
 
   return true; // stop signal emission
 }
 
 /*
  * Generate the next frame of the animation and store it into current_frame_.
- * The expose_event handler accesses that buffer to do the actual drawing.
+ * The draw handler accesses that buffer to do the actual drawing.
  */
 void DemoRenderArea::generate_next_frame()
 {
@@ -189,7 +184,7 @@ void DemoRenderArea::generate_next_frame()
   frame_num_ = (frame_num_ + 1) % CYCLE_LEN;
 
   // Tell GTK+ the widget should be redrawn soon.  This will trigger the
-  // expose_event signal if the widget is actually mapped on the screen.
+  // draw signal if the widget is actually mapped on the screen.
   queue_draw();
 }
 
diff --git a/gtk/src/container.hg b/gtk/src/container.hg
index 5cf89ed..2a0d9db 100644
--- a/gtk/src/container.hg
+++ b/gtk/src/container.hg
@@ -109,8 +109,8 @@ public:
   _WRAP_METHOD(Glib::ListHandle<Widget*> get_children(), gtk_container_get_children)
   _WRAP_METHOD(Glib::ListHandle<const Widget*> get_children() const, gtk_container_get_children)
 
-  _WRAP_METHOD(void propagate_expose(Widget& child, GdkEventExpose* event),
-               gtk_container_propagate_expose)
+  //TODO: See https://bugzilla.gnome.org/show_bug.cgi?id=630800
+  //_WRAP_METHOD(void propagate_expose(Widget& child, GdkEventExpose* event), gtk_container_propagate_expose)
 
   _WRAP_METHOD(void set_focus_chain(const Glib::ListHandle<Widget*>& focusable_widgets),
                gtk_container_set_focus_chain)
diff --git a/gtk/src/frame.hg b/gtk/src/frame.hg
index 89516cd..acc4ced 100644
--- a/gtk/src/frame.hg
+++ b/gtk/src/frame.hg
@@ -1,7 +1,7 @@
 /* $Id: frame.hg,v 1.6 2006/04/12 11:11:25 murrayc Exp $ */
 
 /* frame.h
- * 
+ *
  * Copyright (C) 1998-2002 The gtkmm Development Team
  *
  * This library is free software; you can redistribute it and/or
@@ -49,7 +49,7 @@ public:
   _WRAP_CTOR(Frame(const Glib::ustring& label), gtk_frame_new)
 
   //TODO: Add a bool use_markup arg to set_label() as a convenience - it would have to use set_label_widget().
-    
+
   /** Set the label to appear in the top edge of the frame.
    * Label alignment defaults to the upper left corner of the frame.
    */
@@ -85,9 +85,9 @@ public:
   _WRAP_PROPERTY("label-widget", Widget*)
 
 protected:
+#m4 _CONVERSION(`GtkAllocation*',`Allocation&',`($2)(Glib::wrap($3))')
   _WRAP_VFUNC(void compute_child_allocation(Allocation& allocation), compute_child_allocation)
 
 };
 
 } // namespace Gtk
-
diff --git a/gtk/src/gtk_signals.defs b/gtk/src/gtk_signals.defs
index edec6ab..4bc97ae 100644
--- a/gtk/src/gtk_signals.defs
+++ b/gtk/src/gtk_signals.defs
@@ -1,5 +1,3 @@
-;; From GdkColormap
-
 ;; From GdkDragContext
 
 ;; From GdkDisplay
@@ -153,8 +151,6 @@
   )
 )
 
-;; From GdkPixmap
-
 ;; From GdkScreen
 
 (define-signal size-changed
@@ -242,6 +238,15 @@
 
 ;; From GtkAboutDialog
 
+(define-signal activate-link
+  (of-object "GtkAboutDialog")
+  (return-type "gboolean")
+  (when "last")
+  (parameters
+    '("const-gchar*" "p0")
+  )
+)
+
 (define-property name
   (of-object "GtkAboutDialog")
   (prop-type "GParamString")
@@ -647,6 +652,15 @@
   (construct-only #f)
 )
 
+(define-property visual
+  (of-object "GtkAboutDialog")
+  (prop-type "GParamObject")
+  (docs "The visual this window is created from")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 (define-property type-hint
   (of-object "GtkAboutDialog")
   (prop-type "GParamEnum")
@@ -3354,6 +3368,15 @@
   (construct-only #f)
 )
 
+(define-property visual
+  (of-object "GtkAssistant")
+  (prop-type "GParamObject")
+  (docs "The visual this window is created from")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 (define-property type-hint
   (of-object "GtkAssistant")
   (prop-type "GParamEnum")
@@ -9568,8 +9591,6 @@
   (construct-only #f)
 )
 
-;; From GtkCellSizeRequest
-
 ;; From GtkClipboard
 
 (define-signal owner-change
@@ -10796,6 +10817,15 @@
   (construct-only #f)
 )
 
+(define-property visual
+  (of-object "GtkColorSelectionDialog")
+  (prop-type "GParamObject")
+  (docs "The visual this window is created from")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 (define-property type-hint
   (of-object "GtkColorSelectionDialog")
   (prop-type "GParamEnum")
@@ -12879,6 +12909,15 @@
   (construct-only #f)
 )
 
+(define-property visual
+  (of-object "GtkDialog")
+  (prop-type "GParamObject")
+  (docs "The visual this window is created from")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 (define-property type-hint
   (of-object "GtkDialog")
   (prop-type "GParamEnum")
@@ -13301,7 +13340,7 @@
   (parameters
     '("const-gchar*" "p0")
     '("gint" "p1")
-    '("gpointer" "p2")
+    '("gint" "p2")
   )
 )
 
@@ -16022,6 +16061,15 @@
   (construct-only #f)
 )
 
+(define-property visual
+  (of-object "GtkFileChooserDialog")
+  (prop-type "GParamObject")
+  (docs "The visual this window is created from")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 (define-property type-hint
   (of-object "GtkFileChooserDialog")
   (prop-type "GParamEnum")
@@ -18090,6 +18138,15 @@
   (construct-only #f)
 )
 
+(define-property visual
+  (of-object "GtkFontSelectionDialog")
+  (prop-type "GParamObject")
+  (docs "The visual this window is created from")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 (define-property type-hint
   (of-object "GtkFontSelectionDialog")
   (prop-type "GParamEnum")
@@ -19256,24 +19313,6 @@
   (construct-only #f)
 )
 
-(define-property pixmap
-  (of-object "GtkImage")
-  (prop-type "GParamObject")
-  (docs "A GdkPixmap to display")
-  (readable #t)
-  (writable #t)
-  (construct-only #f)
-)
-
-(define-property mask
-  (of-object "GtkImage")
-  (prop-type "GParamObject")
-  (docs "Mask bitmap to use with GdkPixmap")
-  (readable #t)
-  (writable #t)
-  (construct-only #f)
-)
-
 (define-property file
   (of-object "GtkImage")
   (prop-type "GParamString")
@@ -24456,6 +24495,15 @@
   (construct-only #f)
 )
 
+(define-property visual
+  (of-object "GtkMessageDialog")
+  (prop-type "GParamObject")
+  (docs "The visual this window is created from")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 (define-property type-hint
   (of-object "GtkMessageDialog")
   (prop-type "GParamEnum")
@@ -25421,23 +25469,15 @@
   (construct-only #f)
 )
 
-(define-property group
+(define-property group-name
   (of-object "GtkNotebook")
-  (prop-type "GParamPointer")
-  (docs "Group for tabs drag and drop")
+  (prop-type "GParamString")
+  (docs "Group name for tab drag and drop")
   (readable #t)
   (writable #t)
   (construct-only #f)
 )
 
-;; From GtkObject
-
-(define-signal destroy
-  (of-object "GtkObject")
-  (return-type "void")
-  (when "unknown")
-)
-
 ;; From GtkOffscreenWindow
 
 (define-property name
@@ -25845,6 +25885,15 @@
   (construct-only #f)
 )
 
+(define-property visual
+  (of-object "GtkOffscreenWindow")
+  (prop-type "GParamObject")
+  (docs "The visual this window is created from")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 (define-property type-hint
   (of-object "GtkOffscreenWindow")
   (prop-type "GParamEnum")
@@ -26793,6 +26842,15 @@
   (construct-only #f)
 )
 
+(define-property visual
+  (of-object "GtkPlug")
+  (prop-type "GParamObject")
+  (docs "The visual this window is created from")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 (define-property type-hint
   (of-object "GtkPlug")
   (prop-type "GParamEnum")
@@ -27801,6 +27859,15 @@
   (construct-only #f)
 )
 
+(define-property visual
+  (of-object "GtkPageSetupUnixDialog")
+  (prop-type "GParamObject")
+  (docs "The visual this window is created from")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 (define-property type-hint
   (of-object "GtkPageSetupUnixDialog")
   (prop-type "GParamEnum")
@@ -28343,6 +28410,15 @@
   (construct-only #f)
 )
 
+(define-property visual
+  (of-object "GtkPrintUnixDialog")
+  (prop-type "GParamObject")
+  (docs "The visual this window is created from")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 (define-property type-hint
   (of-object "GtkPrintUnixDialog")
   (prop-type "GParamEnum")
@@ -34714,7 +34790,7 @@
 (define-property gtk-icon-sizes
   (of-object "GtkSettings")
   (prop-type "GParamString")
-  (docs "List of icon sizes: gtk-menu=16,16:gtk-button=20,20...")
+  (docs "List of icon sizes (gtk-menu=16,16:gtk-button=20,20...")
   (readable #t)
   (writable #t)
   (construct-only #f)
@@ -35145,8 +35221,6 @@
   (construct-only #f)
 )
 
-;; From GtkSizeRequest
-
 ;; From GtkSocket
 
 (define-signal plug-added
@@ -42016,6 +42090,22 @@
   )
 )
 
+;; From GtkTreeSelection
+
+(define-signal changed
+  (of-object "GtkTreeSelection")
+  (return-type "void")
+  (when "first")
+)
+
+;; From GtkTreeSortable
+
+(define-signal sort-column-changed
+  (of-object "GtkTreeSortable")
+  (return-type "void")
+  (when "last")
+)
+
 ;; From GtkTreeModelFilter
 
 (define-property child-model
@@ -42036,7 +42126,6 @@
   (construct-only #t)
 )
 
-
 ;; From GtkTreeModelSort
 
 (define-property model
@@ -43673,6 +43762,12 @@
   (when "last")
 )
 
+(define-signal destroy
+  (of-object "GtkWidget")
+  (return-type "void")
+  (when "unknown")
+)
+
 (define-signal show
   (of-object "GtkWidget")
   (return-type "void")
@@ -43723,7 +43818,7 @@
   (return-type "void")
   (when "first")
   (parameters
-    '("GtkAllocation*" "p0")
+    '("GdkRectangle*" "p0")
   )
 )
 
@@ -43790,6 +43885,15 @@
   )
 )
 
+(define-signal draw
+  (of-object "GtkWidget")
+  (return-type "gboolean")
+  (when "last")
+  (parameters
+    '("cairo_t*" "p0")
+  )
+)
+
 (define-signal mnemonic-activate
   (of-object "GtkWidget")
   (return-type "gboolean")
@@ -43904,15 +44008,6 @@
   )
 )
 
-(define-signal expose-event
-  (of-object "GtkWidget")
-  (return-type "gboolean")
-  (when "last")
-  (parameters
-    '("GdkEventExpose*" "p0")
-  )
-)
-
 (define-signal key-press-event
   (of-object "GtkWidget")
   (return-type "gboolean")
@@ -44207,15 +44302,6 @@
   (return-type "gboolean")
   (when "last")
   (parameters
-    '("GdkEvent*" "p0")
-  )
-)
-
-(define-signal damage-event
-  (of-object "GtkWidget")
-  (return-type "gboolean")
-  (when "last")
-  (parameters
     '("GdkEventExpose*" "p0")
   )
 )
@@ -44993,6 +45079,15 @@
   (construct-only #f)
 )
 
+(define-property visual
+  (of-object "GtkWindow")
+  (prop-type "GParamObject")
+  (docs "The visual this window is created from")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 (define-property type-hint
   (of-object "GtkWindow")
   (prop-type "GParamEnum")
@@ -45498,4 +45593,3 @@
   (writable #t)
   (construct-only #f)
 )
-
diff --git a/gtk/src/layout.hg b/gtk/src/layout.hg
index 3c1dd6b..c0d390b 100644
--- a/gtk/src/layout.hg
+++ b/gtk/src/layout.hg
@@ -39,10 +39,6 @@ namespace Gtk
  * Gtk::Container.  However if you're just going to draw, a Gtk::DrawingArea
  * is a better choice since it has lower overhead.
  *
- * When handling expose_event signals, you must draw to the bin_window
- * Gdk::Window - see get_bin_window() - rather than the normal Gdk::Window -
- * see get_window() - as you would for a drawing area.
- *
  * @ingroup Widgets
  * @ingroup Containers
  */
diff --git a/gtk/src/printoperation.hg b/gtk/src/printoperation.hg
index 648a708..4fb2b71 100644
--- a/gtk/src/printoperation.hg
+++ b/gtk/src/printoperation.hg
@@ -135,6 +135,8 @@ public:
   _WRAP_SIGNAL(void end_print(const Glib::RefPtr<PrintContext>& context), "end_print")
   _WRAP_SIGNAL(void status_changed(), "status_changed")
 
+  #m4 _CONVERSION(`Widget*',`GObject*',`G_OBJECT(Glib::unwrap($3))')
+  #m4 _CONVERSION(`GObject*',`Widget*',`Glib::wrap(GTK_WIDGET($3))')
   _WRAP_SIGNAL(Widget* create_custom_widget(), "create_custom_widget")
 
   _WRAP_SIGNAL(void custom_widget_apply(Widget* widget), "custom_widget_apply")
@@ -149,7 +151,7 @@ public:
 
   //TODO: Remove no_default_handler when we can break ABI.
   #m4 _CONVERSION(`GtkPrintSettings*', `const Glib::RefPtr<PrintSettings>&', `Glib::wrap($3, true)')
-  _WRAP_SIGNAL(void update_custom_widget(Gtk::Widget* widget, const Glib::RefPtr<PageSetup>& setup, const Glib::RefPtr<PrintSettings>& settings), "update_custom_widget", no_default_handler)
+  _WRAP_SIGNAL(void update_custom_widget(Widget* widget, const Glib::RefPtr<PageSetup>& setup, const Glib::RefPtr<PrintSettings>& settings), "update_custom_widget", no_default_handler)
 
   _WRAP_PROPERTY("default_page_setup", Glib::RefPtr<PageSetup>)
   _WRAP_PROPERTY("print_settings", Glib::RefPtr<PrintSettings>)
diff --git a/gtk/src/scale.hg b/gtk/src/scale.hg
index 9d3bf3d..fa949ca 100644
--- a/gtk/src/scale.hg
+++ b/gtk/src/scale.hg
@@ -1,7 +1,7 @@
 /* $Id: scale.hg,v 1.7 2006/04/12 11:11:25 murrayc Exp $ */
 
 /* scale.h
- * 
+ *
  * Copyright (C) 1998-2002 The gtkmm Development Team
  *
  * This library is free software; you can redistribute it and/or
@@ -30,7 +30,7 @@ namespace Gtk
 {
 
 /** Abstract base clase for Gtk::HScale and Gtk::VScale.
- * 
+ *
  * A Gtk::Scale is a slider control used to select a numeric value. To use it,
  * you'll probably want to investigate the methods on its base class,
  * Gtk::Range, in addition to the methods for Gtk::Scale itself. To set the
@@ -49,9 +49,9 @@ class Scale : public Range
 protected:
   _CTOR_DEFAULT
 public:
-  
+
   /** Set the number of decimal digits.
-   * 
+   *
    * This also causes the adjustment to be rounded off so the retrieved value
    * matches the value the user sees. Setting digits to 1 gives for example
    * 1.0, 2 gives 1.00, etc.
@@ -62,11 +62,11 @@ public:
    */
   _WRAP_METHOD(int get_digits() const, gtk_scale_get_digits)
 
-  /** Set whether the current value is displayed as a string next to the slider. 
+  /** Set whether the current value is displayed as a string next to the slider.
    */
   _WRAP_METHOD(void set_draw_value(bool draw_value = true), gtk_scale_set_draw_value)
 
-  /** Get whether the current value is displayed as a string next to the slider. 
+  /** Get whether the current value is displayed as a string next to the slider.
    */
   _WRAP_METHOD(bool get_draw_value() const, gtk_scale_get_draw_value)
 
@@ -85,7 +85,7 @@ public:
 
   _WRAP_METHOD(void add_mark(double value, PositionType position, const Glib::ustring& markup), gtk_scale_add_mark)
   _WRAP_METHOD(void clear_marks(), gtk_scale_clear_marks)
-  
+
 #m4 dnl// The ::format_value signal handler should return a newly allocated string.
 #m4 dnl// (which is obviously not a const gchar*)
 #m4 dnl// Also, ensure that format_value never returns an empty char[],
@@ -94,14 +94,14 @@ public:
 #m4 _CONVERSION(`Glib::ustring',`gchar*',`(strlen($3.c_str()) ? g_strdup($3.c_str()) : 0)')
 
   /** Determines how the value is formatted.
-   * 
+   *
    * This can be used to connect a custom function for determining how the
    * value is formatted. The function (or function object) is given a the value
    * as a double and should return the representation of it as a Glib::ustring.
-   */ 
+   */
   _WRAP_SIGNAL(Glib::ustring format_value(double value), "format_value")
   // TODO: When we can break ABI, this signal needs to be
-  // Glib::ustring format_value(double value, bool& use_default_formatting), 
+  // Glib::ustring format_value(double value, bool& use_default_formatting),
   // where use_default_formatting specifies whether the return value will actually be a null char*.
 
   /** Number of displayed decimal digits.
@@ -119,12 +119,12 @@ public:
 protected:
 
   _WRAP_VFUNC(void draw_value(), draw_value)
-  
+
   virtual int calc_digits_(double step) const;
 };
 
 /** A vertical slider for selecting values.
- * 
+ *
  * The Gtk::VScale widget is used to allow the user to select a value using a
  * vertical slider. See the Gtk::Scale documentation for more information
  * on how to use a Gtk::VScale.
@@ -147,7 +147,7 @@ public:
   */
   VScale(double min, double max, double step);
   explicit VScale(const Glib::RefPtr<Adjustment>& adjustment);
-  
+
 };
 
 /** A horizontal slider for selecting values.
@@ -158,7 +158,7 @@ public:
  *
  * The HScale widget looks like this:
  * @image html hscale1.png
- * 
+ *
  * @ingroup Widgets
  */
 class HScale : public Scale
@@ -173,8 +173,7 @@ public:
   */
   HScale(double min, double max, double step);
   explicit HScale(const Glib::RefPtr<Adjustment>& adjustment);
-  
+
 };
 
 } /* namespace Gtk */
-
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index 319685d..c4b4d1b 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -245,6 +245,9 @@ public:
   _WRAP_METHOD(Glib::RefPtr<Gdk::Window> get_window(), gtk_widget_get_window, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Gdk::Window> get_window() const, gtk_widget_get_window, refreturn, constversion)
 
+  _WRAP_METHOD(int get_allocated_width() const, gtk_widget_get_allocated_width)
+  _WRAP_METHOD(int get_allocated_height() const, gtk_widget_get_allocated_height)
+
   /** Retrieves the widget's location.
    * @return The widget's allocated area.
    */
@@ -252,6 +255,7 @@ public:
   _IGNORE(gtk_widget_get_allocation)
 
 #m4 _CONVERSION(`const Allocation&',`const GtkAllocation*',`($3).gobj()')
+#m4 _CONVERSION(`const Allocation&',`const GdkRectangle*',`($3).gobj()')
   _WRAP_METHOD(void set_allocation(const Allocation& allocation), gtk_widget_set_allocation)
 
   _WRAP_METHOD(Container* get_parent(), gtk_widget_get_parent)
@@ -607,7 +611,11 @@ public:
   //_WRAP(meth|sig|impl,void unrealize_(),gtk_widget_unrealize,"unrealize")
   _WRAP_SIGNAL(void unrealize(),"unrealize")
 
+//TODO: Use a Requisition& instead?
   _WRAP_SIGNAL(void size_request(Requisition* requisition), "size_request")
+
+#m4 _CONVERSION(`Allocation&',`GdkRectangle*',`($2)($3.gobj())')
+#m4 _CONVERSION(`GdkRectangle*',`Allocation&',`($2)(Glib::wrap($3))')
   _WRAP_SIGNAL(void size_allocate(Allocation& allocation), "size_allocate")
 
 // Changed signals -- inform widget of internal changes.
@@ -689,6 +697,7 @@ dnl
   _POP()
 #m4end
 
+#m4 _CONVERSION(`cairo_t*',`const Cairo::RefPtr<Cairo::Context>&',`Cairo::RefPtr<Cairo::Context>(new Cairo::Context($3, false /* has_reference */))')
   _WRAP_SIGNAL(bool draw(const Cairo::RefPtr<Cairo::Context>& cr), "draw")
 
   /// Event triggered by a key press will widget has focus.
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index 5d7f929..fdd8ded 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -510,7 +510,6 @@ _CONVERSION(`Tooltips&',`GtkTooltips*',__FR2P)
 
 _CONVERSION(`const Glib::RefPtr<Tooltip>&',`GtkTooltip*',__CONVERT_REFPTR_TO_P)
 
-_CONVERSION(`Allocation&',`GtkAllocation*',`($2)($3.gobj())')
 #_CONVERSION(`GtkAllocation*',`Allocation&',`($2)(Glib::wrap($3))')
 
 #TargetList
@@ -531,7 +530,6 @@ _CONVERSION(`GtkRequisition', `Requisition', `($2)($3)')
 
 _CONVERSION(`Allocation&',`GtkAllocation*',`($2)($3.gobj())')
 _CONVERSION(`const Allocation&',`GtkAllocation*',`($2)($3.gobj())')
-_CONVERSION(`GtkAllocation*',`Allocation&',`($2)(Glib::wrap($3))')
 _CONVERSION(`Allocation',`GtkAllocation',`($2)(*($3.gobj()))')
 
 _CONVERSION(`GtkEntry*',`Entry*',__RP2P)



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