]> git.saurik.com Git - wxWidgets.git/commitdiff
New colour, font, theme and size code..
authorRobert Roebling <robert@roebling.de>
Tue, 4 Jan 2000 13:02:27 +0000 (13:02 +0000)
committerRobert Roebling <robert@roebling.de>
Tue, 4 Jan 2000 13:02:27 +0000 (13:02 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5228 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

35 files changed:
include/wx/gtk/button.h
include/wx/gtk/notebook.h
include/wx/gtk/radiobut.h
include/wx/gtk1/button.h
include/wx/gtk1/notebook.h
include/wx/gtk1/radiobut.h
src/common/wincmn.cpp
src/gtk/button.cpp
src/gtk/checkbox.cpp
src/gtk/choice.cpp
src/gtk/combobox.cpp
src/gtk/menu.cpp
src/gtk/notebook.cpp
src/gtk/radiobox.cpp
src/gtk/radiobut.cpp
src/gtk/settings.cpp
src/gtk/spinctrl.cpp
src/gtk/statbox.cpp
src/gtk/stattext.cpp
src/gtk/textctrl.cpp
src/gtk/window.cpp
src/gtk1/button.cpp
src/gtk1/checkbox.cpp
src/gtk1/choice.cpp
src/gtk1/combobox.cpp
src/gtk1/menu.cpp
src/gtk1/notebook.cpp
src/gtk1/radiobox.cpp
src/gtk1/radiobut.cpp
src/gtk1/settings.cpp
src/gtk1/spinctrl.cpp
src/gtk1/statbox.cpp
src/gtk1/stattext.cpp
src/gtk1/textctrl.cpp
src/gtk1/window.cpp

index 538720c63cb5fa553497fd09d9ea0ffe572c9419..c239f5b7a1f48b6db22e6987643277291cc7e0e8 100644 (file)
@@ -64,6 +64,9 @@ public:
   
     void ApplyWidgetStyle();    
     
   
     void ApplyWidgetStyle();    
     
+protected:
+    virtual wxSize DoGetBestSize() const;
+
 private:
     DECLARE_DYNAMIC_CLASS(wxButton)
 };
 private:
     DECLARE_DYNAMIC_CLASS(wxButton)
 };
index d8c772d7a0798068bd3f7e738af4126a682274dc..6e8a0a1f406469f917771bacefdc3f314a9f0397 100644 (file)
@@ -133,27 +133,29 @@ public:
     // overridden from wxWindow to make tabbing work  
   void SetFocus();
 
     // overridden from wxWindow to make tabbing work  
   void SetFocus();
 
-  // implementation
+    // implementation
+    // --------------
 
 
-  void SetConstraintSizes(bool recurse);
-  bool DoPhase(int phase);
-  void ApplyWidgetStyle();
+    void SetConstraintSizes(bool recurse);
+    bool DoPhase(int phase);
+    void ApplyWidgetStyle();
 
 
-  // report if window belongs to notebook  
-  bool IsOwnGtkWindow( GdkWindow *window );
+    // report if window belongs to notebook  
+    bool IsOwnGtkWindow( GdkWindow *window );
 
 
-  // common part of all ctors
-  void Init();
+    // common part of all ctors
+    void Init();
 
 
-  // helper function
-  wxNotebookPage* GetNotebookPage(int page) const;
+    // helper function
+    wxNotebookPage* GetNotebookPage(int page) const;
 
 
-  wxImageList*    m_imageList;
-  wxList          m_pages;
-  int             m_lastSelection;  /* hack */
+    wxImageList*    m_imageList;
+    wxList          m_pages;
+    int             m_lastSelection;  /* hack */
 
 
-  DECLARE_DYNAMIC_CLASS(wxNotebook)
-  DECLARE_EVENT_TABLE()
+private:
+    DECLARE_DYNAMIC_CLASS(wxNotebook)
+    DECLARE_EVENT_TABLE()
 };
 
 #endif
 };
 
 #endif
index c6717e8a6e1ef1c8d0afde344f48a47e52422a3d..9435869fee652cc031f6e847aad09bb0f43a608d 100644 (file)
@@ -70,6 +70,9 @@ public:
     bool IsOwnGtkWindow( GdkWindow *window );
     void OnInternalIdle();
     
     bool IsOwnGtkWindow( GdkWindow *window );
     void OnInternalIdle();
     
+protected:
+    virtual wxSize DoGetBestSize() const;
+
 private:
     DECLARE_DYNAMIC_CLASS(wxRadioButton)
 };
 private:
     DECLARE_DYNAMIC_CLASS(wxRadioButton)
 };
index 538720c63cb5fa553497fd09d9ea0ffe572c9419..c239f5b7a1f48b6db22e6987643277291cc7e0e8 100644 (file)
@@ -64,6 +64,9 @@ public:
   
     void ApplyWidgetStyle();    
     
   
     void ApplyWidgetStyle();    
     
+protected:
+    virtual wxSize DoGetBestSize() const;
+
 private:
     DECLARE_DYNAMIC_CLASS(wxButton)
 };
 private:
     DECLARE_DYNAMIC_CLASS(wxButton)
 };
index d8c772d7a0798068bd3f7e738af4126a682274dc..6e8a0a1f406469f917771bacefdc3f314a9f0397 100644 (file)
@@ -133,27 +133,29 @@ public:
     // overridden from wxWindow to make tabbing work  
   void SetFocus();
 
     // overridden from wxWindow to make tabbing work  
   void SetFocus();
 
-  // implementation
+    // implementation
+    // --------------
 
 
-  void SetConstraintSizes(bool recurse);
-  bool DoPhase(int phase);
-  void ApplyWidgetStyle();
+    void SetConstraintSizes(bool recurse);
+    bool DoPhase(int phase);
+    void ApplyWidgetStyle();
 
 
-  // report if window belongs to notebook  
-  bool IsOwnGtkWindow( GdkWindow *window );
+    // report if window belongs to notebook  
+    bool IsOwnGtkWindow( GdkWindow *window );
 
 
-  // common part of all ctors
-  void Init();
+    // common part of all ctors
+    void Init();
 
 
-  // helper function
-  wxNotebookPage* GetNotebookPage(int page) const;
+    // helper function
+    wxNotebookPage* GetNotebookPage(int page) const;
 
 
-  wxImageList*    m_imageList;
-  wxList          m_pages;
-  int             m_lastSelection;  /* hack */
+    wxImageList*    m_imageList;
+    wxList          m_pages;
+    int             m_lastSelection;  /* hack */
 
 
-  DECLARE_DYNAMIC_CLASS(wxNotebook)
-  DECLARE_EVENT_TABLE()
+private:
+    DECLARE_DYNAMIC_CLASS(wxNotebook)
+    DECLARE_EVENT_TABLE()
 };
 
 #endif
 };
 
 #endif
index c6717e8a6e1ef1c8d0afde344f48a47e52422a3d..9435869fee652cc031f6e847aad09bb0f43a608d 100644 (file)
@@ -70,6 +70,9 @@ public:
     bool IsOwnGtkWindow( GdkWindow *window );
     void OnInternalIdle();
     
     bool IsOwnGtkWindow( GdkWindow *window );
     void OnInternalIdle();
     
+protected:
+    virtual wxSize DoGetBestSize() const;
+
 private:
     DECLARE_DYNAMIC_CLASS(wxRadioButton)
 };
 private:
     DECLARE_DYNAMIC_CLASS(wxRadioButton)
 };
index dd3822251dc7f176f2fa8020166cb9909fb237dd..39fae1d5259e210d620e0ad014be55e61f01c71d 100644 (file)
@@ -119,7 +119,7 @@ void wxWindowBase::InitBase()
 
     m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_BTNFACE);
     m_foregroundColour = *wxBLACK;  // TODO take this from sys settings too?
 
     m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_BTNFACE);
     m_foregroundColour = *wxBLACK;  // TODO take this from sys settings too?
