[gtkmm] ButtonBox, Separator, Scale, Scrollbar: Add public constructors.



commit ffdd9168100d90867ca27fb11cc65ba46e4694a5
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Feb 14 12:14:36 2011 +0100

    ButtonBox, Separator, Scale, Scrollbar: Add public constructors.
    
    * gtk/src/buttonbox.hg:
    * gtk/src/separator.hg: Constructors: Added optional orientation parameters
    to match the new gtk_button_box_new() and gtk_separator_new() functions.
    * gtk/src/scale.[hg|ccg]:
    * gtk/src/scrollbar.[hg|ccg]: Added (Adjustment, Orientation) constructors to
    match the new gtk_scale_new() and gtk_scrollbar_new() functions.
    Make sure that the default constructors are now public, instead of protected,
    as these are no longer just abstract base classes. That change was made in
    GTK+.

 ChangeLog             |   14 ++++++++++++++
 gtk/src/box.hg        |    2 +-
 gtk/src/buttonbox.hg  |    3 +++
 gtk/src/scale.ccg     |    7 +++++++
 gtk/src/scale.hg      |   14 +++++++-------
 gtk/src/scrollbar.ccg |    6 ++++++
 gtk/src/scrollbar.hg  |   10 +++++++---
 gtk/src/separator.hg  |    7 +++----
 8 files changed, 48 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4b0730d..1ab9d29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2011-02-14  Murray Cumming  <murrayc murrayc com>
 
+	ButtonBox, Separator, Scale, Scrollbar: Add public constructors.
+
+	* gtk/src/buttonbox.hg:
+	* gtk/src/separator.hg: Constructors: Added optional orientation parameters 
+	to match the new gtk_button_box_new() and gtk_separator_new() functions.
+	* gtk/src/scale.[hg|ccg]: 
+	* gtk/src/scrollbar.[hg|ccg]: Added (Adjustment, Orientation) constructors to 
+	match the new gtk_scale_new() and gtk_scrollbar_new() functions.
+	Make sure that the default constructors are now public, instead of protected,
+	as these are no longer just abstract base classes. That change was made in 
+	GTK+.
+
+2011-02-14  Murray Cumming  <murrayc murrayc com>
+
 	Paned: Add an optional orientation parameter, matching the new C API.
 
 	* gtk/src/paned.hg: Change the constructor to match the new gtk_paned_new() 
