X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/421962befc8d6b340e9c2d6201cf73574319409d..f0f03f324281e2a2eb137f532295dc2bcaa120d3:/src/msw/statusbar.cpp?ds=sidebyside diff --git a/src/msw/statusbar.cpp b/src/msw/statusbar.cpp index c8921219cb..8b58819757 100644 --- a/src/msw/statusbar.cpp +++ b/src/msw/statusbar.cpp @@ -108,7 +108,7 @@ bool wxStatusBar::Create(wxWindow *parent, m_hWnd = CreateWindow ( STATUSCLASSNAME, - _T(""), + wxT(""), wstyle, 0, 0, 0, 0, GetHwndOf(parent), @@ -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,8 +182,8 @@ void wxStatusBar::SetFieldsCount(int nFields, const int *widths) wxStatusBarBase::SetFieldsCount(nFields, widths); - SetFieldsWidth(); - + MSWUpdateFieldsWidths(); + // keep in synch also our m_tooltips array // reset all current tooltips @@ -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; @@ -236,31 +236,17 @@ void wxStatusBar::SetFieldsWidth() } if ( !StatusBar_SetParts(GetHwnd(), m_panes.GetCount(), pWidths) ) + { wxLogLastError("StatusBar_SetParts"); + } delete [] pWidths; - // FIXME: we may want to call UpdateFieldText() 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); + // FIXME: we may want to call DoUpdateStatusText() here since we may need to (de)ellipsize status texts } -void wxStatusBar::UpdateFieldText(int nField) +void wxStatusBar::DoUpdateStatusText(int nField) { if (!m_pDC) return; @@ -309,22 +295,24 @@ void wxStatusBar::UpdateFieldText(int nField) } else { - text = wxControl::Ellipsize(text, + text = wxControl::Ellipsize(text, *m_pDC, ellmode, maxWidth, wxELLIPSIZE_EXPAND_TAB); - - // update the ellipsization status for this pane; this is used later to - // decide whether a tooltip should be shown or not for this pane + + // update the ellipsization status for this pane; this is used later to + // decide whether a tooltip should be shown or not for this pane // (if we have wxSTB_SHOW_TIPS) SetEllipsizedFlag(nField, text != GetStatusText(nField)); } - // Set the status text in the native control passing both field number and style. + // Set the status text in the native control passing both field number and style. // NOTE: MSDN library doesn't mention that nField and style have to be 'ORed' if ( !StatusBar_SetText(GetHwnd(), nField | style, text.wx_str()) ) + { wxLogLastError("StatusBar_SetText"); + } if (HasFlag(wxSTB_SHOW_TIPS)) { @@ -388,7 +376,9 @@ bool wxStatusBar::GetFieldRect(int i, wxRect& rect) const RECT r; if ( !::SendMessage(GetHwnd(), SB_GETRECT, i, (LPARAM)&r) ) + { wxLogLastError("SendMessage(SB_GETRECT)"); + } #if wxUSE_UXTHEME wxUxThemeHandle theme(const_cast(this), L"Status"); @@ -476,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 @@ -514,11 +504,13 @@ void wxStatusBar::SetStatusStyles(int n, const int styles[]) } // The SB_SETTEXT message is both used to set the field's text as well as - // the fields' styles. + // the fields' styles. // NOTE: MSDN library doesn't mention that nField and style have to be 'ORed' wxString text = GetStatusText(i); if (!StatusBar_SetText(GetHwnd(), style | i, text.wx_str())) + { wxLogLastError("StatusBar_SetText"); + } } } @@ -572,7 +564,7 @@ wxStatusBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) if ( nMsg == WM_SIZE && needsEllipsization ) { for (int i=0; i