[gtkmm] Fix the build with latest GTK+, adding Scrollable interface.



commit 62fb51d469be389f69d44e47d653fae1b41c1868
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Oct 22 22:27:10 2010 +0200

    Fix the build with latest GTK+, adding Scrollable interface.
    
      * gtk/src/gtk_methods.defs: Regenerated with h2defs.py.
      * tools/extra_defs_gen/generate_defs_gtk.cc: Mention GTK_TYPE_SCROLLABLE.
      * gtk/src/gtk_signals.defs: Add the generated part for GtkScrollable.
      * gtk/src/filelist.am:
    * gtk/src/scrollable.[hg|ccg]: Added Scrollable interface, wrapping
    GtkScrollable.
    * gtk/src/iconview.hg:
    * gtk/src/layout.hg:
    * gtk/src/textview.hg:
    * gtk/src/toolpallette.hg:
    * gtk/src/treeview.hg:
    * gtk/src/viewport.hg: Derive from, and implement, Scrollable.
    Remove their get/set/unset_h/vadjustment() methods and set_scroll_adjustments
    signals, because they are now in the base Scrollable.
    * gtk/src/scrolledwindow.ccg: add() Use GTK_IS_SCROLLABLE() instead of the
    old hack to check the default signal handler for 0.

 ChangeLog                  |    7 +++++--
 gtk/src/layout.ccg         |   25 -------------------------
 gtk/src/layout.hg          |   25 ++++++-------------------
 gtk/src/scrollable.ccg     |   15 +++++++++++++++
 gtk/src/scrollable.hg      |   12 ++++++++++++
 gtk/src/scrolledwindow.ccg |   11 +++++------
 gtk/src/textview.hg        |    7 +------
 gtk/src/toolpalette.hg     |   15 +++++++--------
 gtk/src/treeview.ccg       |   10 ----------
 gtk/src/treeview.hg        |   22 ++--------------------
 gtk/src/viewport.hg        |   25 ++-----------------------
 11 files changed, 55 insertions(+), 119 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f2d2115..35c4402 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,10 +11,13 @@
 	* gtk/src/iconview.hg:
 	* gtk/src/layout.hg:
 	* gtk/src/textview.hg:
+	* gtk/src/toolpallette.hg:
 	* gtk/src/treeview.hg:
 	* gtk/src/viewport.hg: Derive from, and implement, Scrollable.
-	Remove their set_scroll_adjustments signals, because it is in the
-	base Scrollable.
+	Remove their get/set/unset_h/vadjustment() methods and set_scroll_adjustments 
+	signals, because they are now in the base Scrollable.
+	* gtk/src/scrolledwindow.ccg: add() Use GTK_IS_SCROLLABLE() instead of the 
+	old hack to check the default signal handler for 0.
 
 2010-10-22  Murray Cumming  <murrayc murrayc com>
 
diff --git a/gtk/src/layout.ccg b/gtk/src/layout.ccg
index 7a0c4c1..60f9502 100644
--- a/gtk/src/layout.ccg
+++ b/gtk/src/layout.ccg
@@ -45,30 +45,5 @@ namespace Gtk
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-Layout::Layout()
-:
-  _CONSTRUCT()
-{
-  set_hadjustment();
-  set_vadjustment();
-}
-
-Layout::Layout(const Glib::RefPtr<Adjustment>& hadjustment, const Glib::RefPtr<Adjustment>& vadjustment)
-:
-  _CONSTRUCT()
-{
-  set_hadjustment(hadjustment);
-  set_vadjustment(vadjustment);
-}
-
-void Layout::set_hadjustment()
-{
-  gtk_layout_set_hadjustment(gobj(), 0);
-}
-
-void Layout::set_vadjustment()
-{
-  gtk_layout_set_vadjustment(gobj(), 0);
-}
 
 } // namespace Gtk
diff --git a/gtk/src/layout.hg b/gtk/src/layout.hg
index e1eafb7..dd3a2ac 100644
--- a/gtk/src/layout.hg
+++ b/gtk/src/layout.hg
@@ -20,7 +20,6 @@
  */
 
 #include <gtkmm/container.h>
-#include <gtkmm/adjustment.h>
 #include <gtkmm/scrollable.h>
 #include <gdkmm/window.h>
 
@@ -51,9 +50,9 @@ class Layout
   _IMPLEMENTS_INTERFACE(Scrollable)
   _IGNORE(gtk_layout_freeze, gtk_layout_thaw)
 public:
