]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't pop explicitly changed status messages.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 6 Aug 2009 00:01:43 +0000 (00:01 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 6 Aug 2009 00:01:43 +0000 (00:01 +0000)
Calls to SetStatusText() in between Push/PopStatusText() were simply lost
before, now the text explicitly changed by SetStatusText() is preserved by the
next call to PopStatusText().

This required adding a new virtual method, called DoUpdateStatusText(), which
is now implemented in all the derived classes instead of overriding
SetStatusText() (on the bright side, it doesn't need to do any checks already
done in the base class any more).

Also fix PushStatusText() to actually show the text being pushed at all under
wxMSW as a side effect.

And further reduce code duplication between wxStatusBarBase and the derived
classes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61624 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

13 files changed:
include/wx/generic/statusbr.h
include/wx/msw/statusbar.h
include/wx/osx/statusbr.h
include/wx/palmos/statusbr.h
include/wx/statusbr.h
include/wx/univ/statusbr.h
interface/wx/statusbr.h
src/common/statbar.cpp
src/generic/statusbr.cpp
src/msw/statusbar.cpp
src/osx/carbon/statbrma.cpp
src/palmos/statbrpalm.cpp
src/univ/statusbr.cpp

index 8568f88cd423e4bdac65b7a97005438895fef7ba..6b49e345d78ac27d694bba9cf963f4d60f9244de 100644 (file)
@@ -44,20 +44,9 @@ public:
                 long style = wxSTB_DEFAULT_STYLE,
                 const wxString& name = wxStatusBarNameStr);
 
-    // Create status line
-    virtual void SetFieldsCount(int number = 1,
-                                const int *widths = (const int *) NULL);
-
-    // Set status line text
-    virtual void SetStatusText(const wxString& text, int number = 0);
-
-    // Set status line widths
+    // implement base class methods
     virtual void SetStatusWidths(int n, const int widths_field[]);
-
-    // Get the position and size of the field's internal bounding rectangle
     virtual bool GetFieldRect(int i, wxRect& rect) const;
-
-    // sets the minimal vertical size of the status bar
     virtual void SetMinHeight(int height);
 
     virtual int GetBorderX() const { return m_borderX; }
@@ -68,8 +57,10 @@ public:
 
     int GetFieldFromPoint(const wxPoint& point) const;
 
-protected:      // event handlers
+protected:
+    virtual void DoUpdateStatusText(int number);
 
+    // event handlers
     void OnPaint(wxPaintEvent& event);
     void OnSize(wxSizeEvent& event);
 
index 4d148481b541568bf10d38ad090d6b4cc86e497f..14e65d47af2d13c22287e640f0ccff84775529ad 100644 (file)
@@ -40,28 +40,17 @@ public:
 
     virtual ~wxStatusBar();
 
-    // a status line can have several (<256) fields numbered from 0
+    // implement base class methods
     virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
-
-    // each field of status line has it's own text
-    virtual void SetStatusText(const wxString& text, int number = 0);
-
-    // set status line fields' widths
     virtual void SetStatusWidths(int n, const int widths_field[]);
-
-    // set status line fields' styles
     virtual void SetStatusStyles(int n, const int styles[]);
-
-    // sets the minimal vertical size of the status bar
     virtual void SetMinHeight(int height);
-
-    // get the position and size of the field's internal bounding rectangle
     virtual bool GetFieldRect(int i, wxRect& rect) const;
 
-    // get the border size
     virtual int GetBorderX() const;
     virtual int GetBorderY() const;
 
+    // override some wxWindow virtual methods too
     virtual bool SetFont(const wxFont& font);
 
     virtual WXLRESULT MSWWindowProc(WXUINT nMsg,
@@ -69,9 +58,8 @@ public:
                                     WXLPARAM lParam);
 
 protected:
-    void CopyFieldsWidth(const int widths[]);
-    void SetFieldsWidth();
-    void UpdateFieldText(int nField);
+    // implement base class pure virtual method
+    virtual void DoUpdateStatusText(int number);
 
     // override some base class virtuals
     virtual wxSize DoGetBestSize() const;
