+ // if we have the wxSTB_SHOW_TIPS we must set the ellipsized flag even if
+ // we don't ellipsize the text but just truncate it
+ if (HasFlag(wxSTB_SHOW_TIPS))
+ SetEllipsizedFlag(nField, m_pDC->GetTextExtent(text).GetWidth() > maxWidth);
+ }
+ else
+ {
+ text = wxControl::Ellipsize(text,
+ *m_pDC,
+ ellmode,
+ maxWidth,
+ wxELLIPSIZE_FLAGS_EXPAND_TABS);
+
+ // 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.
+ // 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))
+ {
+ wxASSERT(m_tooltips.size() == m_panes.GetCount());
+
+ if (m_tooltips[nField])
+ {
+ if (GetField(nField).IsEllipsized())
+ {
+ // update the rect of this tooltip:
+ m_tooltips[nField]->SetRect(rc);
+
+ // update also the text:
+ m_tooltips[nField]->SetTip(GetStatusText(nField));
+ }
+ else
+ {
+ // delete the tooltip associated with this pane; it's not needed anymore
+ wxDELETE(m_tooltips[nField]);
+ }
+ }
+ else
+ {
+ // create a new tooltip for this pane if needed
+ if (GetField(nField).IsEllipsized())
+ m_tooltips[nField] = new wxToolTip(this, nField, GetStatusText(nField), rc);
+ //else: leave m_tooltips[nField]==NULL
+ }