-  Layout();
-  Layout(const Glib::RefPtr<Adjustment>& hadjustment, const Glib::RefPtr<Adjustment>& vadjustment);
-
+  _CTOR_DEFAULT
+  _WRAP_CTOR(Layout(const Glib::RefPtr<Adjustment>& hadjustment, const Glib::RefPtr<Adjustment>& vadjustment), gtk_layout_new)
+  
   _WRAP_METHOD(Glib::RefPtr<Gdk::Window> get_bin_window(), gtk_layout_get_bin_window, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Gdk::Window> get_bin_window() const, gtk_layout_get_bin_window, refreturn, constversion)
 
@@ -61,22 +60,10 @@ public:
   _WRAP_METHOD(void move(Widget& child_widget, int x, int y), gtk_layout_move)
   _WRAP_METHOD(void set_size(guint width, guint height), gtk_layout_set_size)
   _WRAP_METHOD(void get_size(guint& width, guint& height) const, gtk_layout_get_size)
+  
+  _IGNORE(gtk_layout_get_hadjustment, gtk_layout_set_hadjustment,
+    gtk_layout_get_vadjustment, gtk_layout_set_vadjustment) //deprecated
 
-  _WRAP_METHOD(void set_hadjustment(const Glib::RefPtr<Adjustment>& adjustment), gtk_layout_set_hadjustment)
-
-  /// Creates the Adjustment.
-  void set_hadjustment();
-  _WRAP_METHOD(Glib::RefPtr<Adjustment> get_hadjustment(), gtk_layout_get_hadjustment)
-  _WRAP_METHOD(Glib::RefPtr<const Adjustment> get_hadjustment() const, gtk_layout_get_hadjustment, constversion)
-  _WRAP_METHOD(void set_vadjustment(const Glib::RefPtr<Adjustment>& adjustment), gtk_layout_set_vadjustment)
-
-  /// Creates the Adjustment.
-  void set_vadjustment();
-  _WRAP_METHOD(Glib::RefPtr<Adjustment> get_vadjustment(), gtk_layout_get_vadjustment)
-  _WRAP_METHOD(Glib::RefPtr<const Adjustment> get_vadjustment() const, gtk_layout_get_vadjustment, constversion)
-
-  _WRAP_PROPERTY("hadjustment", Glib::RefPtr<Adjustment>)
-  _WRAP_PROPERTY("vadjustment", Glib::RefPtr<Adjustment>)
   _WRAP_PROPERTY("width", guint)
   _WRAP_PROPERTY("height", guint)
 };
diff --git a/gtk/src/scrollable.ccg b/gtk/src/scrollable.ccg
index 7bede42..256ee02 100644
--- a/gtk/src/scrollable.ccg
+++ b/gtk/src/scrollable.ccg
@@ -16,3 +16,18 @@
  */
 
 #include <gtk/gtk.h>
+
+namespace Gtk
+{
+
+void Scrollable::unset_hadjustment()
+{
+  gtk_scrollable_set_hadjustment(gobj(), 0);
+}
+
+void Scrollable::unset_vadjustment()
+{
+  gtk_scrollable_set_vadjustment(gobj(), 0);
+}
+
+} //namespace Gtk
diff --git a/gtk/src/scrollable.hg b/gtk/src/scrollable.hg
index 94453ec..d14d7cc 100644
--- a/gtk/src/scrollable.hg
+++ b/gtk/src/scrollable.hg
@@ -15,6 +15,7 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <gtkmm/adjustment.h>
 #include <glibmm/interface.h>
 #include <gtkmm/enums.h>
 #include <gtk/gtk.h> //TODO: Hide this?
@@ -43,11 +44,20 @@ public:
 
   _WRAP_METHOD(void set_hadjustment(const Glib::RefPtr<Adjustment>& hadjustment), gtk_scrollable_set_hadjustment)
 
+  /** This method removes the hadjustment.
+   * @see set_hadjustment().
+   */
+  void unset_hadjustment();
+  
   _WRAP_METHOD(Glib::RefPtr<Adjustment> get_vadjustment(), gtk_scrollable_get_vadjustment)
   _WRAP_METHOD(Glib::RefPtr<const Adjustment> get_vadjustment() const, gtk_scrollable_get_vadjustment)
 
   _WRAP_METHOD(void set_vadjustment(const Glib::RefPtr<Adjustment>& hadjustment), gtk_scrollable_set_vadjustment)
 
+  /** This method removes the vadjustment.
+   * @see set_vadjustment().
+   */
+  void unset_vadjustment();
 
   _WRAP_METHOD(int get_min_display_width() const, gtk_scrollable_get_min_display_width)
   _WRAP_METHOD(void set_min_display_width(int width), gtk_scrollable_set_min_display_width)
