Remove the hack with changing the parent background colour in wxInfoBar.
Finding the closest info bar to copy the background colour from only worked for very simple layouts and failed for more complicated ones with nested sizers so don't try to change the colour automatically, it's easy enough to do it manually as shown in the updated dialogs sample. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62301 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -170,55 +170,10 @@ void wxInfoBarGeneric::UpdateParent()
|
||||
parent->Layout();
|
||||
}
|
||||
|
||||
void wxInfoBarGeneric::ChangeParentBackground()
|
||||
{
|
||||
wxWindow * const parent = GetParent();
|
||||
m_origParentBgCol = parent->GetBackgroundColour();
|
||||
|
||||
wxSizer * const sizer = GetContainingSizer();
|
||||
if ( !sizer )
|
||||
return;
|
||||
|
||||
wxWindow *sibling = NULL;
|
||||
for ( wxSizerItemList::compatibility_iterator
|
||||
node = sizer->GetChildren().GetFirst();
|
||||
node;
|
||||
node = node->GetNext() )
|
||||
{
|
||||
if ( node->GetData()->GetWindow() == this )
|
||||
{
|
||||
// find the next window following us
|
||||
for ( node = node->GetNext();
|
||||
node;
|
||||
node = node->GetNext() )
|
||||
{
|
||||
wxSizerItem * const item = node->GetData();
|
||||
if ( item->IsWindow() )
|
||||
{
|
||||
sibling = item->GetWindow();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( sibling )
|
||||
parent->SetOwnBackgroundColour(sibling->GetBackgroundColour());
|
||||
}
|
||||
|
||||
void wxInfoBarGeneric::RestoreParentBackground()
|
||||
{
|
||||
GetParent()->SetOwnBackgroundColour(m_origParentBgCol);
|
||||
}
|
||||
|
||||
void wxInfoBarGeneric::DoHide()
|
||||
{
|
||||
ChangeParentBackground();
|
||||
wxON_BLOCK_EXIT_THIS0( wxInfoBarGeneric::RestoreParentBackground );
|
||||
|
||||
HideWithEffect(m_hideEffect, m_effectDuration);
|
||||
|
||||
UpdateParent();
|
||||
}
|
||||
|
||||
@@ -234,12 +189,6 @@ void wxInfoBarGeneric::DoShow()
|
||||
// without really showing it
|
||||
wxWindowBase::Show();
|
||||
|
||||
// an extra hack: we want the temporarily uncovered area in which we're
|
||||
// going to expand to look like part of this sibling for a better effect so
|
||||
// temporarily change the background of our parent to the same colour
|
||||
ChangeParentBackground();
|
||||
wxON_BLOCK_EXIT_THIS0( wxInfoBarGeneric::RestoreParentBackground );
|
||||
|
||||
// adjust the parent layout to account for us
|
||||
UpdateParent();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user