-#ifndef __WXMAC__
+#if !defined(__WXMAC__) && !defined(__WXGTK__)
     m_font = *wxSWISS_FONT;         //      and this?
 #else
        m_font = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
     m_font = *wxSWISS_FONT;         //      and this?
 #else
        m_font = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
index 47662e31de11a6e52ce4c0133bc41b99b6706d8b..5b16248fcd89cf06327b3dfe344d0476729cf1bd 100644 (file)
@@ -111,24 +111,6 @@ bool wxButton::Create(  wxWindow *parent, wxWindowID id, const wxString &label,
        gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
 #endif
 
        gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
 #endif
 
-    int x = 0;  int y = 0;
-    wxFont new_font( parent->GetFont() );
-    GetTextExtent( m_label, &x, &y, (int*)NULL, (int*)NULL, &new_font );
-
-    wxSize newSize = size;
-    if (newSize.x == -1)
-    {  
-        newSize.x = 12+x;
-       if (newSize.x < 80) newSize.x = 80;
-    }
-    if (newSize.y == -1)
-    {
-        newSize.y = 11+y;
-       if (newSize.y < 26) newSize.y = 26;
-    }
-       
-    SetSize( newSize.x, newSize.y );
-
     gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
       GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
 
     gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
       GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
 
@@ -136,9 +118,23 @@ bool wxButton::Create(  wxWindow *parent, wxWindowID id, const wxString &label,
   
     PostCreation();
   
   
     PostCreation();
   
+    ApplyWidgetStyle();
+
+    SetFont( parent->GetFont() );
+
+    wxSize best_size( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = best_size.x;
+    if (new_size.y == -1)
+        new_size.y = best_size.y;
+    if ((new_size.x != size.x) || (new_size.y != size.y))
+        SetSize( new_size.x, new_size.y );
+
+    SetSize( new_size );
+
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     Show( TRUE );
 
 
     Show( TRUE );
 
@@ -184,3 +180,11 @@ void wxButton::ApplyWidgetStyle()
     gtk_widget_set_style( m_widget, m_widgetStyle );
     gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
 }
     gtk_widget_set_style( m_widget, m_widgetStyle );
     gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
 }
+
+wxSize wxButton::DoGetBestSize() const
+{
+    wxSize ret( wxControl::DoGetBestSize() );
+    if (ret.x < 80) ret.x = 80;
+    return ret;
+}
+
index 5d638cd07c17a69772953c5a69bf682717303b2a..051e51b500bd5a4442741a9d09d55bf072740d3c 100644 (file)
@@ -106,8 +106,6 @@ bool wxCheckBox::Create(wxWindow *parent,
         m_widget = m_widgetCheckbox;
     }
 
         m_widget = m_widgetCheckbox;
     }
 
-    SetSizeOrDefault( size );
-
     gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
                         "clicked",
                         GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
     gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
                         "clicked",
                         GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
@@ -117,9 +115,21 @@ bool wxCheckBox::Create(wxWindow *parent,
 
     PostCreation();
 
 
     PostCreation();
 
+    ApplyWidgetStyle();
+
+    SetFont( parent->GetFont() );
+
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = size_best.x;
+    if (new_size.y == -1)
+        new_size.y = size_best.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() );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     Show( TRUE );
 
 
     Show( TRUE );
 
@@ -203,8 +213,7 @@ void wxCheckBox::OnInternalIdle()
 
 wxSize wxCheckBox::DoGetBestSize() const
 {
 
 wxSize wxCheckBox::DoGetBestSize() const
 {
-    return wxSize( 25 + gdk_string_measure( m_widgetCheckbox->style->font,
-                                            m_label.mbc_str() ), 26 );
+    return wxControl::DoGetBestSize();
 }
 
 #endif
 }
 
 #endif
index 97ea9be8b97dac3b73093aaa476d2a9ebcaacea8..dda0c63e8ffca99b76af48a0944e6b45e580f5d5 100644 (file)
@@ -90,8 +90,6 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
 
     m_widget = gtk_option_menu_new();
 
 
     m_widget = gtk_option_menu_new();
 
-    SetSizeOrDefault( size );
-
     if ( style & wxCB_SORT )
     {
         // if our m_strings != NULL, DoAppend() will check for it and insert
     if ( style & wxCB_SORT )
     {
         // if our m_strings != NULL, DoAppend() will check for it and insert
@@ -112,9 +110,21 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
 
     PostCreation();
 
 
     PostCreation();
 
+    ApplyWidgetStyle();
+
+    SetFont( parent->GetFont() );
+
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = size_best.x;
+    if (new_size.y == -1)
+        new_size.y = size_best.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() );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     Show( TRUE );
 
 
     Show( TRUE );
 
@@ -396,7 +406,10 @@ size_t wxChoice::GtkAppendHelper(GtkWidget *menu, const wxString& item)
 
 wxSize wxChoice::DoGetBestSize() const
 {
 
 wxSize wxChoice::DoGetBestSize() const
 {
-    return wxSize(80, 26);
+    wxSize ret( wxControl::DoGetBestSize() );
+    if (ret.x < 80) ret.x = 80;
+    ret.y = 16 + gdk_char_height( m_widget->style->font, 'H' );
+    return ret;
 }
 
 #endif
 }
 
 #endif
index 0571f48fe4a20fad2ff53a4c456d706c217a0829..eb10d33e389b6f080019d2a9364a17f4f2553262 100644 (file)
@@ -101,17 +101,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     m_needParent = TRUE;
     m_acceptsFocus = TRUE;
 
     m_needParent = TRUE;
     m_acceptsFocus = TRUE;
 
-    wxSize newSize = size,
-           bestSize = DoGetBestSize();
-
-    if (newSize.x == -1)
-        newSize.x = bestSize.x;
-    if (newSize.y == -1)
-        newSize.y = bestSize.y;
-    if (newSize.y > 22)
-        newSize.y = 22;
-
-    if (!PreCreation( parent, pos, newSize ) ||
+    if (!PreCreation( parent, pos, size ) ||
         !CreateBase( parent, id, pos, size, style, validator, name ))
     {
         wxFAIL_MSG( wxT("wxComboBox creation failed") );
         !CreateBase( parent, id, pos, size, style, validator, name ))
     {
         wxFAIL_MSG( wxT("wxComboBox creation failed") );
@@ -148,6 +138,8 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
 
     PostCreation();
 
 
     PostCreation();
 
+    ApplyWidgetStyle();
+
     ConnectWidget( GTK_COMBO(m_widget)->button );
 
     if (!value.IsNull()) SetValue( value );
     ConnectWidget( GTK_COMBO(m_widget)->button );
 
     if (!value.IsNull()) SetValue( value );
@@ -158,9 +150,19 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
       GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 
     gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
       GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = size_best.x;
+    if (new_size.y == -1)
+        new_size.y = size_best.y;
+    if (new_size.y > size_best.y)
+        new_size.y = size_best.y;
+    if ((new_size.x != size.x) || (new_size.y != size.y))
+        SetSize( new_size.x, new_size.y );
+
     SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
     SetForegroundColour( parent->GetForegroundColour() );
     SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     Show( TRUE );
 
 
     Show( TRUE );
 
@@ -665,8 +667,9 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
 
 wxSize wxComboBox::DoGetBestSize() const
 {
 
 wxSize wxComboBox::DoGetBestSize() const
 {
-    // totally bogus - should measure the strings in the combo!
-    return wxSize(100, 22);
+    wxSize ret( wxControl::DoGetBestSize() );
+    if (ret.x < 100) ret.x = 100;
+    return ret;
 }
 
 #endif
 }
 
 #endif
index 094b02165a437dc68fee78413ecabe395aaad247..6758d6b4ba702dd5ceb791e75a43d4e42ffad82b 100644 (file)
@@ -78,6 +78,8 @@ wxMenuBar::wxMenuBar( long style )
     }
 
     PostCreation();
     }
 
     PostCreation();
+    
+    ApplyWidgetStyle();
 }
 
 wxMenuBar::wxMenuBar()
 }
 
 wxMenuBar::wxMenuBar()