@@ -81,7 +69,10 @@ protected:
     virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result);
 #endif
 
-    // used by UpdateFieldText
+    // implementation of the public SetStatusWidths()
+    void MSWUpdateFieldsWidths();
+
+    // used by DoUpdateStatusText()
     wxClientDC *m_pDC;
 
     // the tooltips used when wxSTB_SHOW_TIPS is given
index f2630b862a179810191e611623a0ed48ce85bf6c..184bb7a4b2b9c041aad2ef0e9e14e26267c67a92 100644 (file)
@@ -31,13 +31,13 @@ class WXDLLIMPEXP_CORE wxStatusBarMac : public wxStatusBarGeneric
     virtual void DrawFieldText(wxDC& dc, const wxRect& rc, int i, int textHeight);
     virtual void DrawField(wxDC& dc, int i, int textHeight);
 
-    virtual void SetStatusText(const wxString& text, int number = 0);
-
     // Implementation
     virtual void MacHiliteChanged();
     void OnPaint(wxPaintEvent& event);
 
 protected:
+    virtual void DoUpdateStatusText(int number = 0);
+
     DECLARE_EVENT_TABLE()
 };
 
index 273dbb928bccf099d56bdc80be4719c299514bef..1a866993cd093e82f274340a470d9ffa6fb3ff02 100644 (file)
@@ -41,26 +41,19 @@ public:
     // a status line can have several (<256) fields numbered from 0
     virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
 
-    // each field of status line has it's own text
-    virtual void     SetStatusText(const wxString& text, int number = 0);
-    virtual wxString GetStatusText(int number = 0) const;
-
-    // set status line fields' widths
+    // implement base class methods
     virtual void SetStatusWidths(int n, const int widths_field[]);
-
-    // sets the minimal vertical size of the status bar
     virtual void SetMinHeight(int height);
-
-    // get the position and size of the field's internal bounding rectangle
     virtual bool GetFieldRect(int i, wxRect& rect) const;
 
-    // get the border size
     virtual int GetBorderX() const;
     virtual int GetBorderY() const;
 
     void DrawStatusBar();
 
 protected:
