[gtkmm] Fix Gdk::RGBA and fix the demos build (make check)



commit c61884ee106d0f31a63b68b7449aefa80d4cbc03
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Dec 7 13:20:58 2010 +0100

    Fix Gdk::RGBA and fix the demos build (make check)
    
    * gdk/src/rgba.[hg|ccg]: Change set_rgb() to set_rgba(), adding an optional
    alpha parameter.
      Change set_rgb_p() to set_rgba_p(), adding an optional
    alpha parameter.
    Fix their implementation because GdkRGBA has double members instead of gushort
    members as in GdkColor.
    * gtk/src/colorselection.[hg|ccg]: Added get/set_current_rgba() and
    get/set_previous_rgba().
    * demos/gtk-demo/example_colorsel.cc:
    * demos/gtk-demo/example_drawingarea.cc:
    * demos/gtk-demo/example_textview.cc:
    * demos/gtk-demo/textwidget.cc: Use Gdk::RGBA rather than Gdk::Color, using
    the Widget::override_*() methods instead of the old Widget::modify_*() methods.

 ChangeLog                             |   18 ++++++++++++++++++
 demos/gtk-demo/example_colorsel.cc    |    6 ++++--
 demos/gtk-demo/example_drawingarea.cc |    2 +-
 demos/gtk-demo/example_textview.cc    |    4 ++--
 demos/gtk-demo/textwidget.cc          |    2 +-
 gtk/src/colorselection.ccg            |   14 ++++++++++++++
 gtk/src/colorselection.hg             |    7 +++++++
 7 files changed, 47 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 475a8b1..ebd5619 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2010-12-07  Murray Cumming  <murrayc murrayc com>>
+
+	Fix Gdk::RGBA and fix the demos build (make check)
+
+	* gdk/src/rgba.[hg|ccg]: Change set_rgb() to set_rgba(), adding an optional 
+	alpha parameter.
+  Change set_rgb_p() to set_rgba_p(), adding an optional 
+	alpha parameter.
+	Fix their implementation because GdkRGBA has double members instead of gushort 
+	members as in GdkColor.
+	* gtk/src/colorselection.[hg|ccg]: Added get/set_current_rgba() and 
+	get/set_previous_rgba().
+	* demos/gtk-demo/example_colorsel.cc:
+	* demos/gtk-demo/example_drawingarea.cc:
+	* demos/gtk-demo/example_textview.cc:
+	* demos/gtk-demo/textwidget.cc: Use Gdk::RGBA rather than Gdk::Color, using 
+	the Widget::override_*() methods instead of the old Widget::modify_*() methods.
+
 2010-12-07  Murray Cumming  <murrayc murrayc com>
 
 	Regenerate gtk_signals.defs.
diff --git a/demos/gtk-demo/example_colorsel.cc b/demos/gtk-demo/example_colorsel.cc
index 7fd9a7e..a7ddec7 100644
--- a/demos/gtk-demo/example_colorsel.cc
+++ b/demos/gtk-demo/example_colorsel.cc
@@ -53,13 +53,15 @@ Example_ColorSel::Example_ColorSel()
   // set a fixed size
   m_DrawingArea.set_size_request(200, 200);
 
+  /* TODO: Is this still necessary? It is not in the C version now.
   // Unset the background pixmap (as used by pixmap themes)
   // because it takes precedence over the background color.
   m_DrawingArea.modify_bg_pixmap(Gtk::STATE_NORMAL, "<none>");
+  */
 
   // set the color
   m_Color.set_rgba(0, 0, 1, 1);
-  m_DrawingArea.modify_bg(Gtk::STATE_NORMAL, m_Color);
+  m_DrawingArea.override_background_color((Gtk::StateFlags)0, m_Color);
 
   m_Frame.add(m_DrawingArea);
 
@@ -93,7 +95,7 @@ void Example_ColorSel::on_button_clicked()
   {
     m_Color = pColorSel->get_current_rgba();
 
-    m_DrawingArea.override_background_color(Gtk::STATE_NORMAL, m_Color);
+    m_DrawingArea.override_background_color((Gtk::StateFlags)0, m_Color);
   }
 }
 