@@ -108,6 +110,8 @@ wxMenuBar::wxMenuBar()
     m_widget = GTK_WIDGET(m_menubar);
 
     PostCreation();
     m_widget = GTK_WIDGET(m_menubar);
 
     PostCreation();
+    
+    ApplyWidgetStyle();
 }
 
 wxMenuBar::~wxMenuBar()
 }
 
 wxMenuBar::~wxMenuBar()
index ead39366057960784084b2a86567dcf192ddbb36..942914458cda33f0c0461bdfe6b5c7b35d6ab835 100644 (file)
@@ -213,7 +213,7 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
     {
         wxFAIL_MSG( wxT("wxNoteBook creation failed") );
         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
     {
         wxFAIL_MSG( wxT("wxNoteBook creation failed") );
-       return FALSE;
+           return FALSE;
     }
 
 
     }
 
 
@@ -230,15 +230,17 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
 
     m_parent->DoAddChild( this );
 
 
     m_parent->DoAddChild( this );
 
-       if(m_windowStyle & wxNB_RIGHT)
+       if (m_windowStyle & wxNB_RIGHT)
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
-       if(m_windowStyle & wxNB_LEFT)
+       if (m_windowStyle & wxNB_LEFT)
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
-       if(m_windowStyle & wxNB_BOTTOM)
+       if (m_windowStyle & wxNB_BOTTOM)
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
 
     PostCreation();
 
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
 
     PostCreation();
 
+    SetFont( parent->GetFont() );
+
     gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
                             GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
 
     gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
                             GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
 
@@ -625,6 +627,8 @@ bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
 
 void wxNotebook::ApplyWidgetStyle()
 {
 
 void wxNotebook::ApplyWidgetStyle()
 {
+    // TODO, font for labels etc
+    
     SetWidgetStyle();
     gtk_widget_set_style( m_widget, m_widgetStyle );
 }
     SetWidgetStyle();
     gtk_widget_set_style( m_widget, m_widgetStyle );
 }
index 6dda8dc6c4ff0eef59272fc33567036ab672a29a..2afc3aec550c2380e0e38eabb292e9a85a1ea86c 100644 (file)
@@ -180,6 +180,16 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
                          m_x+10, m_y+10+(i*24), 10, 10 );
     }
 
                          m_x+10, m_y+10+(i*24), 10, 10 );
     }
 
+    m_parent->DoAddChild( this );
+
+    PostCreation();
+
+    ApplyWidgetStyle();
+
+    SetLabel( title );
+
+    SetFont( parent->GetFont() );
+
     wxSize ls = LayoutItems();
 
     wxSize newSize = size;
     wxSize ls = LayoutItems();
 
     wxSize newSize = size;
@@ -187,15 +197,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
     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 );
 
-    m_parent->DoAddChild( this );
-
-    PostCreation();
-
-    SetLabel( title );
-
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     Show( TRUE );
 
 
     Show( TRUE );
 
index 5f58c9331e11384351a3e3631e920ec9e2868780..830c410d4f53a910a3b7e31065d5ec9359ccb780 100644 (file)
@@ -84,36 +84,31 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
         wxRadioButton *chief = (wxRadioButton*) NULL;
         wxWindowList::Node *node = parent->GetChildren().GetLast();
         while (node)
         wxRadioButton *chief = (wxRadioButton*) NULL;
         wxWindowList::Node *node = parent->GetChildren().GetLast();
         while (node)
-       {
-           wxWindow *child = node->GetData();
-           if (child->m_isRadioButton)
            {
            {
-                chief = (wxRadioButton*) child;
-                if (child->HasFlag(wxRB_GROUP)) break;
-           }
-           node = node->GetPrevious();
+               wxWindow *child = node->GetData();
+               if (child->m_isRadioButton)
+               {
+                   chief = (wxRadioButton*) child;
+                       if (child->HasFlag(wxRB_GROUP)) break;
+               }
+               node = node->GetPrevious();
         }
         }
-       if (chief)
-       {
+           if (chief)
+           {
             /* we are part of the group started by chief */
             /* we are part of the group started by chief */
-           m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
-       }
-       else
-       {
+               m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
+           }
+           else
+           {
             /* start a new group */
             m_radioButtonGroup = (GSList*) NULL;
             /* start a new group */
             m_radioButtonGroup = (GSList*) NULL;
-       }
+           }
     }
 
     m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
       
     SetLabel(label);
 
     }
 
     m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
       
     SetLabel(label);
 
-    wxSize newSize = size;
-    if (newSize.x == -1) newSize.x = 22+gdk_string_measure( m_widget->style->font, label.mbc_str() );
-    if (newSize.y == -1) newSize.y = 26;
-    SetSize( newSize.x, newSize.y );
-
     gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", 
       GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
        
     gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", 
       GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
        
@@ -121,9 +116,21 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
   
     PostCreation();
 
   
     PostCreation();
 
+    ApplyWidgetStyle();
+
+    SetFont( parent->GetFont() );
+
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = size_best.x;
+    if (new_size.y == -1)
+        new_size.y = size_best.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() );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
   
     Show( TRUE );
 
   
     Show( TRUE );
 
@@ -204,10 +211,15 @@ void wxRadioButton::OnInternalIdle()
           windows above so that checking for the current cursor is
           not possible. */
           
           windows above so that checking for the current cursor is
           not possible. */
           
-       gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widget)->event_window, cursor.GetCursor() );
+          gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widget)->event_window, cursor.GetCursor() );
     }
 
     UpdateWindowUI();
 }
 
     }
 
     UpdateWindowUI();
 }
 
+wxSize wxRadioButton::DoGetBestSize() const
+{
+    return wxControl::DoGetBestSize();
+}
+
 #endif
 #endif