@@ -56,6 +66,8 @@ public:
   _WRAP_METHOD(void set_min_display_height(int width), gtk_scrollable_set_min_display_height)
 
   //TODO: Properties and signals.
+  _WRAP_PROPERTY("hadjustment", Glib::RefPtr<Adjustment>)
+  _WRAP_PROPERTY("vadjustment", Glib::RefPtr<Adjustment>)
 };
 
 } // namespace Gtk
diff --git a/gtk/src/scrolledwindow.ccg b/gtk/src/scrolledwindow.ccg
index 942531c..21d0a6b 100644
--- a/gtk/src/scrolledwindow.ccg
+++ b/gtk/src/scrolledwindow.ccg
@@ -33,16 +33,15 @@ void ScrolledWindow::add(Gtk::Widget& widget)
 {
   GtkWidget* gwidget = widget.gobj();
 
-  //This check is courtesy of James Henstridge on gtk-devel-list gnome org 
-  if( GTK_WIDGET_GET_CLASS(gwidget)->set_scroll_adjustments_signal == 0)
+  if( GTK_IS_SCROLLABLE(gwidget) )
   {
-    //It doesn't have native scrolling capability, so it should be put inside a viewport first:
-    gtk_scrolled_window_add_with_viewport(gobj(), gwidget);
+    //It can work directly with a GtkScrolledWindow, so just use the Container::add():
+    Bin::add(widget);
   }
   else
   {
-    //It can work directly with a GtkScrolledWindow, so just use the Container::add():
-    Bin::add(widget);
+    //It doesn't have native scrolling capability, so it should be put inside a viewport first:
+    gtk_scrolled_window_add_with_viewport(gobj(), gwidget);
   }
 }
 
diff --git a/gtk/src/textview.hg b/gtk/src/textview.hg
index a9b63ee..a98fce9 100644
--- a/gtk/src/textview.hg
+++ b/gtk/src/textview.hg
@@ -26,7 +26,6 @@ _CONFIGINCLUDE(gtkmmconfig.h)
 #include <gtkmm/textbuffer.h>
 #include <gtkmm/textmark.h>
 #include <gtkmm/menu.h>
-#include <gtkmm/adjustment.h>
 
 _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/container_p.h)
@@ -139,11 +138,7 @@ public:
                                             int window_x, int window_y,
                                             int& buffer_x, int& buffer_y) const, gtk_text_view_window_to_buffer_coords)
 
-  _WRAP_METHOD(Glib::RefPtr<Adjustment> get_hadjustment(), gtk_text_view_get_hadjustment)
-  _WRAP_METHOD(Glib::RefPtr<const Adjustment> get_hadjustment() const, gtk_text_view_get_hadjustment, constversion)
-
-  _WRAP_METHOD(Glib::RefPtr<Adjustment> get_vadjustment(), gtk_text_view_get_vadjustment)
-  _WRAP_METHOD(Glib::RefPtr<const Adjustment> get_vadjustment() const, gtk_text_view_get_vadjustment, constversion)
+  _IGNORE(gtk_text_view_get_hadjustment, gtk_tree_view_get_vadjustment) //deprecated
 
   _WRAP_METHOD(Glib::RefPtr<Gdk::Window> get_window(TextWindowType win), gtk_text_view_get_window, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Gdk::Window> get_window(TextWindowType win) const, gtk_text_view_get_window, refreturn, constversion)
diff --git a/gtk/src/toolpalette.hg b/gtk/src/toolpalette.hg
index 5d01e5c..04353ee 100644
--- a/gtk/src/toolpalette.hg
+++ b/gtk/src/toolpalette.hg
@@ -18,7 +18,7 @@
 #include <gtkmm/container.h>
 #include <gtkmm/toolitem.h>
 #include <gtkmm/orientable.h>
-#include <gtkmm/adjustment.h>
+#include <gtkmm/scrollable.h>
 #include <gtkmm/toolitemgroup.h>
 
 _DEFS(gtkmm,gtk)
@@ -48,10 +48,12 @@ _WRAP_ENUM(ToolPaletteDragTargets, GtkToolPaletteDragTargets)
  */
 class ToolPalette
 : public Container,
