void SetModified() { m_modified = TRUE; }
+ // wxGTK-specific: called recursively by Enable,
+ // to give widgets an oppprtunity to correct their colours after they
+ // have been changed by Enable
+ virtual void OnParentEnable( bool enable ) ;
+
protected:
virtual wxSize DoGetBestSize() const;
/* For compatibility across platforms (not in event table) */
void OnIdle(wxIdleEvent& WXUNUSED(event)) {};
+ // wxGTK-specific: called recursively by Enable,
+ // to give widgets an oppprtunity to correct their colours after they
+ // have been changed by Enable
+ virtual void OnParentEnable( bool WXUNUSED(enable) ) {};
+
/* used by all window classes in the widget creation process */
bool PreCreation( wxWindow *parent, const wxPoint &pos, const wxSize &size );
void PostCreation();
void SetModified() { m_modified = TRUE; }
+ // wxGTK-specific: called recursively by Enable,
+ // to give widgets an oppprtunity to correct their colours after they
+ // have been changed by Enable
+ virtual void OnParentEnable( bool enable ) ;
+
protected:
virtual wxSize DoGetBestSize() const;
/* For compatibility across platforms (not in event table) */
void OnIdle(wxIdleEvent& WXUNUSED(event)) {};
+ // wxGTK-specific: called recursively by Enable,
+ // to give widgets an oppprtunity to correct their colours after they
+ // have been changed by Enable
+ virtual void OnParentEnable( bool WXUNUSED(enable) ) {};
+
/* used by all window classes in the widget creation process */
bool PreCreation( wxWindow *parent, const wxPoint &pos, const wxSize &size );
void PostCreation();
{
gtk_text_set_editable( GTK_TEXT(m_text), enable );
- // If we have a custom background colour, we use this colour in both
- // disabled and enabled mode, or we end up with a different colour under the
- // text.
- wxColour oldColour = GetBackgroundColour();
- if (oldColour.Ok())
- {
- // Need to set twice or it'll optimize the useful stuff out
- if (oldColour == * wxWHITE)
- SetBackgroundColour(*wxBLACK);
- else
- SetBackgroundColour(*wxWHITE);
- SetBackgroundColour(oldColour);
- }
}
else
{
return TRUE;
}
+// wxGTK-specific: called recursively by Enable,
+// to give widgets an oppprtunity to correct their colours after they
+// have been changed by Enable
+void wxTextCtrl::OnParentEnable( bool enable )
+{
+ // If we have a custom background colour, we use this colour in both
+ // disabled and enabled mode, or we end up with a different colour under the
+ // text.
+ wxColour oldColour = GetBackgroundColour();
+ if (oldColour.Ok())
+ {
+ // Need to set twice or it'll optimize the useful stuff out
+ if (oldColour == * wxWHITE)
+ SetBackgroundColour(*wxBLACK);
+ else
+ SetBackgroundColour(*wxWHITE);
+ SetBackgroundColour(oldColour);
+ }
+}
+
void wxTextCtrl::DiscardEdits()
{
m_modified = FALSE;
return TRUE;
}
+static void wxWindowNotifyEnable(wxWindow* win, bool enable)
+{
+ win->OnParentEnable(enable);
+
+ // Recurse, so that children have the opportunity to Do The Right Thing
+ // and reset colours that have been messed up by a parent's (really ancestor's)
+ // Enable call
+ for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxWindow *child = node->GetData();
+ if (!child->IsKindOf(CLASSINFO(wxDialog)) && !child->IsKindOf(CLASSINFO(wxFrame)))
+ wxWindowNotifyEnable(child, enable);
+ }
+}
+
bool wxWindow::Enable( bool enable )
{
wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") );
if ( m_wxwindow )
gtk_widget_set_sensitive( m_wxwindow, enable );
- // Recurse, so that children have the opportunity to Do The Right Thing.
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
- node;
- node = node->GetNext() )
- {
- wxWindow *child = node->GetData();
- if (!child->IsKindOf(CLASSINFO(wxDialog)) && !child->IsKindOf(CLASSINFO(wxFrame)))
- child->Enable(enable);
- }
+ wxWindowNotifyEnable(this, enable);
return TRUE;
}
{
gtk_text_set_editable( GTK_TEXT(m_text), enable );
- // If we have a custom background colour, we use this colour in both
- // disabled and enabled mode, or we end up with a different colour under the
- // text.
- wxColour oldColour = GetBackgroundColour();
- if (oldColour.Ok())
- {
- // Need to set twice or it'll optimize the useful stuff out
- if (oldColour == * wxWHITE)
- SetBackgroundColour(*wxBLACK);
- else
- SetBackgroundColour(*wxWHITE);
- SetBackgroundColour(oldColour);
- }
}
else
{
return TRUE;
}
+// wxGTK-specific: called recursively by Enable,
+// to give widgets an oppprtunity to correct their colours after they
+// have been changed by Enable
+void wxTextCtrl::OnParentEnable( bool enable )
+{
+ // If we have a custom background colour, we use this colour in both
+ // disabled and enabled mode, or we end up with a different colour under the
+ // text.
+ wxColour oldColour = GetBackgroundColour();
+ if (oldColour.Ok())
+ {
+ // Need to set twice or it'll optimize the useful stuff out
+ if (oldColour == * wxWHITE)
+ SetBackgroundColour(*wxBLACK);
+ else
+ SetBackgroundColour(*wxWHITE);
+ SetBackgroundColour(oldColour);
+ }
+}
+
void wxTextCtrl::DiscardEdits()
{
m_modified = FALSE;
return TRUE;
}
+static void wxWindowNotifyEnable(wxWindow* win, bool enable)
+{
+ win->OnParentEnable(enable);
+
+ // Recurse, so that children have the opportunity to Do The Right Thing
+ // and reset colours that have been messed up by a parent's (really ancestor's)
+ // Enable call
+ for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxWindow *child = node->GetData();
+ if (!child->IsKindOf(CLASSINFO(wxDialog)) && !child->IsKindOf(CLASSINFO(wxFrame)))
+ wxWindowNotifyEnable(child, enable);
+ }
+}
+
bool wxWindow::Enable( bool enable )
{
wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") );
if ( m_wxwindow )
gtk_widget_set_sensitive( m_wxwindow, enable );
- // Recurse, so that children have the opportunity to Do The Right Thing.
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
- node;
- node = node->GetNext() )
- {
- wxWindow *child = node->GetData();
- if (!child->IsKindOf(CLASSINFO(wxDialog)) && !child->IsKindOf(CLASSINFO(wxFrame)))
- child->Enable(enable);
- }
+ wxWindowNotifyEnable(this, enable);
return TRUE;
}