+// ============================================================================
+// wxStatusBarPane implementation
+// ============================================================================
+
+bool wxStatusBarPane::SetText(const wxString& text)
+{
+ if ( text == m_text )
+ return false;
+
+ /*
+ If we have a message to restore on the stack, we update it to
+ correspond to the current one so that a sequence of calls such as
+
+ 1. SetStatusText("foo")
+ 2. PushStatusText("bar")
+ 3. SetStatusText("new foo")
+ 4. PopStatusText()
+
+ doesn't overwrite the "new foo" which should be shown at the end with
+ the old value "foo". This would be unexpected and hard to avoid,
+ especially when PushStatusText() is used internally by wxWidgets
+ without knowledge of the user program, as it is for showing the menu
+ and toolbar help strings.
+
+ By updating the top of the stack we ensure that the next call to
+ PopStatusText() basically becomes a NOP without breaking the balance
+ between the calls to push and pop as we would have done if we really
+ called PopStatusText() here.
+ */
+ if ( !m_arrStack.empty() )
+ {
+ m_arrStack.back() = text;
+ }
+
+ m_text = text;
+
+ return true;
+}
+
+bool wxStatusBarPane::PushText(const wxString& text)
+{
+ // save the currently shown text
+ m_arrStack.push_back(m_text);
+
+ // and update the new one if necessary
+ if ( text == m_text )
+ return false;
+
+ m_text = text;
+
+ return true;
+}
+
+bool wxStatusBarPane::PopText()
+{
+ wxCHECK_MSG( !m_arrStack.empty(), false, "no status message to pop" );
+
+ const wxString text = m_arrStack.back();
+
+ m_arrStack.pop_back();
+
+ if ( text == m_text )
+ return false;
+
+ m_text = text;
+
+ return true;
+}