[gtkmm] Added methods that use RGBA.



commit 1dc2c3cb5a9033075236f1ab7ca301b87990602f
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Oct 26 10:43:17 2010 +0200

    Added methods that use RGBA.
    
    	* gtk/src/colorbutton.[hg|ccg]: Added a constructor taking a Gdk::RGBA, and
    	get/set_rgba().
    	* gtk/src/cellview.hg: Added set_background_rgba().
    	* tools/m4/convert_gdk.m4: Added necessary conversion.

 ChangeLog               |    9 +++++++++
 gtk/src/cellview.hg     |    2 ++
 gtk/src/colorbutton.ccg |   10 ++++++++--
 gtk/src/colorbutton.hg  |   42 +++++++++++++++++++++++++++++++++---------
 tools/m4/convert_gdk.m4 |    1 +
 5 files changed, 53 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6687b7c..1b01849 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-10-26  Murray Cumming  <murrayc murrayc com>>
+
+	Added methods that use RGBA.
+
+	* gtk/src/colorbutton.[hg|ccg]: Added a constructor taking a Gdk::RGBA, and
+	get/set_rgba().
+	* gtk/src/cellview.hg: Added set_background_rgba().
+	* tools/m4/convert_gdk.m4: Added necessary conversion.
+
 2010-10-26  Murray Cumming  <murrayc murrayc com>
 
 	gdkmm: Display: Added set/unset_device_hooks().
diff --git a/gtk/src/cellview.hg b/gtk/src/cellview.hg
index 2d708ac..438331b 100644
--- a/gtk/src/cellview.hg
+++ b/gtk/src/cellview.hg
@@ -24,6 +24,7 @@ _CONFIGINCLUDE(gtkmmconfig.h)
 #include <gtkmm/treepath.h>
 #include <gtkmm/cellrenderer.h>
 #include <gdkmm/pixbuf.h>
+#include <gdkmm/rgba.h>
 
 _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/widget_p.h)
@@ -88,6 +89,7 @@ public:
   _WRAP_METHOD(void get_desired_height_for_width_of_row(const TreeModel::Path& path, int avail_size,  int& minimum_size,  int& natural_size), gtk_cell_view_get_desired_height_for_width_of_row)
 
   _WRAP_METHOD(void set_background_color(const Gdk::Color& color), gtk_cell_view_set_background_color)
+  _WRAP_METHOD(void set_background_rgba(const Gdk::RGBA& rgba), gtk_cell_view_set_background_rgba)
 
   _IGNORE(gtk_cell_view_get_cell_renderers) //deprecated
 
diff --git a/gtk/src/colorbutton.ccg b/gtk/src/colorbutton.ccg
index 0d2d67b..2aba272 100644
--- a/gtk/src/colorbutton.ccg
+++ b/gtk/src/colorbutton.ccg
@@ -33,7 +33,13 @@ Gdk::Color ColorButton::get_color() const
   return color;
 }
 
-  
+Gdk::RGBA ColorButton::get_rgba() const
+{
+  Gdk::RGBA color;
+  gtk_color_button_get_rgba(const_cast<GtkColorButton*>(gobj()), color.gobj());
+  return color;
+}
+
 
-} // namespace Gtk
 
+} // namespace Gtk
diff --git a/gtk/src/colorbutton.hg b/gtk/src/colorbutton.hg
index e52a457..560852b 100644
--- a/gtk/src/colorbutton.hg
+++ b/gtk/src/colorbutton.hg
@@ -21,6 +21,7 @@
 
 #include <gtkmm/button.h>
 #include <gdkmm/color.h>
+#include <gdkmm/rgba.h>
 _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/button_p.h)
 
@@ -45,7 +46,7 @@ class ColorButton : public Button
 public:
 
   /** Creates a new color button.
-   * 
+   *
    * This creates a widget in the form of a small button containing a swatch representing
    * the current selected color. When the button is clicked, a color-selection dialog will
    * open, allowing the user to select a color. The swatch will be updated to reflect the
@@ -55,9 +56,9 @@ public:
    */
   _CTOR_DEFAULT()
   _IGNORE(gtk_color_button_new)