index 99894b71a27510b7b8b7f9c7106d20fc62f92e63..2fde66188cf401d320ed446f8462948e4c4e51e8 100644 (file)
@@ -76,65 +76,78 @@ void wxSystemSettings::Done()
 
 wxColour wxSystemSettings::GetSystemColour( int index )
 {
 
 wxColour wxSystemSettings::GetSystemColour( int index )
 {
-  switch (index)
-  {
-    case wxSYS_COLOUR_SCROLLBAR:
-    case wxSYS_COLOUR_BACKGROUND:
-    case wxSYS_COLOUR_ACTIVECAPTION:
-    case wxSYS_COLOUR_INACTIVECAPTION:
-    case wxSYS_COLOUR_MENU:
-    case wxSYS_COLOUR_WINDOWFRAME:
-    case wxSYS_COLOUR_ACTIVEBORDER:
-    case wxSYS_COLOUR_INACTIVEBORDER:
-    case wxSYS_COLOUR_BTNFACE:
-    {
-      if (!g_systemBtnFaceColour)
-      {
-        g_systemBtnFaceColour = 
-         new wxColour( 0xd6d6 >> SHIFT,
-                       0xd6d6 >> SHIFT,
-                       0xd6d6 >> SHIFT );
-      }
-      return *g_systemBtnFaceColour;
-    }
-    case wxSYS_COLOUR_WINDOW:
-    {
-      return *wxWHITE;
-    }
-    case wxSYS_COLOUR_GRAYTEXT:
-    case wxSYS_COLOUR_BTNSHADOW:
-    {
-      if (!g_systemBtnShadowColour)
-      {
-        g_systemBtnShadowColour = 
-         new wxColour( 0x7530 >> SHIFT,
-                       0x7530 >> SHIFT,
-                       0x7530 >> SHIFT );
-      }
-      return *g_systemBtnShadowColour;
-    }
-    case wxSYS_COLOUR_BTNHIGHLIGHT:
-    {
-      if (!g_systemBtnHighlightColour)
-      {
-        g_systemBtnHighlightColour = 
-         new wxColour( 0xea60 >> SHIFT,
-                       0xea60 >> SHIFT,
-                       0xea60 >> SHIFT );
-      }
-      return *g_systemBtnHighlightColour;
-    }
-    case wxSYS_COLOUR_HIGHLIGHT:
+    switch (index)
     {
     {
-      if (!g_systemHighlightColour)
-      {
-        g_systemHighlightColour = 
-         new wxColour( 0      >> SHIFT,
-                       0      >> SHIFT,
-                       0x9c40 >> SHIFT );
-      }
-      return *g_systemHighlightColour;
-    }
+        case wxSYS_COLOUR_SCROLLBAR:
+        case wxSYS_COLOUR_BACKGROUND:
+        case wxSYS_COLOUR_ACTIVECAPTION:
+        case wxSYS_COLOUR_INACTIVECAPTION:
+        case wxSYS_COLOUR_MENU:
+        case wxSYS_COLOUR_WINDOWFRAME:
+        case wxSYS_COLOUR_ACTIVEBORDER:
+        case wxSYS_COLOUR_INACTIVEBORDER:
+        case wxSYS_COLOUR_BTNFACE:
+        {
+            if (!g_systemBtnFaceColour)
+            {
+                g_systemBtnFaceColour = 
+                       new wxColour( 0xd6d6 >> SHIFT,
+                                     0xd6d6 >> SHIFT,
+                                             0xd6d6 >> SHIFT );
+            }
+            return *g_systemBtnFaceColour;
+        }
+        case wxSYS_COLOUR_WINDOW:
+        {
+            return *wxWHITE;
+        }
+        case wxSYS_COLOUR_GRAYTEXT:
+        case wxSYS_COLOUR_BTNSHADOW:
+        {
+            if (!g_systemBtnShadowColour)
+            {
+                g_systemBtnShadowColour = 
+                       new wxColour( 0x7530 >> SHIFT,
+                                     0x7530 >> SHIFT,
+                                             0x7530 >> SHIFT );
+            }
+            return *g_systemBtnShadowColour;
+        }
+        case wxSYS_COLOUR_BTNHIGHLIGHT:
+        {
+            if (!g_systemBtnHighlightColour)
+            {
+                g_systemBtnHighlightColour = 
+                       new wxColour( 0xea60 >> SHIFT,
+                                     0xea60 >> SHIFT,
+                                             0xea60 >> SHIFT );
+            }
+            return *g_systemBtnHighlightColour;
+        }
+        case wxSYS_COLOUR_HIGHLIGHT:
+        {
+            if (!g_systemHighlightColour)
+            {
+/*
+                g_systemHighlightColour = 
+                       new wxColour( 0      >> SHIFT,
+                                     0      >> SHIFT,
+                                             0x9c40 >> SHIFT );
+*/              
+                GtkWidget *widget = gtk_button_new();
+                GtkStyle *def = gtk_rc_get_style( widget );
+                int red = def->bg[GTK_STATE_SELECTED].red;
+                int green = def->bg[GTK_STATE_SELECTED].green;
+                int blue = def->bg[GTK_STATE_SELECTED].blue;
+                gtk_widget_destroy( widget );
+
+                g_systemHighlightColour = 
+                       new wxColour( red    >> SHIFT,
+                                     green  >> SHIFT,
+                                             blue   >> SHIFT );
+            }
+            return *g_systemHighlightColour;
+        }
     case wxSYS_COLOUR_MENUTEXT:
     case wxSYS_COLOUR_WINDOWTEXT:
     case wxSYS_COLOUR_CAPTIONTEXT:
     case wxSYS_COLOUR_MENUTEXT:
     case wxSYS_COLOUR_WINDOWTEXT:
     case wxSYS_COLOUR_CAPTIONTEXT:
@@ -173,7 +186,7 @@ wxFont wxSystemSettings::GetSystemFont( int index )
         case wxSYS_DEFAULT_GUI_FONT:
         {
             if (!g_systemFont)
         case wxSYS_DEFAULT_GUI_FONT:
         {
             if (!g_systemFont)
-                g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
+                g_systemFont = new wxFont( 16, wxSWISS, wxNORMAL, wxNORMAL );
             return *g_systemFont;
         }
     }
             return *g_systemFont;
         }
     }
index 230914ab946ff1245de1030fa924b3bcafc9733e..9e51422831dd85d04c741b0666d345ea896a85e9 100644 (file)
@@ -88,24 +88,28 @@ bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id,
 
     m_widget = gtk_spin_button_new( m_adjust, 1, 0 );
     
 
     m_widget = gtk_spin_button_new( m_adjust, 1, 0 );
     
-    wxSize new_size = size,
-           sizeBest = DoGetBestSize();
-    if (new_size.x == -1)
-        new_size.x = sizeBest.x;
-    if (new_size.y == -1)
-        new_size.y = sizeBest.y;
-
-    if ((new_size.x != size.x) || (new_size.y != size.y))
-        SetSize( new_size.x, new_size.y );
-
     gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
                               (int)(m_windowStyle & wxSP_WRAP) );
 
     GtkEnableEvents();
     gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
                               (int)(m_windowStyle & wxSP_WRAP) );
 
     GtkEnableEvents();
+    
     m_parent->DoAddChild( this );
 
     PostCreation();
 
     m_parent->DoAddChild( this );
 
     PostCreation();
 
+    ApplyWidgetStyle();
+
+    SetFont( parent->GetFont() );
+    
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = size_best.x;
+    if (new_size.y == -1)
+        new_size.y = size_best.y;
+    if ((new_size.x != size.x) || (new_size.y != size.y))
+        SetSize( new_size.x, new_size.y );
+
     SetBackgroundColour( parent->GetBackgroundColour() );
 
     SetValue( value );
     SetBackgroundColour( parent->GetBackgroundColour() );
 
     SetValue( value );
index b7697b9ce702068a45cf3ed87e1ee3ef500adf18..eb53692cfc08b576c5dc5e277d2cde3be63d63df 100644 (file)
@@ -45,7 +45,7 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
     {
         wxFAIL_MSG( wxT("wxStaticBox creation failed") );
         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
     {
         wxFAIL_MSG( wxT("wxStaticBox creation failed") );
-       return FALSE;
+           return FALSE;
     }
 
     m_isStaticBox = TRUE;
     }
 
     m_isStaticBox = TRUE;
@@ -61,9 +61,13 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
 
     SetLabel(label);
   
 
     SetLabel(label);
   
+    ApplyWidgetStyle();
+
+    SetFont( parent->GetFont() );
+    
+
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     Show( TRUE );
 
 
     Show( TRUE );
 
index 8136ac250c42b2fcc96ad48c3ffc59373f7a82b5..54d7366a4f4f360500edd220f2de037225edcd96 100644 (file)
@@ -62,8 +62,6 @@ bool wxStaticText::Create(wxWindow *parent,
     wxControl::SetLabel(label);
     m_widget = gtk_label_new( m_label.mbc_str() );
     
     wxControl::SetLabel(label);
     m_widget = gtk_label_new( m_label.mbc_str() );
     
-    wxControl::SetFont( parent->GetFont() );
-
     GtkJustification justify;
     if ( style & wxALIGN_CENTER )
       justify = GTK_JUSTIFY_CENTER;
     GtkJustification justify;
     if ( style & wxALIGN_CENTER )
       justify = GTK_JUSTIFY_CENTER;
@@ -80,12 +78,23 @@ bool wxStaticText::Create(wxWindow *parent,
     // do not move this call elsewhere
     gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE );
 
     // do not move this call elsewhere
     gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE );
 
