+ 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;