+    virtual void DoUpdateStatusText(int nField);
+
     void CopyFieldsWidth(const int widths[]);
     void SetFieldsWidth();
 /*
index 19d2d3a8f55803b9143f8eb6f40153fdbce17c3a..aaaba6607c1cde3ad72eca7ea85a337c83bc8467 100644 (file)
@@ -52,41 +52,51 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusBarNameStr[];
 
 class WXDLLIMPEXP_CORE wxStatusBarPane
 {
-    // only wxStatusBarBase can access our internal members and modify them:
-    friend class WXDLLIMPEXP_FWD_CORE wxStatusBarBase;
-
 public:
     wxStatusBarPane(int style = wxSB_NORMAL, size_t width = 0)
         : m_nStyle(style), m_nWidth(width)
-        { m_arrStack.Add(wxEmptyString); m_bEllipsized=false; }
+        { m_bEllipsized = false; }
+
+    int GetWidth() const { return m_nWidth; }
+    int GetStyle() const { return m_nStyle; }
+    wxString GetText() const { return m_text; }
 
-    int GetWidth() const
-        { return m_nWidth; }
-    int GetStyle() const
-        { return m_nStyle; }
 
-    const wxArrayString& GetStack() const
-        { return m_arrStack; }
+    // implementation-only from now on
+    // -------------------------------
 
-    // implementation-only getter:
     bool IsEllipsized() const
         { return m_bEllipsized; }
+    void SetIsEllipsized(bool isEllipsized) { m_bEllipsized = isEllipsized; }
 
-    // NOTE: there are no setters in wxStatusBarPane;
-    //       use wxStatusBar functions to modify a wxStatusBarPane
+    void SetWidth(int width) { m_nWidth = width; }
+    void SetStyle(int style) { m_nStyle = style; }
 
-protected:
+    // set text, return true if it changed or false if it was already set to
+    // this value
+    bool SetText(const wxString& text);
+
+    // save the existing text on top of our stack and make the new text
+    // current; return true if the text really changed
+    bool PushText(const wxString& text);
+
+    // restore the message saved by the last call to Push() (unless it was
+    // changed by an intervening call to SetText()) and return true if we
+    // really restored anything
+    bool PopText();
+
+private:
     int m_nStyle;
-    int m_nWidth;     // the width maybe negative, indicating a variable-width field
+    int m_nWidth;     // may be negative, indicating a variable-width field
+    wxString m_text;
 
-    // this is the array of the stacked strings of this pane; note that this
-    // stack does include also the string currently displayed in this pane
-    // as the version stored in the native status bar control is possibly
-    // ellipsized; note that m_arrStack.Last() is the top of the stack
-    // (i.e. the string shown in the status bar)
+    // the array used to keep the previous values of this pane after a
+    // PushStatusText() call, its top element is the value to restore after the
+    // next PopStatusText() call while the currently shown value is always in
+    // m_text
     wxArrayString m_arrStack;
 
-    // was the m_arrStack.Last() string shown in the status bar control ellipsized?
+    // is the currently shown value shown with ellipsis in the status bar?
     bool m_bEllipsized;
 };
 
@@ -114,15 +124,12 @@ public:
     // field text
     // ----------
 
-    // NOTE: even if it is not pure virtual, SetStatusText() must be overloaded by
-    //       the derived classes to update the given text in the native control
-    virtual void SetStatusText(const wxString& text, int number = 0)
-        { m_panes[number].GetStack().Last() = text; }
-    virtual wxString GetStatusText(int number = 0) const
-        { return m_panes[number].GetStack().Last(); }
-    const wxArrayString& GetStatusStack(int n) const
-        { return m_panes[n].GetStack(); }
+    // just change or get the currently shown text
+    void SetStatusText(const wxString& text, int number = 0);
+    wxString GetStatusText(int number = 0) const;
 
+    // change the currently shown text to the new one and save the current
+    // value to be restored by the next call to PopStatusText()
     void PushStatusText(const wxString& text, int number = 0);
     void PopStatusText(int number = 0);
 
@@ -183,6 +190,10 @@ public:
     virtual bool CanBeOutsideClientArea() const { return true; }
 
 protected:
+    // called after the status bar pane text changed and should update its
+    // display
+    virtual void DoUpdateStatusText(int number) = 0;
+
 
     // wxWindow overrides:
 
@@ -193,8 +204,7 @@ protected:
                          "Do not set tooltip(s) manually when using wxSTB_SHOW_TIPS!");
             wxWindow::DoSetToolTip(tip);
         }
-#endif
-
+#endif // wxUSE_TOOLTIPS
     virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
 
 
@@ -203,10 +213,10 @@ protected:
     // calculate the real field widths for the given total available size
     wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const;
 
-    // an internal utility used to keep track of which panes have labels
-    // which were last rendered as ellipsized...
-    void SetEllipsizedFlag(int n, bool ellipsized)
-        { m_panes[n].m_bEllipsized = ellipsized; }
+    // should be called to remember if the pane text is currently being show
+    // ellipsized or not
+    void SetEllipsizedFlag(int n, bool isEllipsized);
+
 
     // the array with the pane infos:
     wxStatusBarPaneArray m_panes;
index f9ee1261b1781d39c8e6f7703c63bc2cce8b69a7..52dc440acf564057085ecc3acea3efddb7b7f2fc 100644 (file)
@@ -40,20 +40,13 @@ public:
                 long style = wxSTB_DEFAULT_STYLE,
                 const wxString& name = wxPanelNameStr);
 
-    // set field count/widths
+    // implement base class methods
     virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
     virtual void SetStatusWidths(int n, const int widths[]);
 
-    // get/set the text of the given field
-    virtual void SetStatusText(const wxString& text, int number = 0);
-
-    // Get the position and size of the field's internal bounding rectangle
     virtual bool GetFieldRect(int i, wxRect& rect) const;
-
-    // sets the minimal vertical size of the status bar
     virtual void SetMinHeight(int height);
 
-    // get the dimensions of the horizontal and vertical borders
     virtual int GetBorderX() const;
     virtual int GetBorderY() const;
 
@@ -62,6 +55,8 @@ public:
         { return const_cast<wxStatusBar*>(this); }
 
 protected:
+    virtual void DoUpdateStatusText(int i);
+
     // recalculate the field widths
     void OnSize(wxSizeEvent& event);
 
@@ -87,9 +82,6 @@ protected:
     // get the rect for this field without ani side effects (see code)
     wxRect DoGetFieldRect(int n) const;
 
-    // refresh the given field
-    void RefreshField(int i);
-
     // common part of all ctors
     void Init();
 
index 4e99cdfecc9cddbb9dd97234303df9ddd081d4ba..10ac248b5b573302c844412c6b43cabfcc617cbf 100644 (file)
@@ -35,15 +35,9 @@ public:
     int GetStyle() const;
 
     /**
-        Returns the stack of strings pushed on this pane.
-
-        Note that this stack does include also the string currently displayed in this pane
-        as the version stored in the native status bar control is possibly ellipsized.
-
-        Also note that GetStack().Last() is the top of the stack (i.e. the string shown
-        in the status bar).
-    */
-    const wxArrayString& GetStack() const;
+        Returns the text currently shown in this pane.
+     */
+    wxString GetText() const;
 };
 
 /**
@@ -177,14 +171,6 @@ public:
     */
     virtual wxString GetStatusText(int i = 0) const;
 