-    SetSizeOrDefault( size );
-
     m_parent->DoAddChild( this );
 
     PostCreation();
 
     m_parent->DoAddChild( this );
 
     PostCreation();
 
+    ApplyWidgetStyle();
+
+    wxControl::SetFont( parent->GetFont() );
+    
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = size_best.x;
+    if (new_size.y == -1)
+        new_size.y = size_best.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 );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
     Show( TRUE );
index e832dcdf05704efc246545ba426a6e515d07878c..ddd7432d18896c8ada5671d70251eefd6a393e73 100644 (file)
@@ -192,20 +192,21 @@ bool wxTextCtrl::Create( wxWindow *parent,
           m_text = gtk_entry_new();
     }
 
           m_text = gtk_entry_new();
     }
 
-    wxSize new_size = size,
-           sizeBest = DoGetBestSize();
+    m_parent->DoAddChild( this );
+
+    PostCreation();
+
+    SetFont( parent->GetFont() );
+
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
     if (new_size.x == -1)
     if (new_size.x == -1)
-        new_size.x = sizeBest.x;
+        new_size.x = size_best.x;
     if (new_size.y == -1)
     if (new_size.y == -1)
-        new_size.y = sizeBest.y;
-
+        new_size.y = size_best.y;
     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 );
 
-    m_parent->DoAddChild( this );
-
-    PostCreation();
-
     if (multi_line)
         gtk_widget_show(m_text);
 
     if (multi_line)
         gtk_widget_show(m_text);
 
index a1484b14894b140a4aaaa86e26242d6009dcbc05..6c749174f259c6d5935ec49ba2399235f48ecc5d 100644 (file)
@@ -1634,9 +1634,6 @@ gtk_window_realized_callback( GtkWidget *WXUNUSED(m_widget), wxWindow *win )
     if (g_isIdle)
         wxapp_install_idle_handler();
 
     if (g_isIdle)
         wxapp_install_idle_handler();
 
-    if (win->m_delayedFont)
-        win->SetFont( win->GetFont() );
-
     if (win->m_delayedBackgroundColour)
         win->SetBackgroundColour( win->GetBackgroundColour() );
 
     if (win->m_delayedBackgroundColour)
         win->SetBackgroundColour( win->GetBackgroundColour() );
 
@@ -2025,6 +2022,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
 
     PostCreation();
 
 
     PostCreation();
 
+    ApplyWidgetStyle();
+
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
@@ -2963,7 +2962,7 @@ GtkStyle *wxWindow::GetWidgetStyle()
 {
     if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
 
 {
     if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
 
-    m_widgetStyle = gtk_style_copy( gtk_widget_get_style( m_widget ) );
+    m_widgetStyle = gtk_style_copy( gtk_rc_get_style( m_widget ) );
 
     return m_widgetStyle;
 }
 
     return m_widgetStyle;
 }
@@ -2972,28 +2971,37 @@ void wxWindow::SetWidgetStyle()
 {
     GtkStyle *style = GetWidgetStyle();
 
 {
     GtkStyle *style = GetWidgetStyle();
 
-    gdk_font_unref( style->font );
-    style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+    if (m_font != wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT ))
+    {
+        gdk_font_unref( style->font );
+        style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+    }
 
     if (m_foregroundColour.Ok())
     {
         m_foregroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
 
     if (m_foregroundColour.Ok())
     {
         m_foregroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
-        style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor();
-        style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
-        style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
+        if (m_foregroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT))
+        {
+            style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor();
+            style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
+            style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
+        }
     }
 
     if (m_backgroundColour.Ok())
     {
         m_backgroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
     }
 
     if (m_backgroundColour.Ok())
     {
         m_backgroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
-        style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
-        style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
-        style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
-        style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
-        style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
-        style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
-        style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
-        style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
+        if (m_backgroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE))
+        {
+            style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+            style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+            style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
+            style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
+            style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
+            style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
+            style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
+            style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
+       }
     }
 }
 
     }
 }
 
index 47662e31de11a6e52ce4c0133bc41b99b6706d8b..5b16248fcd89cf06327b3dfe344d0476729cf1bd 100644 (file)
@@ -111,24 +111,6 @@ bool wxButton::Create(  wxWindow *parent, wxWindowID id, const wxString &label,
        gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
 #endif
 
        gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
 #endif
 
-    int x = 0;  int y = 0;
-    wxFont new_font( parent->GetFont() );
-    GetTextExtent( m_label, &x, &y, (int*)NULL, (int*)NULL, &new_font );
-
-    wxSize newSize = size;
-    if (newSize.x == -1)
-    {  
-        newSize.x = 12+x;
-       if (newSize.x < 80) newSize.x = 80;
-    }
-    if (newSize.y == -1)
-    {
-        newSize.y = 11+y;
-       if (newSize.y < 26) newSize.y = 26;
-    }
-       
-    SetSize( newSize.x, newSize.y );
-
     gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
       GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
 
     gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
       GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
 
@@ -136,9 +118,23 @@ bool wxButton::Create(  wxWindow *parent, wxWindowID id, const wxString &label,
   
     PostCreation();
   
   
     PostCreation();
   
+    ApplyWidgetStyle();
+
+    SetFont( parent->GetFont() );
+
+    wxSize best_size( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = best_size.x;
+    if (new_size.y == -1)
+        new_size.y = best_size.y;
+    if ((new_size.x != size.x) || (new_size.y != size.y))
+        SetSize( new_size.x, new_size.y );
+
+    SetSize( new_size );
+
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     Show( TRUE );
 
 
     Show( TRUE );
 
@@ -184,3 +180,11 @@ void wxButton::ApplyWidgetStyle()
     gtk_widget_set_style( m_widget, m_widgetStyle );
     gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
 }
     gtk_widget_set_style( m_widget, m_widgetStyle );
     gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
 }
+
+wxSize wxButton::DoGetBestSize() const
+{
+    wxSize ret( wxControl::DoGetBestSize() );
+    if (ret.x < 80) ret.x = 80;
+    return ret;
+}
+
index 5d638cd07c17a69772953c5a69bf682717303b2a..051e51b500bd5a4442741a9d09d55bf072740d3c 100644 (file)
@@ -106,8 +106,6 @@ bool wxCheckBox::Create(wxWindow *parent,
         m_widget = m_widgetCheckbox;
     }
 
         m_widget = m_widgetCheckbox;
     }
 
-    SetSizeOrDefault( size );
-
     gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
                         "clicked",
                         GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
     gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
                         "clicked",
                         GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
@@ -117,9 +115,21 @@ bool wxCheckBox::Create(wxWindow *parent,
 
     PostCreation();
 
 
     PostCreation();
 
+    ApplyWidgetStyle();
+
+    SetFont( parent->GetFont() );
+
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = size_best.x;
+    if (new_size.y == -1)
+        new_size.y = size_best.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() );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     Show( TRUE );
 
 
     Show( TRUE );
 
@@ -203,8 +213,7 @@ void wxCheckBox::OnInternalIdle()
 
 wxSize wxCheckBox::DoGetBestSize() const
 {
 
 wxSize wxCheckBox::DoGetBestSize() const
 {
-    return wxSize( 25 + gdk_string_measure( m_widgetCheckbox->style->font,
-                                            m_label.mbc_str() ), 26 );
+    return wxControl::DoGetBestSize();
 }
 
 #endif
 }
 
 #endif
index 97ea9be8b97dac3b73093aaa476d2a9ebcaacea8..dda0c63e8ffca99b76af48a0944e6b45e580f5d5 100644 (file)
@@ -90,8 +90,6 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
 
     m_widget = gtk_option_menu_new();
 
 
     m_widget = gtk_option_menu_new();
 
