fixed GTK styles handling:
1. don't modify the style unless something changed 2. use gtk_widget_modify_style instead of gtk_widget_set_style, the latter is not recommended by GTK+ developers git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27784 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2342,7 +2342,7 @@ typedef struct _GdkICAttr GdkICAttr;
|
||||
|
||||
/* Stand-ins for GTK types */
|
||||
typedef struct _GtkWidget GtkWidget;
|
||||
typedef struct _GtkStyle GtkStyle;
|
||||
typedef struct _GtkRcStyle GtkRcStyle;
|
||||
typedef struct _GtkAdjustment GtkAdjustment;
|
||||
typedef struct _GtkList GtkList;
|
||||
typedef struct _GtkToolbar GtkToolbar;
|
||||
|
@@ -61,7 +61,7 @@ public:
|
||||
void NotFocus();
|
||||
void StartSelect();
|
||||
void EndSelect();
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
bool m_hasFocus:1;
|
||||
bool m_isSelected:1;
|
||||
|
@@ -64,7 +64,7 @@ public:
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
|
||||
// Since this wxButton doesn't derive from wxButtonBase (why?) we need
|
||||
|
@@ -51,7 +51,7 @@ public:
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void OnInternalIdle();
|
||||
|
||||
|
@@ -83,7 +83,7 @@ public:
|
||||
protected:
|
||||
wxList m_clientList; // contains the client data for the items
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
virtual int DoAppend(const wxString& item);
|
||||
virtual int DoInsert(const wxString& item, int pos);
|
||||
|
||||
|
@@ -130,7 +130,7 @@ public:
|
||||
void EnableEvents();
|
||||
GtkWidget* GetConnectWidget();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
|
||||
|
||||
|
@@ -56,6 +56,11 @@ public:
|
||||
virtual wxVisualAttributes GetDefaultAttributes() const;
|
||||
|
||||
protected:
|
||||
virtual void ApplyWidgetStyle();
|
||||
// helper function to ease native widgets wrapping, called by
|
||||
// ApplyWidgetStyle -- override this, not ApplyWidgetStyle
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
void PostCreation(const wxSize& size);
|
||||
|
||||
|
@@ -83,8 +83,6 @@ public:
|
||||
// implementation
|
||||
// -------------
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
// the max and current gauge values
|
||||
int m_rangeMax,
|
||||
m_gaugePos;
|
||||
|
@@ -105,7 +105,7 @@ public:
|
||||
int GtkGetIndex( GtkWidget *item ) const;
|
||||
GtkWidget *GetConnectWidget();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
void OnInternalIdle();
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
|
@@ -113,7 +113,7 @@ public:
|
||||
// set all page's font
|
||||
bool SetFont(const wxFont& font);
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
// report if window belongs to notebook
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
|
@@ -121,7 +121,7 @@ public:
|
||||
void GtkDisableEvents();
|
||||
void GtkEnableEvents();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
#if wxUSE_TOOLTIPS
|
||||
void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
@@ -57,7 +57,7 @@ public:
|
||||
virtual bool IsRadioButton() const { return TRUE; }
|
||||
|
||||
GSList *m_radioButtonGroup;
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void OnInternalIdle();
|
||||
|
||||
|
@@ -75,7 +75,6 @@ public:
|
||||
// --------------
|
||||
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
GtkAdjustment *m_adjust;
|
||||
float m_oldPos;
|
||||
|
@@ -65,7 +65,6 @@ public:
|
||||
|
||||
// implementation
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
void GtkDisableEvents();
|
||||
void GtkEnableEvents();
|
||||
|
||||
|
@@ -53,7 +53,6 @@ public:
|
||||
void OnSize( wxSizeEvent &event );
|
||||
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
GtkAdjustment *m_adjust;
|
||||
float m_oldPos;
|
||||
|
@@ -66,7 +66,6 @@ public:
|
||||
void OnChar( wxKeyEvent &event );
|
||||
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
void GtkDisableEvents();
|
||||
void GtkEnableEvents();
|
||||
|
||||
|
@@ -45,8 +45,6 @@ public:
|
||||
|
||||
// implementation
|
||||
|
||||
virtual void ApplyWidgetStyle();
|
||||
|
||||
virtual bool IsTransparentForMouse() const { return TRUE; }
|
||||
|
||||
private:
|
||||
|
@@ -65,8 +65,6 @@ public:
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
@@ -133,7 +133,7 @@ public:
|
||||
|
||||
GtkWidget* GetConnectWidget();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
void CalculateScrollbar();
|
||||
void OnInternalIdle();
|
||||
void UpdateFontIfNeeded();
|
||||
|
@@ -74,7 +74,7 @@ public:
|
||||
wxBitmap m_bitmap;
|
||||
|
||||
void OnSetBitmap();
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
bool IsOwnGtkWindow(GdkWindow *window);
|
||||
|
||||
virtual void OnInternalIdle();
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
// implementation
|
||||
bool m_blockEvent;
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
bool IsOwnGtkWindow(GdkWindow *window);
|
||||
|
||||
virtual void OnInternalIdle();
|
||||
|
@@ -153,10 +153,6 @@ public:
|
||||
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ConnectWidget( GtkWidget *widget );
|
||||
|
||||
// Creates a new widget style if none is there
|
||||
// and sets m_widgetStyle to this value.
|
||||
GtkStyle *GetWidgetStyle();
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
// Returns the default context which usually is anti-aliased
|
||||
PangoContext *GtkGetPangoDefaultContext();
|
||||
@@ -168,12 +164,6 @@ public:
|
||||
PangoContext *m_x11Context;
|
||||
#endif
|
||||
|
||||
// Called by SetFont() and SetXXXColour etc
|
||||
void SetWidgetStyle();
|
||||
|
||||
// Overridden in many GTK widgets who have to handle subwidgets
|
||||
virtual void ApplyWidgetStyle();
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
@@ -247,12 +237,6 @@ public:
|
||||
bool m_delayedForegroundColour:1;
|
||||
bool m_delayedBackgroundColour:1;
|
||||
|
||||
// Contains GTK's widgets internal information about non-default widget
|
||||
// font and colours. we create one for each widget that gets any
|
||||
// non-default attribute set via SetFont() or SetForegroundColour() /
|
||||
// SetBackgroundColour().
|
||||
GtkStyle *m_widgetStyle;
|
||||
|
||||
// C++ has no virtual methods in the constrcutor of any class but we need
|
||||
// different methods of inserting a child window into a wxFrame,
|
||||
// wxMDIFrame, wxNotebook etc. this is the callback that will get used.
|
||||
@@ -280,6 +264,14 @@ public:
|
||||
protected:
|
||||
// common part of all ctors (not virtual because called from ctor)
|
||||
void Init();
|
||||
|
||||
// Called by ApplyWidgetStyle (which is called by SetFont() and
|
||||
// SetXXXColour etc to apply style changed to native widgets) to create
|
||||
// modified GTK style with non-standard attributes.
|
||||
GtkRcStyle *CreateWidgetStyle();
|
||||
|
||||
// Overridden in many GTK widgets who have to handle subwidgets
|
||||
virtual void ApplyWidgetStyle();
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowGTK)
|
||||
|
@@ -61,7 +61,7 @@ public:
|
||||
void NotFocus();
|
||||
void StartSelect();
|
||||
void EndSelect();
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
bool m_hasFocus:1;
|
||||
bool m_isSelected:1;
|
||||
|
@@ -64,7 +64,7 @@ public:
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
|
||||
// Since this wxButton doesn't derive from wxButtonBase (why?) we need
|
||||
|
@@ -51,7 +51,7 @@ public:
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void OnInternalIdle();
|
||||
|
||||
|
@@ -83,7 +83,7 @@ public:
|
||||
protected:
|
||||
wxList m_clientList; // contains the client data for the items
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
virtual int DoAppend(const wxString& item);
|
||||
virtual int DoInsert(const wxString& item, int pos);
|
||||
|
||||
|
@@ -130,7 +130,7 @@ public:
|
||||
void EnableEvents();
|
||||
GtkWidget* GetConnectWidget();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
|
||||
|
||||
|
@@ -56,6 +56,11 @@ public:
|
||||
virtual wxVisualAttributes GetDefaultAttributes() const;
|
||||
|
||||
protected:
|
||||
virtual void ApplyWidgetStyle();
|
||||
// helper function to ease native widgets wrapping, called by
|
||||
// ApplyWidgetStyle -- override this, not ApplyWidgetStyle
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
void PostCreation(const wxSize& size);
|
||||
|
||||
|
@@ -83,8 +83,6 @@ public:
|
||||
// implementation
|
||||
// -------------
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
// the max and current gauge values
|
||||
int m_rangeMax,
|
||||
m_gaugePos;
|
||||
|
@@ -105,7 +105,7 @@ public:
|
||||
int GtkGetIndex( GtkWidget *item ) const;
|
||||
GtkWidget *GetConnectWidget();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
void OnInternalIdle();
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
|
@@ -113,7 +113,7 @@ public:
|
||||
// set all page's font
|
||||
bool SetFont(const wxFont& font);
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
// report if window belongs to notebook
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
|
@@ -121,7 +121,7 @@ public:
|
||||
void GtkDisableEvents();
|
||||
void GtkEnableEvents();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
#if wxUSE_TOOLTIPS
|
||||
void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
@@ -57,7 +57,7 @@ public:
|
||||
virtual bool IsRadioButton() const { return TRUE; }
|
||||
|
||||
GSList *m_radioButtonGroup;
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void OnInternalIdle();
|
||||
|
||||
|
@@ -75,7 +75,6 @@ public:
|
||||
// --------------
|
||||
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
GtkAdjustment *m_adjust;
|
||||
float m_oldPos;
|
||||
|
@@ -65,7 +65,6 @@ public:
|
||||
|
||||
// implementation
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
void GtkDisableEvents();
|
||||
void GtkEnableEvents();
|
||||
|
||||
|
@@ -53,7 +53,6 @@ public:
|
||||
void OnSize( wxSizeEvent &event );
|
||||
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
GtkAdjustment *m_adjust;
|
||||
float m_oldPos;
|
||||
|
@@ -66,7 +66,6 @@ public:
|
||||
void OnChar( wxKeyEvent &event );
|
||||
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
void GtkDisableEvents();
|
||||
void GtkEnableEvents();
|
||||
|
||||
|
@@ -45,8 +45,6 @@ public:
|
||||
|
||||
// implementation
|
||||
|
||||
virtual void ApplyWidgetStyle();
|
||||
|
||||
virtual bool IsTransparentForMouse() const { return TRUE; }
|
||||
|
||||
private:
|
||||
|
@@ -65,8 +65,6 @@ public:
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
@@ -133,7 +133,7 @@ public:
|
||||
|
||||
GtkWidget* GetConnectWidget();
|
||||
bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
void CalculateScrollbar();
|
||||
void OnInternalIdle();
|
||||
void UpdateFontIfNeeded();
|
||||
|
@@ -74,7 +74,7 @@ public:
|
||||
wxBitmap m_bitmap;
|
||||
|
||||
void OnSetBitmap();
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
bool IsOwnGtkWindow(GdkWindow *window);
|
||||
|
||||
virtual void OnInternalIdle();
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
// implementation
|
||||
bool m_blockEvent;
|
||||
|
||||
void ApplyWidgetStyle();
|
||||
void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
bool IsOwnGtkWindow(GdkWindow *window);
|
||||
|
||||
virtual void OnInternalIdle();
|
||||
|
@@ -153,10 +153,6 @@ public:
|
||||
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ConnectWidget( GtkWidget *widget );
|
||||
|
||||
// Creates a new widget style if none is there
|
||||
// and sets m_widgetStyle to this value.
|
||||
GtkStyle *GetWidgetStyle();
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
// Returns the default context which usually is anti-aliased
|
||||
PangoContext *GtkGetPangoDefaultContext();
|
||||
@@ -168,12 +164,6 @@ public:
|
||||
PangoContext *m_x11Context;
|
||||
#endif
|
||||
|
||||
// Called by SetFont() and SetXXXColour etc
|
||||
void SetWidgetStyle();
|
||||
|
||||
// Overridden in many GTK widgets who have to handle subwidgets
|
||||
virtual void ApplyWidgetStyle();
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
@@ -247,12 +237,6 @@ public:
|
||||
bool m_delayedForegroundColour:1;
|
||||
bool m_delayedBackgroundColour:1;
|
||||
|
||||
// Contains GTK's widgets internal information about non-default widget
|
||||
// font and colours. we create one for each widget that gets any
|
||||
// non-default attribute set via SetFont() or SetForegroundColour() /
|
||||
// SetBackgroundColour().
|
||||
GtkStyle *m_widgetStyle;
|
||||
|
||||
// C++ has no virtual methods in the constrcutor of any class but we need
|
||||
// different methods of inserting a child window into a wxFrame,
|
||||
// wxMDIFrame, wxNotebook etc. this is the callback that will get used.
|
||||
@@ -280,6 +264,14 @@ public:
|
||||
protected:
|
||||
// common part of all ctors (not virtual because called from ctor)
|
||||
void Init();
|
||||
|
||||
// Called by ApplyWidgetStyle (which is called by SetFont() and
|
||||
// SetXXXColour etc to apply style changed to native widgets) to create
|
||||
// modified GTK style with non-standard attributes.
|
||||
GtkRcStyle *CreateWidgetStyle();
|
||||
|
||||
// Overridden in many GTK widgets who have to handle subwidgets
|
||||
virtual void ApplyWidgetStyle();
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowGTK)
|
||||
|
Reference in New Issue
Block a user