-    /**
-        Returns the stack of strings pushed (see PushStatusText()) on the
-        @a n-th field.
-
-        See wxStatusBarPane::GetStack() for more info.
-    */
-    const wxArrayString& GetStatusStack(int n) const;
-
     /**
         Returns the width of the @a n-th field.
 
@@ -200,16 +186,21 @@ public:
     int GetStatusStyle(int n) const;
 
     /**
-        Sets the field text to the top of the stack, and pops the stack of saved
-        strings.
+        Restores the text to the value it had before the last call to
+        PushStatusText().
+
+        Notice that if SetStatusText() had been called in the meanwhile,
+        PopStatusText() will not change the text, i.e. it does not override
+        explicit changes to status text but only restores the saved text if it
+        hadn't been changed since.
 
         @see PushStatusText()
     */
     void PopStatusText(int field = 0);
 
     /**
-        Saves the current field text in a per-field stack, and sets the field text
-        to the string passed as argument.
+        Saves the current field text in a per-field stack, and sets the field
+        text to the string passed as argument.
 
         @see PopStatusText()
     */
@@ -254,9 +245,12 @@ public:
     /**
         Sets the status text for the @a i-th field.
 
-        The given text will replace the current text. Note that unlike PushStatusText()
-        this function won't save the current text (and calling PopStatusText() won't
-        restore it!).
+        The given text will replace the current text.
+
+        Note that if PushStatusText() had been called before the new text will
+        also replace the last saved value to make sure that the next call to
+        PopStatusText() doesn't restore the old value, which was overwritten by
+        the call to this function.
 
         @param text
             The text to be set. Use an empty string ("") to clear the field.
index c2dc115f02e5982ce78e3bac3f94f3c1d9249655..1faad5d0e3b51753e255be619df1634970399b13 100644 (file)
 
 const char wxStatusBarNameStr[] = "statusBar";
 
+// ============================================================================
+// 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;
+}
 
 // ============================================================================
 // wxStatusBarBase implementation
@@ -104,7 +172,7 @@ void wxStatusBarBase::SetStatusWidths(int WXUNUSED_UNLESS_DEBUG(n),
     else
     {
         for ( size_t i = 0; i < m_panes.GetCount(); i++ )
-            m_panes[i].m_nWidth = widths[i];
+            m_panes[i].SetWidth(widths[i]);
 
         m_bSameWidthForAllPanes = false;
     }
@@ -121,7 +189,7 @@ void wxStatusBarBase::SetStatusStyles(int WXUNUSED_UNLESS_DEBUG(n),
     wxASSERT_MSG( (size_t)n == m_panes.GetCount(), wxT("field number mismatch") );
 
     for ( size_t i = 0; i < m_panes.GetCount(); i++ )
-        m_panes[i].m_nStyle = styles[i];
+        m_panes[i].SetStyle(styles[i]);
 
     // update the display after the widths changed
     Refresh();
@@ -186,48 +254,54 @@ wxArrayInt wxStatusBarBase::CalculateAbsWidths(wxCoord widthTotal) const
 }
 
 // ----------------------------------------------------------------------------
-// status text stacks
+// setting/getting status text
+// ----------------------------------------------------------------------------
+
+void wxStatusBarBase::SetStatusText(const wxString& text, int number)
+{
+    wxCHECK_RET( (unsigned)number < m_panes.size(),
+                    "invalid status bar field index" );
+
+    if ( m_panes[number].SetText(text) )
+        DoUpdateStatusText(number);
+}
+
+wxString wxStatusBarBase::GetStatusText(int number) const
+{
+    wxCHECK_MSG( (unsigned)number < m_panes.size(), wxString(),
+                    "invalid status bar field index" );
+
+    return m_panes[number].GetText();
+}
+
+void wxStatusBarBase::SetEllipsizedFlag(int number, bool isEllipsized)
+{
+    wxCHECK_RET( (unsigned)number < m_panes.size(),
+                    "invalid status bar field index" );
+
+    m_panes[number].SetIsEllipsized(isEllipsized);
+}
+
+// ----------------------------------------------------------------------------
+// pushing/popping status text
 // ----------------------------------------------------------------------------
 
 void wxStatusBarBase::PushStatusText(const wxString& text, int number)
 {
-    // save the new text (in non-ellipsized form) in the stack
-    m_panes[number].m_arrStack.push_back(text);
-
-    SetStatusText(text, number);
-        // update current status text (which will possibly be ellipsized)
-        // also in the native control
-
-    // SetStatusText() typically has an optimization built-in to avoid flickering
-    // which won't refresh the status bar pane if the current top of the stack
-    // is identic to the text passed to that function.
-    // Since this optimization however cannot detect push/pop operations on the stack
-    // we need to explicitely refresh the status bar pane ourselves:
-    wxRect rect;
-    GetFieldRect(number, rect);
-    Refresh(true, &rect);
-    Update();
+    wxCHECK_RET( (unsigned)number < m_panes.size(),
+                    "invalid status bar field index" );
+
+    if ( m_panes[number].PushText(text) )
+        DoUpdateStatusText(number);
 }
 
 void wxStatusBarBase::PopStatusText(int number)
 {
-    wxASSERT_MSG(m_panes[number].m_arrStack.GetCount() > 1,
-                 "can't pop any further string");
-
-    // the top of the stack is the status text currently shown in the native control;
-    // remove it
-    m_panes[number].m_arrStack.pop_back();
-
-    // restore the previous status text in the native control
-    const wxString& text = m_panes[number].m_arrStack.back();
-    SetStatusText(text, number);
-
-    // see comment in wxStatusBarBase::PushStatusText about why we need to explicitely
-    // refresh the status bar pane
-    wxRect rect;
-    GetFieldRect(number, rect);
-    Refresh(true, &rect);
-    Update();
+    wxCHECK_RET( (unsigned)number < m_panes.size(),
+                    "invalid status bar field index" );
+
+    if ( m_panes[number].PopText() )
+        DoUpdateStatusText(number);
 }
 
 #endif // wxUSE_STATUSBAR
index e41f988488d71f31f97de2ee7678a36f0cc4256c..3169ef6612d816934227a9459a3a2ab3ee42e88a 100644 (file)
@@ -160,35 +160,17 @@ wxSize wxStatusBarGeneric::DoGetBestSize() const
     return wxSize(width, height);
 }
 
-void wxStatusBarGeneric::SetFieldsCount(int number, const int *widths)
+void wxStatusBarGeneric::DoUpdateStatusText(int number)
 {
-    wxASSERT_MSG( number >= 0, wxT("negative number of fields in wxStatusBar?") );
-
-    // this will result in a call to SetStatusWidths() and thus an update to our
-    // m_widthsAbs cache
-    wxStatusBarBase::SetFieldsCount(number, widths);
-}
-
-void wxStatusBarGeneric::SetStatusText(const wxString& text, int number)
-{
-    wxCHECK_RET( (number >= 0) && ((size_t)number < m_panes.GetCount()),
-                 wxT("invalid status bar field index") );
-
-    wxString oldText = GetStatusText(number);
-    if (oldText != text)
-    {
-        wxStatusBarBase::SetStatusText(text, number);
-
-        wxRect rect;
-        GetFieldRect(number, rect);
+    wxRect rect;
+    GetFieldRect(number, rect);
 
-        Refresh(true, &rect);
+    Refresh(true, &rect);
 
-        // it's common to show some text in the status bar before starting a
-        // relatively lengthy operation, ensure that the text is shown to the
-        // user immediately and not after the lengthy operation end
-        Update();
-    }
+    // it's common to show some text in the status bar before starting a
+    // relatively lengthy operation, ensure that the text is shown to the
+    // user immediately and not after the lengthy operation end
+    Update();
 }
 
 void wxStatusBarGeneric::SetStatusWidths(int n, const int widths_field[])
index 72da7d99804357920c2ddddc48891320ff8a2cd8..8b588197574f18527fe5ed0010067913014b13f5 100644 (file)
@@ -126,7 +126,7 @@ bool wxStatusBar::Create(wxWindow *parent,
     SetFieldsCount(1);
     SubclassWin(m_hWnd);
 
-    // cache the DC instance used by UpdateFieldText:
+    // cache the DC instance used by DoUpdateStatusText:
     // NOTE: create the DC before calling InheritAttributes() since
     //       it may result in a call to our SetFont()
     m_pDC = new wxClientDC(this);
@@ -182,7 +182,7 @@ void wxStatusBar::SetFieldsCount(int nFields, const int *widths)
 
     wxStatusBarBase::SetFieldsCount(nFields, widths);
 
-    SetFieldsWidth();
+    MSWUpdateFieldsWidths();
 
     // keep in synch also our m_tooltips array
 
@@ -204,10 +204,10 @@ void wxStatusBar::SetStatusWidths(int n, const int widths[])
 {
     wxStatusBarBase::SetStatusWidths(n, widths);
 
-    SetFieldsWidth();
+    MSWUpdateFieldsWidths();
 }
 
-void wxStatusBar::SetFieldsWidth()
+void wxStatusBar::MSWUpdateFieldsWidths()
 {
     if ( m_panes.IsEmpty() )
         return;
@@ -243,26 +243,10 @@ void wxStatusBar::SetFieldsWidth()
     delete [] pWidths;
 
 
-    // FIXME: we may want to call UpdateFieldText() here since we may need to (de)ellipsize status texts
+    // FIXME: we may want to call DoUpdateStatusText() here since we may need to (de)ellipsize status texts
 }
 
-void wxStatusBar::SetStatusText(const wxString& strText, int nField)
-{
-    wxCHECK_RET( (nField >= 0) && ((size_t)nField < m_panes.GetCount()),
-                 "invalid statusbar field index" );
-
-    if ( strText == GetStatusText(nField) )
-    {
-        // don't call StatusBar_SetText() to avoid flicker
-        return;
-    }
-
-    wxStatusBarBase::SetStatusText(strText, nField);
-
-    UpdateFieldText(nField);
-}
-
-void wxStatusBar::UpdateFieldText(int nField)
+void wxStatusBar::DoUpdateStatusText(int nField)
 {
     if (!m_pDC)
         return;
@@ -482,7 +466,7 @@ void wxStatusBar::DoMoveWindow(int x, int y, int width, int height)
     }
 
     // adjust fields widths to the new size
-    SetFieldsWidth();
+    MSWUpdateFieldsWidths();
 
     // we have to trigger wxSizeEvent if there are children window in status
     // bar because GetFieldRect returned incorrect (not updated) values up to
@@ -580,7 +564,7 @@ wxStatusBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
     if ( nMsg == WM_SIZE && needsEllipsization )
     {
         for (int i=0; i<GetFieldsCount(); i++)
-            UpdateFieldText(i);
+            DoUpdateStatusText(i);
             // re-set the field text, in case we need to ellipsize
             // (or de-ellipsize) some parts of it
     }
index 3898d12d56fb57daa47b869fe161cd9fd4c0a5f7..a23e9180ac3b4412bf8ac3dd4decca7685ab3aad 100644 (file)
@@ -102,19 +102,8 @@ void wxStatusBarMac::DrawField(wxDC& dc, int i, int textHeight)
     DrawFieldText(dc, rect, i, textHeight);
 }
 
-void wxStatusBarMac::SetStatusText(const wxString& text, int number)
+void wxStatusBarMac::DoUpdateStatusText(int number)
 {
-    // NOTE: seems this function is identic to wxStatusBarGeneric::SetStatusText;
-    //       probably can be removed without problems (FM)
-
-    wxCHECK_RET( (number >= 0) && ((size_t)number < m_panes.GetCount()),
-        wxT("invalid status bar field index") );
-
-    if ( GetStatusText(number) == text )
-        return;
-
-    wxStatusBarGeneric::SetStatusText(text, number);
-
     wxRect rect;
     GetFieldRect(number, rect);
 
index 8c0b2f03cb0fce748318e8e9f44e7c20d051805e..ff3ea0af13413aece1a4783e9d22f1fe104218ed 100644 (file)
@@ -127,24 +127,12 @@ void wxStatusBarPalm::SetFieldsWidth()
     DeleteStatusBuffer();
 }
 
-void wxStatusBarPalm::SetStatusText(const wxString& strText, int nField)
+void wxStatusBarPalm::DoUpdateStatusText(int nField)
 {
-    wxCHECK_RET( (nField >= 0) && (nField < m_nFields),
-                 wxT("invalid statusbar field index") );
-
     SetStatusBufferText(strText,nField);
     DrawStatusBar();
 }
 
-wxString wxStatusBarPalm::GetStatusText(int nField) const
-{
-    wxCHECK_MSG( (nField >= 0) && (nField < m_nFields), wxEmptyString,
-                 wxT("invalid statusbar field index") );
-
-    wxString text;
-    return text;
-}
-
 void wxStatusBarPalm::DrawStatusBar()
 {
 #if 0
index 4a1d7203ed7a164b36d1795618ea86aedf1cc546..ac0dbc3fa9a29661fefcf8bb47e4a0a6768c2d81 100644 (file)
@@ -141,7 +141,7 @@ void wxStatusBarUniv::DoDraw(wxControlRenderer *renderer)
     }
 }
 
-void wxStatusBarUniv::RefreshField(int i)
+void wxStatusBarUniv::DoUpdateStatusText(int i)
 {
     wxRect rect;
     if ( GetFieldRect(i, rect) )
@@ -150,27 +150,6 @@ void wxStatusBarUniv::RefreshField(int i)
     }
 }
 
-// ----------------------------------------------------------------------------
-// fields text
-// ----------------------------------------------------------------------------
-
-void wxStatusBarUniv::SetStatusText(const wxString& text, int number)
-{
-    wxCHECK_RET( number >= 0 && (size_t)number < m_panes.GetCount(),
-                 wxT("invalid status bar field index in SetStatusText()") );
-
-    if ( text == GetStatusText(number) )
-    {
-        // nothing changed
-        return;
-    }
-
-    wxStatusBarBase::SetStatusText(text, number);
-
-    RefreshField(number);
-}
-
-
 // ----------------------------------------------------------------------------
 // fields count/widths
 // ----------------------------------------------------------------------------