]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/button.cpp
interchanged w and h in wxSplitterWindow::OnSashPositionChange (now
[wxWidgets.git] / src / gtk1 / button.cpp
index 066c92a17a5c826ec16c36254107dac71b4af92a..e74cbc83ff6bbc9459f2c84afa7b2996acbf5e17 100644 (file)
@@ -2,9 +2,8 @@
 // Name:        button.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Created:     01/02/97
-// Id:
-// Copyright:   (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Id:          $Id$
+// Copyright:   (c) 1998 Robert Roebling
 // Licence:    wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
@@ -27,11 +26,9 @@ class wxButton;
 extern bool   g_blockEventsOnDrag;
 
 //-----------------------------------------------------------------------------
-// wxButton
+// "clicked"
 //-----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
-
 static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
 {
   if (!button->HasVMT()) return;
@@ -43,6 +40,10 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *
 }
 
 //-----------------------------------------------------------------------------
+// wxButton
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
 
 wxButton::wxButton(void)
 {
@@ -71,6 +72,8 @@ bool wxButton::Create(  wxWindow *parent, wxWindowID id, const wxString &label,
     GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
 
   PostCreation();
+  
+  SetBackgroundColour( parent->GetBackgroundColour() );
 
   Show( TRUE );
 
@@ -87,17 +90,46 @@ void wxButton::SetDefault(void)
 
 void wxButton::SetLabel( const wxString &label )
 {
+  wxCHECK_RET( m_widget != NULL, "invalid button" );
+  
   wxControl::SetLabel( label );
-  GtkButton *bin = GTK_BUTTON( m_widget );
-  GtkLabel *g_label = GTK_LABEL( bin->child );
-  gtk_label_set( g_label, GetLabel() );
+  
+  gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel() );
 }
 
 void wxButton::Enable( bool enable )
 {
+  wxCHECK_RET( m_widget != NULL, "invalid button" );
+  
   wxControl::Enable( enable );
-  GtkButton *bin = GTK_BUTTON( m_widget );
-  GtkWidget *label = bin->child;
-  gtk_widget_set_sensitive( label, enable );
+  
+  gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
 }
 
+void wxButton::SetFont( const wxFont &font )
+{
+  wxCHECK_RET( m_widget != NULL, "invalid button" );
+  
+  wxControl::SetFont( font );
+  
+  gtk_widget_set_style( GTK_BUTTON(m_widget)->child, 
+    gtk_style_ref(
+      gtk_widget_get_style( m_widget ) ) );
+}
+
+void wxButton::SetBackgroundColour( const wxColour &colour )
+{
+  return;
+
+  wxCHECK_RET( m_widget != NULL, "invalid button" );
+
+  wxControl::SetBackgroundColour( colour );
+  
+  if (!m_backgroundColour.Ok()) return;
+  
+  gtk_widget_set_style( GTK_BUTTON(m_widget)->child, 
+    gtk_style_ref(
+      gtk_widget_get_style( m_widget ) ) );
+}
+
+