diff --git a/gtk/src/box.hg b/gtk/src/box.hg
index 47c2d2a..70d98a8 100644
--- a/gtk/src/box.hg
+++ b/gtk/src/box.hg
@@ -46,7 +46,7 @@ enum PackOptions
 
 /** A base class for box containers.
  *
- * Abstract base class for horizontal and vertical boxes, which organize a
+ * Base class for horizontal and vertical boxes, which organize a
  * variable number of widgets into a rectangular area.  This is an abstract
  * class and it defers choice of which way the widgets are packed to the screen
  * to the derived classes.  It provides a common interface for inserting
diff --git a/gtk/src/buttonbox.hg b/gtk/src/buttonbox.hg
index 778ffa1..d628e73 100644
--- a/gtk/src/buttonbox.hg
+++ b/gtk/src/buttonbox.hg
@@ -45,6 +45,9 @@ class ButtonBox
   _IGNORE(gtk_button_box_set_spacing, gtk_button_box_get_spacing, gtk_button_box_set_child_size,
           gtk_button_box_set_child_ipadding, gtk_button_box_get_child_size, gtk_button_box_get_child_ipadding)
 public:
+  //Note that we try to use the same defaul parameter value as the default property value.
+  _WRAP_CTOR(ButtonBox(Orientation orientation = ORIENTATION_HORIZONTAL), gtk_button_box_new)
+
   _WRAP_METHOD(ButtonBoxStyle get_layout() const, gtk_button_box_get_layout)
   _WRAP_METHOD(void set_layout(ButtonBoxStyle layout_style), gtk_button_box_set_layout)
 
diff --git a/gtk/src/scale.ccg b/gtk/src/scale.ccg
index 21e0bd4..e7bd0e9 100644
--- a/gtk/src/scale.ccg
+++ b/gtk/src/scale.ccg
@@ -32,6 +32,13 @@ using std::strlen;
 namespace Gtk
 {
 
+Scale::Scale(const Glib::RefPtr<Adjustment>& adjustment, Orientation orientation)
+:
+  _CONSTRUCT_SPECIFIC(Range, Scale, "adjustment", Glib::unwrap(adjustment), "orientation", (GtkOrientation)(orientation))
+{
+}
+
+
 int Scale::calc_digits_(double step) const
 {
   int digits = 0;
diff --git a/gtk/src/scale.hg b/gtk/src/scale.hg
index fa949ca..5e04e06 100644
--- a/gtk/src/scale.hg
+++ b/gtk/src/scale.hg
@@ -29,7 +29,7 @@ _PINCLUDE(gtkmm/private/range_p.h)
 namespace Gtk
 {
 
-/** Abstract base clase for Gtk::HScale and Gtk::VScale.
+/** 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,
@@ -37,19 +37,19 @@ namespace Gtk
  * value of a scale, you would normally use set_value(). To detect
  * changes to the value, you would normally use signal_value_changed().
  *
- * The Gtk::Scale widget is an abstract class, used only for deriving the
- * subclasses Gtk::HScale and Gtk::VScale, so you should instantiate them
- * instead.
- *
  * @ingroup Widgets
  */
 class Scale : public Range
 {
   _CLASS_GTKOBJECT(Scale,GtkScale,GTK_SCALE,Gtk::Range,GtkRange)
-protected:
-  _CTOR_DEFAULT
 public:
 
+  _CTOR_DEFAULT()
+  
+  //Note that we try to use the same defaul parameter value as the default property value.
+  explicit Scale(const Glib::RefPtr<Adjustment>& adjustment, Orientation orientation = ORIENTATION_HORIZONTAL);
+  _IGNORE(gtk_scale_new)
+
   /** Set the number of decimal digits.
    *
    * This also causes the adjustment to be rounded off so the retrieved value
diff --git a/gtk/src/scrollbar.ccg b/gtk/src/scrollbar.ccg
index 506ba99..9429092 100644
--- a/gtk/src/scrollbar.ccg
+++ b/gtk/src/scrollbar.ccg
@@ -27,6 +27,12 @@
 namespace Gtk
 {
 
+Scrollbar::Scrollbar(const Glib::RefPtr<Adjustment>& adjustment, Orientation orientation)
+:
+_CONSTRUCT_SPECIFIC(Range, Scrollbar, "adjustment", Glib::unwrap(adjustment), "orientation", (GtkOrientation)(orientation))
+{
+}
+
 VScrollbar::VScrollbar(const Glib::RefPtr<Adjustment>& adjustment)
 :
   _CONSTRUCT_SPECIFIC(Scrollbar, VScrollbar)
diff --git a/gtk/src/scrollbar.hg b/gtk/src/scrollbar.hg
index 9ae1a32..fafb08f 100644
--- a/gtk/src/scrollbar.hg
+++ b/gtk/src/scrollbar.hg
@@ -29,7 +29,7 @@ _PINCLUDE(gtkmm/private/range_p.h)
 namespace Gtk
 {
 
-/**  The Gtk::Scrollbar widget is an abstract base class for Gtk::HScrollbar
+/**  The Gtk::Scrollbar widget is a base class for Gtk::HScrollbar
  * and Gtk::VScrollbar. It is not very useful in itself. 
  *
  * The position of the thumb in a scrollbar is controlled by the scroll
@@ -49,8 +49,12 @@ class Scrollbar
 {
   _CLASS_GTKOBJECT(Scrollbar,GtkScrollbar,GTK_SCROLLBAR,Gtk::Range,GtkRange)
   _IMPLEMENTS_INTERFACE(Orientable)
-
-protected:
+public:
+  _CTOR_DEFAULT()
+  
+  //Note that we try to use the same defaul parameter value as the default property value.
+  explicit Scrollbar(const Glib::RefPtr<Adjustment>& adjustment, Orientation orientation = ORIENTATION_HORIZONTAL);
+  _IGNORE(gtk_scrollbar_new)
   
 };
 
diff --git a/gtk/src/separator.hg b/gtk/src/separator.hg
index 41a6514..ea8b615 100644
--- a/gtk/src/separator.hg
+++ b/gtk/src/separator.hg
@@ -29,7 +29,7 @@ namespace Gtk
 {
 
 /** Separator base class.
- * Abstract base class for Gtk::VSeperator and Gtk::HSeperator.
+ * Base class for Gtk::VSeparator and Gtk::HSeparator.
  */
 class Separator
  : public Widget,
@@ -39,9 +39,8 @@ class Separator
   _IMPLEMENTS_INTERFACE(Orientable)
 public:
   
-
-protected:
-  _CTOR_DEFAULT
+  //Note that we try to use the same defaul parameter value as the default property value.
+  _WRAP_CTOR(Separator(Orientation orientation = ORIENTATION_HORIZONTAL), gtk_separator_new)
 };
 
 /** Vertical line widget.



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