]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/clrpicker.cpp
correct typo in one of the last changes
[wxWidgets.git] / src / gtk / clrpicker.cpp
index f331fe779448c5030029548a8b87f107bf2e18ff..014285911154883f6d1931c9b0e0c94cd1d753ae 100644 (file)
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-#include "wx/gtk/private.h"
+#if wxUSE_COLOURPICKERCTRL
+
 #include "wx/clrpicker.h"
 
 #include "wx/clrpicker.h"
 
-#include <gdk/gdk.h>
 #include <gtk/gtk.h>
 
 #include <gtk/gtk.h>
 
-
-
 // ============================================================================
 // implementation
 // ============================================================================
 
 // ============================================================================
 // implementation
 // ============================================================================
 
-#if wxUSE_COLOURPICKERCTRL && defined(__WXGTK24__)
-
 //-----------------------------------------------------------------------------
 // "color-set"
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // "color-set"
 //-----------------------------------------------------------------------------
@@ -41,11 +37,13 @@ static void gtk_clrbutton_setcolor_callback(GtkColorButton *widget,
 {
     // update the m_colour member of the wxColourButton
     wxASSERT(p);
 {
     // update the m_colour member of the wxColourButton
     wxASSERT(p);
-    gtk_color_button_get_color(widget, p->GetGdkColor());
+    GdkColor gdkColor;
+    gtk_color_button_get_color(widget, &gdkColor);
+    p->SetGdkColor(gdkColor);
 
     // fire the colour-changed event
     wxColourPickerEvent event(p, p->GetId(), p->GetColour());
 
     // fire the colour-changed event
     wxColourPickerEvent event(p, p->GetId(), p->GetColour());
-    p->GetEventHandler()->ProcessEvent(event);
+    p->HandleWindowEvent(event);
 }
 }
 
 }
 }
 
@@ -53,7 +51,7 @@ static void gtk_clrbutton_setcolor_callback(GtkColorButton *widget,
 // wxColourButton
 //-----------------------------------------------------------------------------
 
 // wxColourButton
 //-----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxColourButton, wxGenericColourButton)
+IMPLEMENT_DYNAMIC_CLASS(wxColourButton, wxButton)
 
 bool wxColourButton::Create( wxWindow *parent, wxWindowID id,
                         const wxColour &col,
 
 bool wxColourButton::Create( wxWindow *parent, wxWindowID id,
                         const wxColour &col,
@@ -61,34 +59,28 @@ bool wxColourButton::Create( wxWindow *parent, wxWindowID id,
                         long style, const wxValidator& validator,
                         const wxString &name )
 {
                         long style, const wxValidator& validator,
                         const wxString &name )
 {
-    if (!gtk_check_version(2,4,0))
+    if (!PreCreation( parent, pos, size ) ||
+        !wxControl::CreateBase(parent, id, pos, size, style, validator, name))
     {
     {
-        m_needParent = true;
+        wxFAIL_MSG( wxT("wxColourButton creation failed") );
+        return false;
+    }
 
 
-        if (!PreCreation( parent, pos, size ) ||
-            !wxControl::CreateBase(parent, id, pos, size, style, validator, name))
-        {
-            wxFAIL_MSG( wxT("wxColourButton creation failed") );
-            return false;
-        }
+    m_colour = col;
+    m_widget = gtk_color_button_new_with_color( m_colour.GetColor() );
+    g_object_ref(m_widget);
+    gtk_widget_show(m_widget);
 
 
-        m_colour = col;
-        m_widget = gtk_color_button_new_with_color( m_colour.GetColor() );
-        gtk_widget_show( GTK_WIDGET(m_widget) );
+    // GtkColourButton signals
+    g_signal_connect(m_widget, "color-set",
+                    G_CALLBACK(gtk_clrbutton_setcolor_callback), this);
 
 
-        // GtkColourButton signals
-        g_signal_connect(m_widget, "color-set",
-                        G_CALLBACK(gtk_clrbutton_setcolor_callback), this);
 
 
+    m_parent->DoAddChild( this );
 
 
-        m_parent->DoAddChild( this );
+    PostCreation(size);
+    SetInitialSize(size);
 
 
-        PostCreation(size);
-        SetBestSize(size);
-    }
-    else
-        return wxGenericColourButton::Create(parent, id, col, pos, size,
-                                             style, validator, name);
     return true;
 }
 
     return true;
 }
 
@@ -98,10 +90,7 @@ wxColourButton::~wxColourButton()
 
 void wxColourButton::UpdateColour()
 {
 
 void wxColourButton::UpdateColour()
 {
-    if (!gtk_check_version(2,4,0))
-        gtk_color_button_set_color(GTK_COLOR_BUTTON(m_widget), m_colour.GetColor());
-    else
-        wxGenericColourButton::UpdateColour();
+    gtk_color_button_set_color(GTK_COLOR_BUTTON(m_widget), m_colour.GetColor());
 }
 
 }
 
-#endif      // wxUSE_COLOURPICKERCTRL && defined(__WXGTK24__)
+#endif // wxUSE_COLOURPICKERCTRL