ShouldInheritColours.  Set wxButton to not inherit colours.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24702 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
33 files changed:
     // on its panel
     virtual void SetDefault() { }
 
     // on its panel
     virtual void SetDefault() { }
 
+    // Buttons on MSW can look bad if they are not native colours, because
+    // then they become owner-drawn and not theme-drawn.  Disable it here
+    // in wxButtonBase to make it consistent.
+    virtual bool ShouldInheritColours() const { return false; }
+
     // returns the default button size for this platform
     static wxSize GetDefaultSize();
 
     // returns the default button size for this platform
     static wxSize GetDefaultSize();
 
 
     void ApplyWidgetStyle();
     bool IsOwnGtkWindow( GdkWindow *window );
 
     void ApplyWidgetStyle();
     bool IsOwnGtkWindow( GdkWindow *window );
 
+    // Since this wxButton doesn't derive from wxButtonBase (why?) we need
+    // to override this here too...
+    virtual bool ShouldInheritColours() const { return false; }
+    
 protected:
     virtual wxSize DoGetBestSize() const;
 
 protected:
     virtual wxSize DoGetBestSize() const;
 
 
     void ApplyWidgetStyle();
     bool IsOwnGtkWindow( GdkWindow *window );
 
     void ApplyWidgetStyle();
     bool IsOwnGtkWindow( GdkWindow *window );
 
+    // Since this wxButton doesn't derive from wxButtonBase (why?) we need
+    // to override this here too...
+    virtual bool ShouldInheritColours() const { return false; }
+    
 protected:
     virtual wxSize DoGetBestSize() const;
 
 protected:
     virtual wxSize DoGetBestSize() const;
 
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetBackgroundColour( parent->GetBackgroundColour() );
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetFont( parent->GetFont() );
 
     wxSize best_size( DoGetBestSize() );
     wxSize new_size( size );
 
     wxSize best_size( DoGetBestSize() );
     wxSize new_size( size );
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
-
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetFont( parent->GetFont() );
 
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
 
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
 
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
-
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetFont( parent->GetFont() );
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
-
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_focusWidget = combo->entry;
 
     PostCreation();
     m_focusWidget = combo->entry;
 
     PostCreation();
 
     ConnectWidget( combo->button );
 
 
     ConnectWidget( combo->button );
 
         gtk_widget_set_usize( m_widget, new_size.x, new_size.y );
     }
 
         gtk_widget_set_usize( m_widget, new_size.x, new_size.y );
     }
 
-    SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
-    SetForegroundColour( parent->GetForegroundColour() );
-
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ) );
-    SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
     if (newSize.y == -1) newSize.y = ls.y;
     SetSize( newSize.x, newSize.y );
 
     if (newSize.y == -1) newSize.y = ls.y;
     SetSize( newSize.x, newSize.y );
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
-
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_parent->DoAddChild( this );
   
     PostCreation();
     m_parent->DoAddChild( this );
   
     PostCreation();
-
-    SetFont( parent->GetFont() );
 
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
 
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
         
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
         
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
-  
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-    SetBackgroundColour( parent->GetBackgroundColour() );
-
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetBackgroundColour( parent->GetBackgroundColour() );
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetBackgroundColour( parent->GetBackgroundColour() );
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-    SetFont( parent->GetFont() );
-    
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
     if (new_size.x == -1)
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
     if (new_size.x == -1)
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
 
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
-
     SetValue( value );
 
     Show( TRUE );
     SetValue( value );
 
     Show( TRUE );
 
-    wxControl::SetFont( parent->GetFont() );
+    InheritAttributes();
+//    wxControl::SetFont( parent->GetFont() );
     
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
     
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
 
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
+//     if (ShouldInheritColours())
+//     {
+//         SetBackgroundColour( parent->GetBackgroundColour() );
+//         SetForegroundColour( parent->GetForegroundColour() );
+//     }
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_focusWidget = m_text;
 
     PostCreation();
     m_focusWidget = m_text;
 
     PostCreation();
-
-    SetFont( parent->GetFont() );
 
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
 
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
 
    m_parent->DoAddChild(this);
 
    PostCreation();
    m_parent->DoAddChild(this);
 
    PostCreation();
