[gtkmm] Widget: Make some methods protected.



commit bff86bd977ff53baaa3d25e320ee006cf21974c0
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jan 13 18:24:57 2011 +0100

    Widget: Make some methods protected.
    
    * gtk/src/widget.hg: set_window(), set_has_window(), and get_requisition()
    should only be used by the widget itself, in derived classes, so they can
    be protected, to simplify the public API.

 ChangeLog         |    8 +++++
 gtk/src/widget.hg |   75 +++++++++++++++++++++++++++-------------------------
 2 files changed, 47 insertions(+), 36 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 528b17d..c8b661a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-01-13  Murray Cumming  <murrayc murrayc com>
 
+	Widget: Make some methods protected.
+
+	* gtk/src/widget.hg: set_window(), set_has_window(), and get_requisition() 
+	should only be used by the widget itself, in derived classes, so they can 
+	be protected, to simplify the public API.
+
+2011-01-13  Murray Cumming  <murrayc murrayc com>
+
 	Documentation: Remove mentions of Pixmap.
 
 	* gdk/src/window.hg: Remove declaration of set_icon(pixmap), which had 
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index eb742df..6ba1152 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -223,7 +223,6 @@ public:
   _WRAP_METHOD(bool is_sensitive() const, gtk_widget_is_sensitive)
   _WRAP_METHOD(void set_visible(bool visible = true), gtk_widget_set_visible)
   _WRAP_METHOD(bool get_visible() const, gtk_widget_get_visible)
-  _WRAP_METHOD(void set_has_window(bool has_window = true), gtk_widget_set_has_window)
   _WRAP_METHOD(bool get_has_window() const, gtk_widget_get_has_window)
   _WRAP_METHOD(bool get_is_toplevel() const, gtk_widget_is_toplevel)
   _WRAP_METHOD(bool get_is_drawable() const, gtk_widget_is_drawable)
@@ -240,24 +239,6 @@ public:
   _WRAP_METHOD(void set_child_visible(bool is_visible = true), gtk_widget_set_child_visible)
   _WRAP_METHOD(bool get_child_visible() const, gtk_widget_get_child_visible)
 
-  /** Sets a widget's window. This function should only be used in a
-   * widget's Gtk::Widget::on_realize() implementation. The %window passed is
-   * usually either a new window created with Gdk::Window::create(), or the
-   * window of its parent widget as returned by get_parent_window().
-   * 
-   * Widgets must indicate whether they will create their own Gdk::Window
-   * by calling set_has_window(). This is usually done in the
-   * widget's constructor.
-   *
-   * This function should only be called by custom widget implementations,
-   * and they should call it in their on_realize() function.
-   * 
-   * @newin{2,18}
-   * @param window A Gdk::Window.
-   */
-  void set_window(const Glib::RefPtr<Gdk::Window>& window);
-  _IGNORE(gtk_widget_set_window)
-
   _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)
 
@@ -515,23 +496,6 @@ public:
 
   _IGNORE(gtk_widget_get_action) //deprecated
 
-  //TODO: Move this to protected when we can break API:
-  /**  Retrieves the widget's requisition.
-   *
-   * This method should only be used by widget implementations in
-   * order to discover whether the widget's requisition has actually
-   * changed after some internal state change (so that they can call
-   * queue_resize() instead of queue_draw()).
-   *
-   * Normally, size_request() should be used.
-   *
-   * @result The widget's requisition.
-   *
-   * @@newin{2,20}
-   */
-  Requisition get_requisition() const;
-  _IGNORE(gtk_widget_get_requisition)
-
   _WRAP_METHOD(bool in_destruction() const, gtk_widget_in_destruction)
   
   _WRAP_METHOD(Glib::RefPtr<StyleContext> get_style_context(), gtk_widget_get_style_context, refreturn)
@@ -837,6 +801,7 @@ dnl
   _WRAP_PROPERTY("margin", int)
 
 protected:
+
   //comment in GTK+ header: "seldomly overidden"
   _WRAP_VFUNC(void dispatch_child_properties_changed(guint, GParamSpec**), "dispatch_child_properties_changed")
 
@@ -852,6 +817,43 @@ protected:
   _WRAP_METHOD(void set_mapped(bool mapped = true), gtk_widget_set_mapped)
   _WRAP_METHOD(void set_realized(bool realized = true), gtk_widget_set_realized)
 
+  _WRAP_METHOD(void set_has_window(bool has_window = true), gtk_widget_set_has_window)
+  
+  /** Sets a widget's window. This function should only be used in a
+   * widget's Gtk::Widget::on_realize() implementation. The %window passed is
+   * usually either a new window created with Gdk::Window::create(), or the
+   * window of its parent widget as returned by get_parent_window().
+   * 
+   * Widgets must indicate whether they will create their own Gdk::Window
+   * by calling set_has_window(). This is usually done in the
+   * widget's constructor.
+   *
+   * This function should only be called by custom widget implementations,
+   * and they should call it in their on_realize() function.
+   * 
+   * @newin{2,18}
+   * @param window A Gdk::Window.
+   */
+  void set_window(const Glib::RefPtr<Gdk::Window>& window);
+  _IGNORE(gtk_widget_set_window)
+  
+  //TODO: Move this to protected when we can break API:
+  /**  Retrieves the widget's requisition.
+   *
+   * This method should only be used by widget implementations in
+   * order to discover whether the widget's requisition has actually
+   * changed after some internal state change (so that they can call
+   * queue_resize() instead of queue_draw()).
+   *
+   * Normally, size_request() should be used.
+   *
+   * @result The widget's requisition.
+   *
+   * @@newin{2,20}
+   */
+  Requisition get_requisition() const;
+  _IGNORE(gtk_widget_get_requisition)
+  
   _IGNORE(gtk_widget_style_attach) //deprecated
   _IGNORE(gtk_widget_get_child_requisition) //deprecated.
 
@@ -862,6 +864,7 @@ protected:
 
   void realize_if_needed();
 
+
 #m4begin
 dnl// Hook in custom hierarchy_changed callback.
 dnl// It will use the generated callback.



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