-  public Orientable
+  public Orientable,
+  public Scrollable
 {
   _CLASS_GTKOBJECT(ToolPalette, GtkToolPalette, GTK_TOOL_PALETTE, Gtk::Container, GtkContainer)
   _IMPLEMENTS_INTERFACE(Orientable)
+  _IMPLEMENTS_INTERFACE(Scrollable)
 public:
   _CTOR_DEFAULT()
 
@@ -87,18 +89,15 @@ public:
   _WRAP_METHOD(void set_drag_source(ToolPaletteDragTargets targets = TOOL_PALETTE_DRAG_ITEMS), gtk_tool_palette_set_drag_source)
   _WRAP_METHOD(void add_drag_dest(Gtk::Widget& widget, DestDefaults flags = DEST_DEFAULT_ALL, ToolPaletteDragTargets targets = TOOL_PALETTE_DRAG_ITEMS, Gdk::DragAction actions = Gdk::ACTION_COPY), gtk_tool_palette_add_drag_dest)
 
-  _WRAP_METHOD(Glib::RefPtr<Adjustment> get_hadjustment(), gtk_tool_palette_get_hadjustment)
-  _WRAP_METHOD(Glib::RefPtr<const Adjustment> get_hadjustment() const, gtk_tool_palette_get_hadjustment, constversion)
-  _WRAP_METHOD(Glib::RefPtr<Adjustment> get_vadjustment (), gtk_tool_palette_get_vadjustment)
-  _WRAP_METHOD(Glib::RefPtr<const Adjustment> get_vadjustment () const, gtk_tool_palette_get_vadjustment, constversion)
+  _IGNORE(gtk_tool_palette_get_hadjustment, gtk_tool_palette_get_hadjustment,
+    gtk_tool_palette_get_vadjustment, gtk_tool_palette_get_vadjustment)
 
 
 #m4 _CONVERSION(`const GtkTargetEntry*',`TargetEntry',`TargetEntry(*$3)')
   _WRAP_METHOD(static TargetEntry get_drag_target_item(), gtk_tool_palette_get_drag_target_item)
   _WRAP_METHOD(static TargetEntry get_drag_target_group(), gtk_tool_palette_get_drag_target_group)
 
-  //Ignore the set_scroll_adjustment signal. It's in many widgets and seems internal.
-  //_WRAP_SIGNAL(void set_scroll_adjustments(const Glib::RefPtr<Adjustment>& hadjustment, const Glib::RefPtr<Adjustment>& vadjustment), "set-scroll-adjustments")
+  //Ignore the set_scroll_adjustment signal. It's deprecated.
   _IGNORE_SIGNAL(set_scroll_adjustments)
 
   _WRAP_PROPERTY("icon-size", IconSize)
diff --git a/gtk/src/treeview.ccg b/gtk/src/treeview.ccg
index 771deea..96871f7 100644
--- a/gtk/src/treeview.ccg
+++ b/gtk/src/treeview.ccg
@@ -117,16 +117,6 @@ static void SignalProxy_SearchPosition_gtk_callback_destroy(void* data)
 namespace Gtk
 {
 
-void TreeView::unset_hadjustment()
-{
-  gtk_tree_view_set_hadjustment(gobj(), 0);
-}
-
-void TreeView::unset_vadjustment()
-{
-  gtk_tree_view_set_vadjustment(gobj(), 0);
-}
-
 int TreeView::insert_column_with_data_func(int position, const Glib::ustring& title, CellRenderer& cell, const SlotCellData& slot)
 {
   //Create a copy of the slot. A pointer to this will be passed through the callback's data parameter.
diff --git a/gtk/src/treeview.hg b/gtk/src/treeview.hg
index fc4877f..903b988 100644
--- a/gtk/src/treeview.hg
+++ b/gtk/src/treeview.hg
@@ -21,7 +21,6 @@ _CONFIGINCLUDE(gtkmmconfig.h)
 
 #include <glibmm/listhandle.h>
 #include <gtkmm/container.h>
-#include <gtkmm/adjustment.h>
 #include <gtkmm/treeviewcolumn.h>
 #include <gtkmm/treeselection.h>
 #include <gtkmm/treemodelcolumn.h>
@@ -136,23 +135,8 @@ public:
 
   _WRAP_METHOD(Glib::RefPtr<TreeSelection> get_selection(), gtk_tree_view_get_selection, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const TreeSelection> get_selection() const, gtk_tree_view_get_selection, refreturn, constversion)
-  _WRAP_METHOD(Glib::RefPtr<Adjustment> get_hadjustment(), gtk_tree_view_get_hadjustment)
-  _WRAP_METHOD(Glib::RefPtr<const Adjustment> get_hadjustment() const, gtk_tree_view_get_hadjustment, constversion)
-  _WRAP_METHOD(void set_hadjustment(const Glib::RefPtr<Adjustment>& adjustment), gtk_tree_view_set_hadjustment)
-
-  /** This method removes the hadjustment.
-   * @see set_hadjustment().
-   */
-  void unset_hadjustment();
-
-  _WRAP_METHOD(Glib::RefPtr<Adjustment> get_vadjustment(), gtk_tree_view_get_vadjustment)
-  _WRAP_METHOD(Glib::RefPtr<const Adjustment> get_vadjustment() const, gtk_tree_view_get_vadjustment, constversion)
-  _WRAP_METHOD(void set_vadjustment(const Glib::RefPtr<Adjustment>& adjustment), gtk_tree_view_set_vadjustment)
-
-  /** This method removes the vadjustment.
-   * @see set_vadjustment().
-   */
-  void unset_vadjustment();
+  _IGNORE(gtk_tree_view_get_hadjustment, gtk_tree_view_get_vadjustment,
+    gtk_tree_view_set_hadjustment, gtk_tree_view_set_vadjustment) //deprecated
 
   _WRAP_METHOD(bool get_headers_visible() const, gtk_tree_view_get_headers_visible)
   _WRAP_METHOD(void set_headers_visible(bool headers_visible = true), gtk_tree_view_set_headers_visible)
@@ -797,8 +781,6 @@ _CONVERSION(`GtkTreeIter*',`const TreeModel::iterator&',`TreeModel::iterator(gtk
 
 
   _WRAP_PROPERTY("model", Glib::RefPtr<TreeModel>)
-  _WRAP_PROPERTY("hadjustment", Adjustment*)
-  _WRAP_PROPERTY("vadjustment", Adjustment*)
   _WRAP_PROPERTY("headers-visible", bool)
   _WRAP_PROPERTY("headers-clickable", bool)
   _WRAP_PROPERTY("expander-column", TreeViewColumn*)
diff --git a/gtk/src/viewport.hg b/gtk/src/viewport.hg
index 57d09ac..0664b5f 100644
--- a/gtk/src/viewport.hg
+++ b/gtk/src/viewport.hg
@@ -27,7 +27,6 @@ _PINCLUDE(gtkmm/private/bin_p.h)
 
 
 namespace Gtk {
-class Adjustment;
 
 /** An adapter which makes widgets scrollable.
  *
@@ -45,21 +44,8 @@ public:
   _WRAP_CTOR(Viewport(const Glib::RefPtr<Adjustment>& hadjustment, const Glib::RefPtr<Adjustment>& vadjustment), gtk_viewport_new)
 
 
-  _WRAP_METHOD(Glib::RefPtr<Adjustment> get_hadjustment(),
-               gtk_viewport_get_hadjustment)
-  _WRAP_METHOD(Glib::RefPtr<const Adjustment> get_hadjustment() const,
-               gtk_viewport_get_hadjustment, constversion)
-
-  _WRAP_METHOD(Glib::RefPtr<Adjustment> get_vadjustment(),
-               gtk_viewport_get_vadjustment)
-  _WRAP_METHOD(Glib::RefPtr<const Adjustment> get_vadjustment() const,
-               gtk_viewport_get_vadjustment, constversion)
-
-  _WRAP_METHOD(void set_hadjustment(const Glib::RefPtr<Adjustment>& adjustment),
-               gtk_viewport_set_hadjustment)
-
-  _WRAP_METHOD(void set_vadjustment(const Glib::RefPtr<Adjustment>& adjustment),
-               gtk_viewport_set_vadjustment)
+  _IGNORE(gtk_viewport_get_hadjustment, gtk_viewport_get_vadjustment,
+    gtk_viewport_set_hadjustment, set_vadjustment) //deprecated
 
   _WRAP_METHOD(void set_shadow_type(ShadowType type),
                gtk_viewport_set_shadow_type)
@@ -73,13 +59,6 @@ public:
   _WRAP_METHOD(Glib::RefPtr<Gdk::Window> get_view_window(), gtk_viewport_get_view_window, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Gdk::Window> get_view_window() const, gtk_viewport_get_view_window, refreturn, constversion)
 
-#m4 _CONVERSION(`GtkAdjustment*',`const Glib::RefPtr<Adjustment>&',`Glib::wrap($3, true)')
-  _WRAP_SIGNAL(void set_scroll_adjustments(const Glib::RefPtr<Adjustment>& hadjustment,
-                                           const Glib::RefPtr<Adjustment>& vadjustment),
-               "set_scroll_adjustments")
-
-  _WRAP_PROPERTY("hadjustment", Glib::RefPtr<Adjustment>)
-  _WRAP_PROPERTY("vadjustment", Glib::RefPtr<Adjustment>)
   _WRAP_PROPERTY("shadow_type", ShadowType)
 };
 



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