-
-   SetFont(parent->GetFont());
 
    wxSize size_best(DoGetBestSize());
    wxSize new_size(size);
 
    wxSize size_best(DoGetBestSize());
    wxSize new_size(size);
    if ((new_size.x != size.x) || (new_size.y != size.y))
       SetSize(new_size.x, new_size.y);
 
    if ((new_size.x != size.x) || (new_size.y != size.y))
       SetSize(new_size.x, new_size.y);
 
-   SetBackgroundColour(parent->GetBackgroundColour());
-   SetForegroundColour(parent->GetForegroundColour());
-
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetBackgroundColour( parent->GetBackgroundColour() );
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetFont( parent->GetFont() );
 
     wxSize best_size( DoGetBestSize() );
     wxSize new_size( size );
 
     wxSize best_size( DoGetBestSize() );
     wxSize new_size( size );
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
-
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetFont( parent->GetFont() );
 
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
 
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
 
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
-
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetFont( parent->GetFont() );
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
-
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_focusWidget = combo->entry;
 
     PostCreation();
     m_focusWidget = combo->entry;
 
     PostCreation();
 
     ConnectWidget( combo->button );
 
 
     ConnectWidget( combo->button );
 
         gtk_widget_set_usize( m_widget, new_size.x, new_size.y );
     }
 
         gtk_widget_set_usize( m_widget, new_size.x, new_size.y );
     }
 
-    SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
-    SetForegroundColour( parent->GetForegroundColour() );
-
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ) );
-    SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
     if (newSize.y == -1) newSize.y = ls.y;
     SetSize( newSize.x, newSize.y );
 
     if (newSize.y == -1) newSize.y = ls.y;
     SetSize( newSize.x, newSize.y );
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
-
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_parent->DoAddChild( this );
   
     PostCreation();
     m_parent->DoAddChild( this );
   
     PostCreation();
-
-    SetFont( parent->GetFont() );
 
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
 
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
         
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
         
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
-  
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-    SetBackgroundColour( parent->GetBackgroundColour() );
-
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetBackgroundColour( parent->GetBackgroundColour() );
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-
-    SetBackgroundColour( parent->GetBackgroundColour() );
 
     m_parent->DoAddChild( this );
 
     PostCreation();
     m_parent->DoAddChild( this );
 
     PostCreation();
-    SetFont( parent->GetFont() );
-    
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
     if (new_size.x == -1)
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
     if (new_size.x == -1)
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
 
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
-
     SetValue( value );
 
     Show( TRUE );
     SetValue( value );
 
     Show( TRUE );
 
-    wxControl::SetFont( parent->GetFont() );
+    InheritAttributes();
+//    wxControl::SetFont( parent->GetFont() );
     
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
     
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
 
     if ((new_size.x != size.x) || (new_size.y != size.y))
         SetSize( new_size.x, new_size.y );
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
+//     if (ShouldInheritColours())
+//     {
+//         SetBackgroundColour( parent->GetBackgroundColour() );
+//         SetForegroundColour( parent->GetForegroundColour() );
+//     }
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
 
     m_focusWidget = m_text;
 
     PostCreation();
     m_focusWidget = m_text;
 
     PostCreation();
-
-    SetFont( parent->GetFont() );
 
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
 
     wxSize size_best( DoGetBestSize() );
     wxSize new_size( size );
 
    m_parent->DoAddChild(this);
 
    PostCreation();
    m_parent->DoAddChild(this);
 
    PostCreation();
-
-   SetFont(parent->GetFont());
 
    wxSize size_best(DoGetBestSize());
    wxSize new_size(size);
 
    wxSize size_best(DoGetBestSize());
    wxSize new_size(size);
    if ((new_size.x != size.x) || (new_size.y != size.y))
       SetSize(new_size.x, new_size.y);
 
    if ((new_size.x != size.x) || (new_size.y != size.y))
       SetSize(new_size.x, new_size.y);
 
-   SetBackgroundColour(parent->GetBackgroundColour());
-   SetForegroundColour(parent->GetForegroundColour());
-