+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");
+ }
+}
+