-    SetSizeOrDefault( size );
-
     if ( style & wxCB_SORT )
     {
         // if our m_strings != NULL, DoAppend() will check for it and insert
     if ( style & wxCB_SORT )
     {
         // if our m_strings != NULL, DoAppend() will check for it and insert
@@ -112,9 +110,21 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
 
     PostCreation();
 
 
     PostCreation();
 
+    ApplyWidgetStyle();
+
+    SetFont( parent->GetFont() );
+
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = size_best.x;
+    if (new_size.y == -1)
+        new_size.y = size_best.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() );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     Show( TRUE );
 
 
     Show( TRUE );
 
@@ -396,7 +406,10 @@ size_t wxChoice::GtkAppendHelper(GtkWidget *menu, const wxString& item)
 
 wxSize wxChoice::DoGetBestSize() const
 {
 
 wxSize wxChoice::DoGetBestSize() const
 {
-    return wxSize(80, 26);
+    wxSize ret( wxControl::DoGetBestSize() );
+    if (ret.x < 80) ret.x = 80;
+    ret.y = 16 + gdk_char_height( m_widget->style->font, 'H' );
+    return ret;
 }
 
 #endif
 }
 
 #endif
index 0571f48fe4a20fad2ff53a4c456d706c217a0829..eb10d33e389b6f080019d2a9364a17f4f2553262 100644 (file)
@@ -101,17 +101,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     m_needParent = TRUE;
     m_acceptsFocus = TRUE;
 
     m_needParent = TRUE;
     m_acceptsFocus = TRUE;
 
-    wxSize newSize = size,
-           bestSize = DoGetBestSize();
-
-    if (newSize.x == -1)
-        newSize.x = bestSize.x;
-    if (newSize.y == -1)
-        newSize.y = bestSize.y;
-    if (newSize.y > 22)
-        newSize.y = 22;
-
-    if (!PreCreation( parent, pos, newSize ) ||
+    if (!PreCreation( parent, pos, size ) ||
         !CreateBase( parent, id, pos, size, style, validator, name ))
     {
         wxFAIL_MSG( wxT("wxComboBox creation failed") );
         !CreateBase( parent, id, pos, size, style, validator, name ))
     {
         wxFAIL_MSG( wxT("wxComboBox creation failed") );
@@ -148,6 +138,8 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
 
     PostCreation();
 
 
     PostCreation();
 
+    ApplyWidgetStyle();
+
     ConnectWidget( GTK_COMBO(m_widget)->button );
 
     if (!value.IsNull()) SetValue( value );
     ConnectWidget( GTK_COMBO(m_widget)->button );
 
     if (!value.IsNull()) SetValue( value );
@@ -158,9 +150,19 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
       GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 
     gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
       GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = size_best.x;
+    if (new_size.y == -1)
+        new_size.y = size_best.y;
+    if (new_size.y > size_best.y)
+        new_size.y = size_best.y;
+    if ((new_size.x != size.x) || (new_size.y != size.y))
+        SetSize( new_size.x, new_size.y );
+
     SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
     SetForegroundColour( parent->GetForegroundColour() );
     SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     Show( TRUE );
 
 
     Show( TRUE );
 
@@ -665,8 +667,9 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
 
 wxSize wxComboBox::DoGetBestSize() const
 {
 
 wxSize wxComboBox::DoGetBestSize() const
 {
-    // totally bogus - should measure the strings in the combo!
-    return wxSize(100, 22);
+    wxSize ret( wxControl::DoGetBestSize() );
+    if (ret.x < 100) ret.x = 100;
+    return ret;
 }
 
 #endif
 }
 
 #endif
index 094b02165a437dc68fee78413ecabe395aaad247..6758d6b4ba702dd5ceb791e75a43d4e42ffad82b 100644 (file)
@@ -78,6 +78,8 @@ wxMenuBar::wxMenuBar( long style )
     }
 
     PostCreation();
     }
 
     PostCreation();
+    
+    ApplyWidgetStyle();
 }
 
 wxMenuBar::wxMenuBar()
 }
 
 wxMenuBar::wxMenuBar()
@@ -108,6 +110,8 @@ wxMenuBar::wxMenuBar()
     m_widget = GTK_WIDGET(m_menubar);
 
     PostCreation();
     m_widget = GTK_WIDGET(m_menubar);
 
     PostCreation();
+    
+    ApplyWidgetStyle();
 }
 
 wxMenuBar::~wxMenuBar()
 }
 
 wxMenuBar::~wxMenuBar()
index ead39366057960784084b2a86567dcf192ddbb36..942914458cda33f0c0461bdfe6b5c7b35d6ab835 100644 (file)
@@ -213,7 +213,7 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
     {
         wxFAIL_MSG( wxT("wxNoteBook creation failed") );
         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
     {
         wxFAIL_MSG( wxT("wxNoteBook creation failed") );
-       return FALSE;
+           return FALSE;
     }
 
 
     }
 
 
@@ -230,15 +230,17 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
 
     m_parent->DoAddChild( this );
 
 
     m_parent->DoAddChild( this );
 
-       if(m_windowStyle & wxNB_RIGHT)
+       if (m_windowStyle & wxNB_RIGHT)
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
-       if(m_windowStyle & wxNB_LEFT)
+       if (m_windowStyle & wxNB_LEFT)
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
-       if(m_windowStyle & wxNB_BOTTOM)
+       if (m_windowStyle & wxNB_BOTTOM)
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
 
     PostCreation();
 
                gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
 
     PostCreation();
 
+    SetFont( parent->GetFont() );
+
     gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
                             GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
 
     gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
                             GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
 
@@ -625,6 +627,8 @@ bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
 
 void wxNotebook::ApplyWidgetStyle()
 {
 
 void wxNotebook::ApplyWidgetStyle()
 {
+    // TODO, font for labels etc
+    
     SetWidgetStyle();
     gtk_widget_set_style( m_widget, m_widgetStyle );
 }
     SetWidgetStyle();
     gtk_widget_set_style( m_widget, m_widgetStyle );
 }
index 6dda8dc6c4ff0eef59272fc33567036ab672a29a..2afc3aec550c2380e0e38eabb292e9a85a1ea86c 100644 (file)
@@ -180,6 +180,16 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
                          m_x+10, m_y+10+(i*24), 10, 10 );
     }
 
                          m_x+10, m_y+10+(i*24), 10, 10 );
     }
 
+    m_parent->DoAddChild( this );
+
+    PostCreation();
+
+    ApplyWidgetStyle();
+
+    SetLabel( title );
+
+    SetFont( parent->GetFont() );
+
     wxSize ls = LayoutItems();
 
     wxSize newSize = size;
     wxSize ls = LayoutItems();
 
     wxSize newSize = size;
@@ -187,15 +197,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
     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 );
 
-    m_parent->DoAddChild( this );
-
-    PostCreation();
-
-    SetLabel( title );
-
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     Show( TRUE );
 
 
     Show( TRUE );
 
index 5f58c9331e11384351a3e3631e920ec9e2868780..830c410d4f53a910a3b7e31065d5ec9359ccb780 100644 (file)
@@ -84,36 +84,31 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
         wxRadioButton *chief = (wxRadioButton*) NULL;
         wxWindowList::Node *node = parent->GetChildren().GetLast();
         while (node)
         wxRadioButton *chief = (wxRadioButton*) NULL;
         wxWindowList::Node *node = parent->GetChildren().GetLast();
         while (node)
-       {
-           wxWindow *child = node->GetData();
-           if (child->m_isRadioButton)
            {
            {
-                chief = (wxRadioButton*) child;
-                if (child->HasFlag(wxRB_GROUP)) break;
-           }
-           node = node->GetPrevious();
+               wxWindow *child = node->GetData();
+               if (child->m_isRadioButton)
+               {
+                   chief = (wxRadioButton*) child;
+                       if (child->HasFlag(wxRB_GROUP)) break;
+               }
+               node = node->GetPrevious();
         }
         }
