+void MyFrame::OnUpdateSetPaneStyle(wxUpdateUIEvent& event)
+{
+ switch (event.GetId())
+ {
+ case StatusBar_SetPaneStyleNormal:
+ event.Check(m_statbarPaneStyle == wxSB_NORMAL);
+ break;
+ case StatusBar_SetPaneStyleFlat:
+ event.Check(m_statbarPaneStyle == wxSB_FLAT);
+ break;
+ case StatusBar_SetPaneStyleRaised:
+ event.Check(m_statbarPaneStyle == wxSB_RAISED);
+ break;
+ }
+}
+
+void MyFrame::OnSetPaneStyle(wxCommandEvent& event)
+{
+ switch (event.GetId())
+ {
+ case StatusBar_SetPaneStyleNormal:
+ m_statbarPaneStyle = wxSB_NORMAL;
+ break;
+ case StatusBar_SetPaneStyleFlat:
+ m_statbarPaneStyle = wxSB_FLAT;
+ break;
+ case StatusBar_SetPaneStyleRaised:
+ m_statbarPaneStyle = wxSB_RAISED;
+ break;
+ }
+
+ ApplyPaneStyle();
+}
+
+void MyFrame::ApplyPaneStyle()
+{
+ wxStatusBar *sb = GetStatusBar();
+ if (!sb)
+ return;
+
+ int fields = sb->GetFieldsCount();
+ int *styles = new int[fields];
+
+ for (int i = 1; i < fields; i++)
+ styles[i] = wxSB_NORMAL;
+
+ styles[0] = m_statbarPaneStyle;
+
+ sb->SetStatusStyles(fields, styles);
+
+ delete [] styles;
+}
+
+void MyFrame::OnUpdateSetStyle(wxUpdateUIEvent& event)
+{
+ long currentStyle = wxSTB_DEFAULT_STYLE;
+ if (GetStatusBar())
+ currentStyle = GetStatusBar()->GetWindowStyle();
+
+ switch (event.GetId())
+ {
+ case StatusBar_SetStyleSizeGrip:
+ event.Check((currentStyle & wxSTB_SIZEGRIP) != 0);
+ break;
+ case StatusBar_SetStyleShowTips:
+ event.Check((currentStyle & wxSTB_SHOW_TIPS) != 0);
+ break;
+
+ case StatusBar_SetStyleEllipsizeStart:
+ event.Check((currentStyle & wxSTB_ELLIPSIZE_START) != 0);
+ break;
+ case StatusBar_SetStyleEllipsizeMiddle:
+ event.Check((currentStyle & wxSTB_ELLIPSIZE_MIDDLE) != 0);
+ break;
+ case StatusBar_SetStyleEllipsizeEnd:
+ event.Check((currentStyle & wxSTB_ELLIPSIZE_END) != 0);
+ break;
+ }
+}
+
+void MyFrame::OnSetStyle(wxCommandEvent& event)
+{
+ long oldStyle = wxSTB_DEFAULT_STYLE;
+ if (GetStatusBar())
+ oldStyle = GetStatusBar()->GetWindowStyle();
+
+#define STB_ELLIPSIZE_MASK (wxSTB_ELLIPSIZE_START|wxSTB_ELLIPSIZE_MIDDLE|wxSTB_ELLIPSIZE_END)
+
+ long newStyle = oldStyle;
+ long newStyleBit = 0;
+ switch (event.GetId())
+ {
+ case StatusBar_SetStyleSizeGrip:
+ newStyleBit = wxSTB_SIZEGRIP;
+ break;
+ case StatusBar_SetStyleShowTips:
+ newStyleBit = wxSTB_SHOW_TIPS;
+ break;
+
+ case StatusBar_SetStyleEllipsizeStart:
+ newStyleBit = wxSTB_ELLIPSIZE_START;
+ newStyle &= ~STB_ELLIPSIZE_MASK;
+ break;
+ case StatusBar_SetStyleEllipsizeMiddle:
+ newStyleBit = wxSTB_ELLIPSIZE_MIDDLE;
+ newStyle &= ~STB_ELLIPSIZE_MASK;
+ break;
+ case StatusBar_SetStyleEllipsizeEnd:
+ newStyleBit = wxSTB_ELLIPSIZE_END;
+ newStyle &= ~STB_ELLIPSIZE_MASK;
+ break;
+ }
+
+ newStyle = event.IsChecked() ? (newStyle | newStyleBit) :
+ (newStyle & ~newStyleBit);
+ if (newStyle != oldStyle)
+ {
+ DoCreateStatusBar(m_statbarKind, newStyle);
+ SetStatusText("Status bar recreated with a new style");
+ }
+}
+