[gtkmm] ScaleButton: Add a constructor without the icons.



commit e0a8646349df572609fece8b958e46746f5a3cfb
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Dec 7 19:56:00 2014 +0100

    ScaleButton: Add a constructor without the icons.
    
    Because gtk_scale_button_new() allows that to be NULL.

 gtk/src/scalebutton.ccg |    8 ++++++++
 gtk/src/scalebutton.hg  |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gtk/src/scalebutton.ccg b/gtk/src/scalebutton.ccg
index 1dd6d0d..37bb84f 100644
--- a/gtk/src/scalebutton.ccg
+++ b/gtk/src/scalebutton.ccg
@@ -31,5 +31,13 @@ ScaleButton::ScaleButton(IconSize size, double min, double max, double step, con
   set_adjustment(adjustment);
 }
 
+ScaleButton::ScaleButton(IconSize size, double min, double max, double step)
+:
+  _CONSTRUCT("size", static_cast<GtkIconSize>(int(size)))
+{
+  Glib::RefPtr<Adjustment> adjustment = Adjustment::create(min, min, max, step, 10 * step, 0);
+  set_adjustment(adjustment);
+}
+
 } // namespace Gtk
 
diff --git a/gtk/src/scalebutton.hg b/gtk/src/scalebutton.hg
index 5516cc1..659b2ce 100644
--- a/gtk/src/scalebutton.hg
+++ b/gtk/src/scalebutton.hg
@@ -51,6 +51,9 @@ public:
   explicit ScaleButton(IconSize size, double min, double max, double step, const std::vector<Glib::ustring>& 
icons);
   _IGNORE(gtk_scale_button_new)
 
+  //We add the constructor without icons because the C functions allows that to be NULL.
+  explicit ScaleButton(IconSize size, double min, double max, double step);
+
 #m4 _CONVERSION(`const std::vector<Glib::ustring>&',`const 
gchar**',`Glib::ArrayHandler<Glib::ustring>::vector_to_array($3).data ()')
   _WRAP_METHOD(void set_icons(const std::vector<Glib::ustring>& icons), gtk_scale_button_set_icons)
   _WRAP_METHOD(double get_value() const, gtk_scale_button_get_value)


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