-       if (chief)
-       {
+           if (chief)
+           {
             /* we are part of the group started by chief */
             /* we are part of the group started by chief */
-           m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
-       }
-       else
-       {
+               m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
+           }
+           else
+           {
             /* start a new group */
             m_radioButtonGroup = (GSList*) NULL;
             /* start a new group */
             m_radioButtonGroup = (GSList*) NULL;
-       }
+           }
     }
 
     m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
       
     SetLabel(label);
 
     }
 
     m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
       
     SetLabel(label);
 
-    wxSize newSize = size;
-    if (newSize.x == -1) newSize.x = 22+gdk_string_measure( m_widget->style->font, label.mbc_str() );
-    if (newSize.y == -1) newSize.y = 26;
-    SetSize( newSize.x, newSize.y );
-
     gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", 
       GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
        
     gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", 
       GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
        
@@ -121,9 +116,21 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
   
     PostCreation();
 
   
     PostCreation();
 
+    ApplyWidgetStyle();
+
+    SetFont( parent->GetFont() );
+
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = size_best.x;
+    if (new_size.y == -1)
+        new_size.y = size_best.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() );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
   
     Show( TRUE );
 
   
     Show( TRUE );
 
@@ -204,10 +211,15 @@ void wxRadioButton::OnInternalIdle()
           windows above so that checking for the current cursor is
           not possible. */
           
           windows above so that checking for the current cursor is
           not possible. */
           
-       gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widget)->event_window, cursor.GetCursor() );
+          gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widget)->event_window, cursor.GetCursor() );
     }
 
     UpdateWindowUI();
 }
 
     }
 
     UpdateWindowUI();
 }
 
+wxSize wxRadioButton::DoGetBestSize() const
+{
+    return wxControl::DoGetBestSize();
+}
+
 #endif
 #endif
index 99894b71a27510b7b8b7f9c7106d20fc62f92e63..2fde66188cf401d320ed446f8462948e4c4e51e8 100644 (file)
@@ -76,65 +76,78 @@ void wxSystemSettings::Done()
 
 wxColour wxSystemSettings::GetSystemColour( int index )
 {
 
 wxColour wxSystemSettings::GetSystemColour( int index )
 {
-  switch (index)
-  {
-    case wxSYS_COLOUR_SCROLLBAR:
-    case wxSYS_COLOUR_BACKGROUND:
-    case wxSYS_COLOUR_ACTIVECAPTION:
-    case wxSYS_COLOUR_INACTIVECAPTION:
-    case wxSYS_COLOUR_MENU:
-    case wxSYS_COLOUR_WINDOWFRAME:
-    case wxSYS_COLOUR_ACTIVEBORDER:
-    case wxSYS_COLOUR_INACTIVEBORDER:
-    case wxSYS_COLOUR_BTNFACE:
-    {
-      if (!g_systemBtnFaceColour)
-      {
-        g_systemBtnFaceColour = 
-         new wxColour( 0xd6d6 >> SHIFT,
-                       0xd6d6 >> SHIFT,
-                       0xd6d6 >> SHIFT );
-      }
-      return *g_systemBtnFaceColour;
-    }
-    case wxSYS_COLOUR_WINDOW:
-    {
-      return *wxWHITE;
-    }
-    case wxSYS_COLOUR_GRAYTEXT:
-    case wxSYS_COLOUR_BTNSHADOW:
-    {
-      if (!g_systemBtnShadowColour)
-      {
-        g_systemBtnShadowColour = 
-         new wxColour( 0x7530 >> SHIFT,
-                       0x7530 >> SHIFT,
-                       0x7530 >> SHIFT );
-      }
-      return *g_systemBtnShadowColour;
-    }
-    case wxSYS_COLOUR_BTNHIGHLIGHT:
-    {
-      if (!g_systemBtnHighlightColour)
-      {
-        g_systemBtnHighlightColour = 
-         new wxColour( 0xea60 >> SHIFT,
-                       0xea60 >> SHIFT,
-                       0xea60 >> SHIFT );
-      }
-      return *g_systemBtnHighlightColour;
-    }
-    case wxSYS_COLOUR_HIGHLIGHT:
+    switch (index)
     {
     {
-      if (!g_systemHighlightColour)
-      {
-        g_systemHighlightColour = 
-         new wxColour( 0      >> SHIFT,
-                       0      >> SHIFT,
-                       0x9c40 >> SHIFT );
-      }
-      return *g_systemHighlightColour;
-    }
+        case wxSYS_COLOUR_SCROLLBAR:
+        case wxSYS_COLOUR_BACKGROUND:
+        case wxSYS_COLOUR_ACTIVECAPTION:
+        case wxSYS_COLOUR_INACTIVECAPTION:
+        case wxSYS_COLOUR_MENU:
+        case wxSYS_COLOUR_WINDOWFRAME:
+        case wxSYS_COLOUR_ACTIVEBORDER:
+        case wxSYS_COLOUR_INACTIVEBORDER:
+        case wxSYS_COLOUR_BTNFACE:
+        {
+            if (!g_systemBtnFaceColour)
+            {
+                g_systemBtnFaceColour = 
+                       new wxColour( 0xd6d6 >> SHIFT,
+                                     0xd6d6 >> SHIFT,
+                                             0xd6d6 >> SHIFT );
+            }
+            return *g_systemBtnFaceColour;
+        }
+        case wxSYS_COLOUR_WINDOW:
+        {
+            return *wxWHITE;
+        }
+        case wxSYS_COLOUR_GRAYTEXT:
+        case wxSYS_COLOUR_BTNSHADOW:
+        {
+            if (!g_systemBtnShadowColour)
+            {
+                g_systemBtnShadowColour = 
+                       new wxColour( 0x7530 >> SHIFT,
+                                     0x7530 >> SHIFT,
+                                             0x7530 >> SHIFT );
+            }
+            return *g_systemBtnShadowColour;
+        }
+        case wxSYS_COLOUR_BTNHIGHLIGHT:
+        {
+            if (!g_systemBtnHighlightColour)
+            {
+                g_systemBtnHighlightColour = 
+                       new wxColour( 0xea60 >> SHIFT,
+                                     0xea60 >> SHIFT,
+                                             0xea60 >> SHIFT );
+            }
+            return *g_systemBtnHighlightColour;
+        }
+        case wxSYS_COLOUR_HIGHLIGHT:
+        {
+            if (!g_systemHighlightColour)
+            {
+/*
+                g_systemHighlightColour = 
+                       new wxColour( 0      >> SHIFT,
+                                     0      >> SHIFT,
+                                             0x9c40 >> SHIFT );
+*/              
+                GtkWidget *widget = gtk_button_new();
+                GtkStyle *def = gtk_rc_get_style( widget );
+                int red = def->bg[GTK_STATE_SELECTED].red;
+                int green = def->bg[GTK_STATE_SELECTED].green;
+                int blue = def->bg[GTK_STATE_SELECTED].blue;
+                gtk_widget_destroy( widget );
+
+                g_systemHighlightColour = 
+                       new wxColour( red    >> SHIFT,
+                                     green  >> SHIFT,
+                                             blue   >> SHIFT );
+            }
+            return *g_systemHighlightColour;
+        }
     case wxSYS_COLOUR_MENUTEXT:
     case wxSYS_COLOUR_WINDOWTEXT:
     case wxSYS_COLOUR_CAPTIONTEXT:
     case wxSYS_COLOUR_MENUTEXT:
     case wxSYS_COLOUR_WINDOWTEXT:
     case wxSYS_COLOUR_CAPTIONTEXT:
@@ -173,7 +186,7 @@ wxFont wxSystemSettings::GetSystemFont( int index )
         case wxSYS_DEFAULT_GUI_FONT:
         {
             if (!g_systemFont)
         case wxSYS_DEFAULT_GUI_FONT:
         {
             if (!g_systemFont)
-                g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
+                g_systemFont = new wxFont( 16, wxSWISS, wxNORMAL, wxNORMAL );
             return *g_systemFont;
         }
     }
             return *g_systemFont;
         }
     }
index 230914ab946ff1245de1030fa924b3bcafc9733e..9e51422831dd85d04c741b0666d345ea896a85e9 100644 (file)
@@ -88,24 +88,28 @@ bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id,
 
     m_widget = gtk_spin_button_new( m_adjust, 1, 0 );
     
 
     m_widget = gtk_spin_button_new( m_adjust, 1, 0 );
     
-    wxSize new_size = size,
-           sizeBest = DoGetBestSize();
-    if (new_size.x == -1)
-        new_size.x = sizeBest.x;
-    if (new_size.y == -1)
-        new_size.y = sizeBest.y;
-
-    if ((new_size.x != size.x) || (new_size.y != size.y))
-        SetSize( new_size.x, new_size.y );
-
     gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
                               (int)(m_windowStyle & wxSP_WRAP) );
 
     GtkEnableEvents();
     gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
                               (int)(m_windowStyle & wxSP_WRAP) );
 
     GtkEnableEvents();
