}
}
+BEGIN_EVENT_TABLE(wxTopLevelWindowGTK, wxTopLevelWindowBase)
+ EVT_SYS_COLOUR_CHANGED(wxTopLevelWindowGTK::OnSysColourChanged)
+END_EVENT_TABLE()
+
+
// ----------------------------------------------------------------------------
// wxTopLevelWindowGTK creation
// ----------------------------------------------------------------------------
"Composite", &opcode, &event, &error);
#endif
}
+
+void wxTopLevelWindowGTK::OnSysColourChanged(wxSysColourChangedEvent& event)
+{
+ // We don't know the order in which top-level windows will
+ // be notified, so we need to clear the system objects
+ // for each top-level window.
+ extern void wxClearGtkSystemObjects();
+ wxClearGtkSystemObjects();
+
+ // wxWindowBase::OnSysColourChanged will propagate event
+ // to children
+ event.Skip();
+}
}
#endif
+//-----------------------------------------------------------------------------
+// "style_set"
+//-----------------------------------------------------------------------------
+
+static
+void gtk_window_style_set_callback( GtkWidget *WXUNUSED(widget),
+ GtkStyle *previous_style,
+ wxWindow* win )
+{
+ //wxLogDebug(wxT("gtk_window_style_set_callback"));
+ if (win && previous_style)
+ {
+ wxString name(win->GetName());
+ //wxLogDebug(wxT("gtk_window_style_set_callback %s"), name.c_str());
+ wxSysColourChangedEvent event;
+ event.SetEventObject(win);
+
+ win->GTKProcessEvent( event );
+ }
+}
+
} // extern "C"
+// Connect/disconnect style-set
+
+void wxConnectStyleSet(wxWindow* win)
+{
+ if (win->m_wxwindow)
+ g_signal_connect (win->m_wxwindow, "style_set",
+ G_CALLBACK (gtk_window_style_set_callback), win);
+}
+
+void wxDisconnectStyleSet(wxWindow* win)
+{
+ if (win->m_wxwindow)
+ g_signal_handlers_disconnect_by_func (win->m_wxwindow,
+ (gpointer) gtk_window_style_set_callback,
+ win);
+}
+
+// Helper to suspend colour change event event processing while we change a widget's style
+class wxSuspendStyleEvents
+{
+public:
+ wxSuspendStyleEvents(wxWindow* win)
+ {
+ m_win = win;
+ if (win->IsTopLevel())
+ wxDisconnectStyleSet(win);
+ }
+ ~wxSuspendStyleEvents()
+ {
+ if (m_win->IsTopLevel())
+ wxConnectStyleSet(m_win);
+ }
+
+ wxWindow* m_win;
+};
+
// ----------------------------------------------------------------------------
// this wxWindowBase function is implemented here (in platform-specific file)
// because it is static and so couldn't be made virtual
G_CALLBACK (gtk_window_enter_callback), this);
g_signal_connect (widget, "leave_notify_event",
G_CALLBACK (gtk_window_leave_callback), this);
+
+ if (IsTopLevel() && m_wxwindow)
+ g_signal_connect (m_wxwindow, "style_set",
+ G_CALLBACK (gtk_window_style_set_callback), this);
}
bool wxWindowGTK::Destroy()
void wxWindowGTK::DoApplyWidgetStyle(GtkRcStyle *style)
{
+ wxSuspendStyleEvents s(this);
+
if (m_wxwindow)
gtk_widget_modify_style(m_wxwindow, style);
else