diff --git a/demos/gtk-demo/example_drawingarea.cc b/demos/gtk-demo/example_drawingarea.cc
index ebc7dfb..4c83e6f 100644
--- a/demos/gtk-demo/example_drawingarea.cc
+++ b/demos/gtk-demo/example_drawingarea.cc
@@ -197,7 +197,7 @@ bool Example_DrawingArea::on_drawingarea_scribble_motion_notify_event(GdkEventMo
   if(event && event->window)
   {
     const Glib::RefPtr<Gdk::Window> refWindow =
-        Glib::wrap((GdkWindowObject*) event->window, true); // true == take_copy
+        Glib::wrap(event->window, true); // true == take_copy
 
     if(refWindow)
     {
diff --git a/demos/gtk-demo/example_textview.cc b/demos/gtk-demo/example_textview.cc
index 1014b22..84b4a67 100644
--- a/demos/gtk-demo/example_textview.cc
+++ b/demos/gtk-demo/example_textview.cc
@@ -457,8 +457,8 @@ void Window_EasterEgg::recursive_attach_view(int depth, Gtk::TextView& view, Gli
 
   /* Event box is to add a black border around each child view */
   Gtk::EventBox* pEventBox = Gtk::manage( new Gtk::EventBox());
-  Gdk::Color color("black");
-  pEventBox->modify_bg(Gtk::STATE_NORMAL, color);
+  Gdk::RGBA color("black");
+  pEventBox->override_background_color((Gtk::StateFlags)0, color);
 
   Gtk::Alignment* pAlign = Gtk::manage( new Gtk::Alignment(0.5, 0.5, 1.0, 1.0));
   pAlign->set_border_width(1);
diff --git a/demos/gtk-demo/textwidget.cc b/demos/gtk-demo/textwidget.cc
index 5405179..1c829d1 100644
--- a/demos/gtk-demo/textwidget.cc
+++ b/demos/gtk-demo/textwidget.cc
@@ -43,7 +43,7 @@ TextWidget::TextWidget(bool is_source)
   {
 #ifndef G_OS_WIN32
     Pango::FontDescription fontDesc("Courier 12");
-    m_TextView.modify_font(fontDesc);
+    m_TextView.override_font(fontDesc);
 #endif /* G_OS_WIN32 */
     m_TextView.set_wrap_mode (Gtk::WRAP_NONE);
 
diff --git a/gtk/src/colorselection.ccg b/gtk/src/colorselection.ccg
index a54c259..a4bf3c3 100644
--- a/gtk/src/colorselection.ccg
+++ b/gtk/src/colorselection.ccg
@@ -71,6 +71,20 @@ Gdk::Color ColorSelection::get_previous_color() const
   return color;
 }
 
+Gdk::RGBA ColorSelection::get_current_rgba() const
+{
+  Gdk::RGBA color; //GdkRGBA is just a simple struct.
+  gtk_color_selection_get_current_rgba(const_cast<GtkColorSelection*>(gobj()), color.gobj());
+  return color;
+}
+
+Gdk::RGBA ColorSelection::get_previous_rgba() const
+{
+  Gdk::RGBA color; //GdkRGBA is just a simple struct.
+  gtk_color_selection_get_previous_rgba(const_cast<GtkColorSelection*>(gobj()), color.gobj());
+  return color;
+}
+
 // static
 Gdk::ArrayHandle_Color ColorSelection::palette_from_string(const Glib::ustring& str)
 {
diff --git a/gtk/src/colorselection.hg b/gtk/src/colorselection.hg
index b5b2482..5f19577 100644
--- a/gtk/src/colorselection.hg
+++ b/gtk/src/colorselection.hg
@@ -59,6 +59,13 @@ public:
   _WRAP_METHOD(void set_previous_alpha(guint16 alpha), gtk_color_selection_set_previous_alpha)
   Gdk::Color get_previous_color() const;
   _WRAP_METHOD(guint16 get_previous_alpha() const, gtk_color_selection_get_previous_alpha)
+  
+  
+  Gdk::RGBA get_current_rgba() const;
+  Gdk::RGBA get_previous_rgba() const;
+
+  _WRAP_METHOD(void set_current_rgba(const Gdk::RGBA& color), gtk_color_selection_set_current_rgba)  
+  _WRAP_METHOD(void set_previous_rgba(const Gdk::RGBA& color), gtk_color_selection_set_previous_rgba)    
 
   _WRAP_METHOD(bool is_adjusting() const, gtk_color_selection_is_adjusting)
 



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