+    
     m_parent->DoAddChild( this );
 
     PostCreation();
 
     m_parent->DoAddChild( this );
 
     PostCreation();
 
+    ApplyWidgetStyle();
+
+    SetFont( parent->GetFont() );
+    
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = size_best.x;
+    if (new_size.y == -1)
+        new_size.y = size_best.y;
+    if ((new_size.x != size.x) || (new_size.y != size.y))
+        SetSize( new_size.x, new_size.y );
+
     SetBackgroundColour( parent->GetBackgroundColour() );
 
     SetValue( value );
     SetBackgroundColour( parent->GetBackgroundColour() );
 
     SetValue( value );
index b7697b9ce702068a45cf3ed87e1ee3ef500adf18..eb53692cfc08b576c5dc5e277d2cde3be63d63df 100644 (file)
@@ -45,7 +45,7 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
     {
         wxFAIL_MSG( wxT("wxStaticBox creation failed") );
         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
     {
         wxFAIL_MSG( wxT("wxStaticBox creation failed") );
-       return FALSE;
+           return FALSE;
     }
 
     m_isStaticBox = TRUE;
     }
 
     m_isStaticBox = TRUE;
@@ -61,9 +61,13 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
 
     SetLabel(label);
   
 
     SetLabel(label);
   
+    ApplyWidgetStyle();
+
+    SetFont( parent->GetFont() );
+    
+
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
-    SetFont( parent->GetFont() );
 
     Show( TRUE );
 
 
     Show( TRUE );
 
index 8136ac250c42b2fcc96ad48c3ffc59373f7a82b5..54d7366a4f4f360500edd220f2de037225edcd96 100644 (file)
@@ -62,8 +62,6 @@ bool wxStaticText::Create(wxWindow *parent,
     wxControl::SetLabel(label);
     m_widget = gtk_label_new( m_label.mbc_str() );
     
     wxControl::SetLabel(label);
     m_widget = gtk_label_new( m_label.mbc_str() );
     
-    wxControl::SetFont( parent->GetFont() );
-
     GtkJustification justify;
     if ( style & wxALIGN_CENTER )
       justify = GTK_JUSTIFY_CENTER;
     GtkJustification justify;
     if ( style & wxALIGN_CENTER )
       justify = GTK_JUSTIFY_CENTER;
@@ -80,12 +78,23 @@ bool wxStaticText::Create(wxWindow *parent,
     // do not move this call elsewhere
     gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE );
 
     // do not move this call elsewhere
     gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE );
 
-    SetSizeOrDefault( size );
-
     m_parent->DoAddChild( this );
 
     PostCreation();
 
     m_parent->DoAddChild( this );
 
     PostCreation();
 
+    ApplyWidgetStyle();
+
+    wxControl::SetFont( parent->GetFont() );
+    
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
+    if (new_size.x == -1)
+        new_size.x = size_best.x;
+    if (new_size.y == -1)
+        new_size.y = size_best.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 );
     SetBackgroundColour( parent->GetBackgroundColour() );
     SetForegroundColour( parent->GetForegroundColour() );
     Show( TRUE );
index e832dcdf05704efc246545ba426a6e515d07878c..ddd7432d18896c8ada5671d70251eefd6a393e73 100644 (file)
@@ -192,20 +192,21 @@ bool wxTextCtrl::Create( wxWindow *parent,
           m_text = gtk_entry_new();
     }
 
           m_text = gtk_entry_new();
     }
 
-    wxSize new_size = size,
-           sizeBest = DoGetBestSize();
+    m_parent->DoAddChild( this );
+
+    PostCreation();
+
+    SetFont( parent->GetFont() );
+
+    wxSize size_best( DoGetBestSize() );
+    wxSize new_size( size );
     if (new_size.x == -1)
     if (new_size.x == -1)
-        new_size.x = sizeBest.x;
+        new_size.x = size_best.x;
     if (new_size.y == -1)
     if (new_size.y == -1)
-        new_size.y = sizeBest.y;
-
+        new_size.y = size_best.y;
     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 );
 
-    m_parent->DoAddChild( this );
-
-    PostCreation();
-
     if (multi_line)
         gtk_widget_show(m_text);
 
     if (multi_line)
         gtk_widget_show(m_text);
 
index a1484b14894b140a4aaaa86e26242d6009dcbc05..6c749174f259c6d5935ec49ba2399235f48ecc5d 100644 (file)
@@ -1634,9 +1634,6 @@ gtk_window_realized_callback( GtkWidget *WXUNUSED(m_widget), wxWindow *win )
     if (g_isIdle)
         wxapp_install_idle_handler();
 
     if (g_isIdle)
         wxapp_install_idle_handler();
 
-    if (win->m_delayedFont)
-        win->SetFont( win->GetFont() );
-
     if (win->m_delayedBackgroundColour)
         win->SetBackgroundColour( win->GetBackgroundColour() );
 
     if (win->m_delayedBackgroundColour)
         win->SetBackgroundColour( win->GetBackgroundColour() );
 
@@ -2025,6 +2022,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
 
     PostCreation();
 
 
     PostCreation();
 
+    ApplyWidgetStyle();
+
     Show( TRUE );
 
     return TRUE;
     Show( TRUE );
 
     return TRUE;
@@ -2963,7 +2962,7 @@ GtkStyle *wxWindow::GetWidgetStyle()
 {
     if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
 
 {
     if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
 
-    m_widgetStyle = gtk_style_copy( gtk_widget_get_style( m_widget ) );
+    m_widgetStyle = gtk_style_copy( gtk_rc_get_style( m_widget ) );
 
     return m_widgetStyle;
 }
 
     return m_widgetStyle;
 }
@@ -2972,28 +2971,37 @@ void wxWindow::SetWidgetStyle()
 {
     GtkStyle *style = GetWidgetStyle();
 
 {
     GtkStyle *style = GetWidgetStyle();
 
-    gdk_font_unref( style->font );
-    style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+    if (m_font != wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT ))
+    {
+        gdk_font_unref( style->font );
+        style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+    }
 
     if (m_foregroundColour.Ok())
     {
         m_foregroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
 
     if (m_foregroundColour.Ok())
     {
         m_foregroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
-        style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor();
-        style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
-        style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
+        if (m_foregroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT))
+        {
+            style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor();
+            style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
+            style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
+        }
     }
 
     if (m_backgroundColour.Ok())
     {
         m_backgroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
     }
 
     if (m_backgroundColour.Ok())
     {
         m_backgroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
-        style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
-        style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
-        style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
-        style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
-        style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
-        style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
-        style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
-        style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
+        if (m_backgroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE))
+        {
+            style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+            style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
+            style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
+            style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
+            style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
+            style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
+            style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
+            style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
+       }
     }
 }
 
     }
 }