make IsEnabled() return false even if the window parent, and not the window itself, is disabled and added IsThisEnabled() implementing the old IsEnabled() behaviour; also significantly simplify the window state management code in all ports by factoring out the common parts in wxWindowBase

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45031 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-03-23 14:01:53 +00:00
parent 68a9527d51
commit 47a8a4d5cc
24 changed files with 189 additions and 330 deletions

View File

@@ -3021,40 +3021,13 @@ bool wxWindowGTK::Show( bool show )
return true;
}
static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable)
void wxWindowGTK::DoEnable( 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::compatibility_iterator 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 wxWindowGTK::Enable( bool enable )
{
wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") );
if (!wxWindowBase::Enable(enable))
{
// nothing to do
return false;
}
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
gtk_widget_set_sensitive( m_widget, enable );
if ( m_wxwindow )
gtk_widget_set_sensitive( m_wxwindow, enable );
wxWindowNotifyEnable(this, enable);
return true;
}
int wxWindowGTK::GetCharHeight() const