m_hWnd = CreateWindow
(
STATUSCLASSNAME,
- _T(""),
+ wxT(""),
wstyle,
0, 0, 0, 0,
GetHwndOf(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);
wxStatusBarBase::SetFieldsCount(nFields, widths);
- SetFieldsWidth();
-
+ MSWUpdateFieldsWidths();
+
// keep in synch also our m_tooltips array
// reset all current tooltips
{
wxStatusBarBase::SetStatusWidths(n, widths);
- SetFieldsWidth();
+ MSWUpdateFieldsWidths();
}
-void wxStatusBar::SetFieldsWidth()
+void wxStatusBar::MSWUpdateFieldsWidths()
{
if ( m_panes.IsEmpty() )
return;
}
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;
}
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))
{
RECT r;
if ( !::SendMessage(GetHwnd(), SB_GETRECT, i, (LPARAM)&r) )
+ {
wxLogLastError("SendMessage(SB_GETRECT)");
+ }
#if wxUSE_UXTHEME
wxUxThemeHandle theme(const_cast<wxStatusBar*>(this), L"Status");
}
// 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
}
// 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");
+ }
}
}
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
}