Added wxInfoBar::AddButton().

Allow adding custom buttons to wxInfoBar and show this in the sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-10-05 22:54:31 +00:00
parent df8c364bf4
commit 374ae80f2c
4 changed files with 34 additions and 2 deletions

View File

@@ -525,13 +525,23 @@ MyFrame::MyFrame(const wxString& title)
m_canvas = new MyCanvas(this);
#if wxUSE_INFOBAR
// an info bar can be created very simply and used without any extra effort
m_infoBarSimple = new wxInfoBar(this);
m_infoBarAdvanced = NULL;
// or it can also be customized
m_infoBarAdvanced = new wxInfoBar(this);
m_infoBarAdvanced->AddButton(wxID_UNDO);
m_infoBarAdvanced->SetOwnBackgroundColour(0xc8ffff);
m_infoBarAdvanced->SetShowHideEffects(wxSHOW_EFFECT_EXPAND,
wxSHOW_EFFECT_EXPAND);
m_infoBarAdvanced->SetEffectDuration(1500);
// to use the info bars we need to use sizer for the window layout
wxBoxSizer * const sizer = new wxBoxSizer(wxVERTICAL);
sizer->Add(m_infoBarSimple, wxSizerFlags().Expand());
sizer->Add(m_canvas, wxSizerFlags(1).Expand());
sizer->Add(m_infoBarAdvanced, wxSizerFlags().Expand());
SetSizer(sizer);
#endif // wxUSE_INFOBAR
}
@@ -690,6 +700,7 @@ void MyFrame::InfoBarSimple(wxCommandEvent& WXUNUSED(event))
void MyFrame::InfoBarAdvanced(wxCommandEvent& WXUNUSED(event))
{
m_infoBarAdvanced->ShowMessage("Sorry, it didn't work out.", wxICON_WARNING);
}
#endif // wxUSE_INFOBAR