From 7545e13206beaed9058e0ccbc53c6ec9013c6cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 3 Jul 2004 16:58:10 +0000 Subject: [PATCH] a better way of applying style changes to label_widget git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28159 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/statbox.h | 5 +++-- include/wx/gtk1/statbox.h | 5 +++-- src/gtk/statbox.cpp | 15 +++------------ src/gtk1/statbox.cpp | 15 +++------------ 4 files changed, 12 insertions(+), 28 deletions(-) diff --git a/include/wx/gtk/statbox.h b/include/wx/gtk/statbox.h index b63c97324e..87b7372b86 100644 --- a/include/wx/gtk/statbox.h +++ b/include/wx/gtk/statbox.h @@ -40,8 +40,6 @@ public: virtual void SetLabel( const wxString &label ); - bool SetFont( const wxFont &font ); - static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); @@ -49,6 +47,9 @@ public: virtual bool IsTransparentForMouse() const { return TRUE; } +protected: + void DoApplyWidgetStyle(GtkRcStyle *style); + private: DECLARE_DYNAMIC_CLASS(wxStaticBox) }; diff --git a/include/wx/gtk1/statbox.h b/include/wx/gtk1/statbox.h index b63c97324e..87b7372b86 100644 --- a/include/wx/gtk1/statbox.h +++ b/include/wx/gtk1/statbox.h @@ -40,8 +40,6 @@ public: virtual void SetLabel( const wxString &label ); - bool SetFont( const wxFont &font ); - static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); @@ -49,6 +47,9 @@ public: virtual bool IsTransparentForMouse() const { return TRUE; } +protected: + void DoApplyWidgetStyle(GtkRcStyle *style); + private: DECLARE_DYNAMIC_CLASS(wxStaticBox) }; diff --git a/src/gtk/statbox.cpp b/src/gtk/statbox.cpp index a15681c061..d6c4bc496d 100644 --- a/src/gtk/statbox.cpp +++ b/src/gtk/statbox.cpp @@ -91,19 +91,10 @@ void wxStaticBox::SetLabel( const wxString &label ) m_label.empty() ? (char *)NULL : (const char*) wxGTK_CONV( m_label ) ); } -bool wxStaticBox::SetFont( const wxFont &font ) +void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle *style) { - wxControl::SetFont( font ); - - if (GTK_FRAME(m_widget)->label_widget) - { - GtkRcStyle *style = CreateWidgetStyle(true); - if ( style ) - { - gtk_widget_modify_style( GTK_FRAME(m_widget)->label_widget, style); - gtk_rc_style_unref(style); - } - } + gtk_widget_modify_style(m_widget, style); + gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style); } // static diff --git a/src/gtk1/statbox.cpp b/src/gtk1/statbox.cpp index a15681c061..d6c4bc496d 100644 --- a/src/gtk1/statbox.cpp +++ b/src/gtk1/statbox.cpp @@ -91,19 +91,10 @@ void wxStaticBox::SetLabel( const wxString &label ) m_label.empty() ? (char *)NULL : (const char*) wxGTK_CONV( m_label ) ); } -bool wxStaticBox::SetFont( const wxFont &font ) +void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle *style) { - wxControl::SetFont( font ); - - if (GTK_FRAME(m_widget)->label_widget) - { - GtkRcStyle *style = CreateWidgetStyle(true); - if ( style ) - { - gtk_widget_modify_style( GTK_FRAME(m_widget)->label_widget, style); - gtk_rc_style_unref(style); - } - } + gtk_widget_modify_style(m_widget, style); + gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style); } // static