-  
+
   /** Creates a new color button with a predefined color.
-   * 
+   *
    * Same as Gtk::ColorButton::ColorButton(). Additionally takes a Gdk::Color and
    * initializes the button with this color. Equivalent to calling set_color(@a color)
    * after the default constructor.
@@ -68,11 +69,24 @@ public:
    */
   _WRAP_CTOR(ColorButton(const Gdk::Color& color), gtk_color_button_new_with_color)
 
+  /** Creates a new color button with a predefined color.
+   *
+   * Same as Gtk::ColorButton::ColorButton(). Additionally takes a Gdk::RGBA and
+   * initializes the button with this color. Equivalent to calling set_rgba(@a color)
+   * after the default constructor.
+   *
+   * @param color A Gdk::RGBA to set the current color with.
+   *
+   * @newin{3,0}
+   */
+  _WRAP_CTOR(ColorButton(const Gdk::RGBA& rgba), gtk_color_button_new_with_rgba)
+
   _WRAP_METHOD(void set_color(const Gdk::Color& color), gtk_color_button_set_color)
   _WRAP_METHOD(void set_alpha(guint16 alpha), gtk_color_button_set_alpha)
-  
+  _WRAP_METHOD(void set_rgba(const Gdk::RGBA& color), gtk_color_button_set_rgba)
+
   /** Returns a copy of the the current color.
-   * 
+   *
    * Changes to the return value will have no effect on the Gtk::ColorButton.
    *
    * @return A Gdk::Color representing the current internal color of the Gtk::ColorButton.
@@ -81,7 +95,18 @@ public:
    */
   Gdk::Color get_color() const;
   _IGNORE(gtk_color_button_get_color)
-  
+
+  /** Returns a copy of the the current color.
+   *
+   * Changes to the return value will have no effect on the Gtk::ColorButton.
+   *
+   * @return A Gdk::RGBA representing the current internal color of the Gtk::ColorButton.
+   *
+   * @newin{3,0}
+   */
+  Gdk::RGBA get_rgba() const;
+  _IGNORE(gtk_color_button_get_rgba)
+
   _WRAP_METHOD(guint16 get_alpha() const, gtk_color_button_get_alpha)
   _WRAP_METHOD(void set_use_alpha(bool use_alpha = true), gtk_color_button_set_use_alpha)
   _WRAP_METHOD(bool get_use_alpha() const, gtk_color_button_get_use_alpha)
@@ -94,12 +119,11 @@ public:
   _WRAP_PROPERTY("alpha", guint16)
 
   /** The color_set signal is emitted when the user selects a color. When handling this signal,
-   * use get_color() and get_alpha() to find out which color 
+   * use get_color() and get_alpha() to find out which color
    * was just selected.
    */
-  _WRAP_SIGNAL(void color_set(), "color-set")                    
+  _WRAP_SIGNAL(void color_set(), "color-set")
 };
 
 
 } // namespace Gtk
-
diff --git a/tools/m4/convert_gdk.m4 b/tools/m4/convert_gdk.m4
index 69e7b0d..88d8705 100644
--- a/tools/m4/convert_gdk.m4
+++ b/tools/m4/convert_gdk.m4
@@ -91,6 +91,7 @@ _CONVERSION(`GdkColor',`Gdk::Color', `Gdk::Color(const_cast<GdkColor*>(&($3)), t
 # Ref (gdkmm) -> Ptr (gtk+)
 _CONVERSION(`Color&',`GdkColor*',($3).gobj())
 _CONVERSION(`const Gdk::Color&',`const GdkColor*',`($3).gobj()')
+_CONVERSION(`const Gdk::RGBA&',`const GdkRGBA*',`($3).gobj()')
 _CONVERSION(`const Color&',`const GdkColor*',`($3).gobj()')
 _CONVERSION(`const Cursor&',`GdkCursor*',const_cast<GdkCursor*>(($3).gobj()))
 _CONVERSION(`Rectangle&',`GdkRectangle*',($3).gobj())



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