+ MyAboutDialog dlg(this);
+ dlg.ShowModal();
+}
+
+void MyFrame::OnUpdateSetStyleNormal(wxUpdateUIEvent &event)
+{
+ event.Check(m_statbarStyle == wxSB_NORMAL);
+}
+
+void MyFrame::OnUpdateSetStyleFlat(wxUpdateUIEvent &event)
+{
+ event.Check(m_statbarStyle == wxSB_FLAT);
+}
+
+void MyFrame::OnUpdateSetStyleRaised(wxUpdateUIEvent &event)
+{
+ event.Check(m_statbarStyle == wxSB_RAISED);
+}
+
+void MyFrame::OnSetStyleNormal(wxCommandEvent & WXUNUSED(event))
+{
+ m_statbarStyle = wxSB_NORMAL;
+ ApplyStyle();
+}
+
+void MyFrame::OnSetStyleFlat(wxCommandEvent & WXUNUSED(event))
+{
+ m_statbarStyle = wxSB_FLAT;
+ ApplyStyle();
+}
+
+void MyFrame::OnSetStyleRaised(wxCommandEvent & WXUNUSED(event))
+{
+ m_statbarStyle = wxSB_RAISED;
+ ApplyStyle();
+}
+
+void MyFrame::ApplyStyle()
+{
+ wxStatusBar *sb = GetStatusBar();
+ int fields = sb->GetFieldsCount();
+ int *styles = new int[fields];
+
+ for (int i = 1; i < fields; i++)
+ styles[i] = wxSB_NORMAL;
+
+ styles[0] = m_statbarStyle;
+
+ sb->SetStatusStyles(fields, styles);
+
+ delete [] styles;
+}
+
+// ----------------------------------------------------------------------------
+// MyAboutDialog
+// ----------------------------------------------------------------------------
+
+MyAboutDialog::MyAboutDialog(wxWindow *parent)
+ : wxDialog(parent, wxID_ANY, wxString(_T("About statbar")),
+ wxDefaultPosition, wxDefaultSize,
+ wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
+{
+ wxStaticText *text = new wxStaticText(this, wxID_ANY,
+ _T("wxStatusBar sample\n")
+ _T("(c) 2000 Vadim Zeitlin"));
+
+ wxButton *btn = new wxButton(this, wxID_OK, _T("&Close"));
+
+ // create the top status bar without the size grip (default style),
+ // otherwise it looks weird
+ wxStatusBar *statbarTop = new wxStatusBar(this, wxID_ANY, 0);
+ statbarTop->SetFieldsCount(3);
+ statbarTop->SetStatusText(_T("This is a top status bar"), 0);
+ statbarTop->SetStatusText(_T("in a dialog"), 1);
+ statbarTop->SetStatusText(_T("Great, isn't it?"), 2);
+
+ wxStatusBar *statbarBottom = new wxStatusBar(this, wxID_ANY);
+ statbarBottom->SetFieldsCount(2);
+ statbarBottom->SetStatusText(_T("This is a bottom status bar"), 0);
+ statbarBottom->SetStatusText(_T("in a dialog"), 1);
+
+ wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
+ sizerTop->Add(statbarTop, 0, wxGROW);
+ sizerTop->Add(-1, 10, 1, wxGROW);
+ sizerTop->Add(text, 0, wxCENTRE | wxRIGHT | wxLEFT, 20);
+ sizerTop->Add(-1, 10, 1, wxGROW);
+ sizerTop->Add(btn, 0, wxCENTRE | wxRIGHT | wxLEFT, 20);
+ sizerTop->Add(-1, 10, 1, wxGROW);
+ sizerTop->Add(statbarBottom, 0, wxGROW);
+
+ SetSizerAndFit(sizerTop);