void OnSetStatusField(wxCommandEvent& event);
void OnSetStatusText(wxCommandEvent& event);
+ void OnPushStatusText(wxCommandEvent& event);
+ void OnPopStatusText(wxCommandEvent& event);
void OnResetFieldsWidth(wxCommandEvent& event);
void OnSetStatusFields(wxCommandEvent& event);
StatusBar_SetFields = wxID_HIGHEST+1,
StatusBar_SetField,
StatusBar_SetText,
+ StatusBar_PushText,
+ StatusBar_PopText,
StatusBar_SetFont,
StatusBar_ResetFieldsWidth,
EVT_MENU(StatusBar_SetFields, MyFrame::OnSetStatusFields)
EVT_MENU(StatusBar_SetField, MyFrame::OnSetStatusField)
EVT_MENU(StatusBar_SetText, MyFrame::OnSetStatusText)
+ EVT_MENU(StatusBar_PushText, MyFrame::OnPushStatusText)
+ EVT_MENU(StatusBar_PopText, MyFrame::OnPopStatusText)
EVT_MENU(StatusBar_SetFont, MyFrame::OnSetStatusFont)
EVT_MENU(StatusBar_ResetFieldsWidth, MyFrame::OnResetFieldsWidth)
EVT_MENU(StatusBar_Recreate, MyFrame::OnRecreateStatusBar)
"Set the number of field used by the next commands.");
statbarMenu->Append(StatusBar_SetText, wxT("Set field &text\tCtrl-T"),
wxT("Set the text of the selected field."));
+ statbarMenu->Append(StatusBar_PushText, "P&ush field text\tCtrl-P",
+ "Push a message on top the selected field.");
+ statbarMenu->Append(StatusBar_PopText, "&Pop field text\tShift-Ctrl-P",
+ "Restore the previous contents of the selected field.");
statbarMenu->AppendSeparator();
statbarMenu->Append(StatusBar_SetFields, wxT("&Set field count\tCtrl-C"),
sb->SetStatusText(txt, m_field);
}
+// the current depth of the stack used by Push/PopStatusText()
+static int gs_depth = 0;
+
+void MyFrame::OnPushStatusText(wxCommandEvent& WXUNUSED(event))
+{
+ wxStatusBar *sb = GetStatusBar();
+ if (!sb)
+ return;
+
+ static int s_countPush = 0;
+ sb->PushStatusText(wxString::Format
+ (
+ "Pushed message #%d (depth = %d)",
+ ++s_countPush, ++gs_depth
+ ), m_field);
+}
+
+void MyFrame::OnPopStatusText(wxCommandEvent& WXUNUSED(event))
+{
+ wxStatusBar *sb = GetStatusBar();
+ if (!sb)
+ return;
+
+ if ( !gs_depth )
+ {
+ wxLogStatus("No message to pop.");
+ return;
+ }
+
+ gs_depth--;
+ sb->PopStatusText(m_field);
+}
+
void MyFrame::OnSetStatusFont(wxCommandEvent& WXUNUSED(event))
{
wxStatusBar *sb = GetStatusBar();