// occupy
PostSizeEventToParent();
+#if wxUSE_TOOLTIPS
// delete existing tooltips
for (size_t i=0; i<m_tooltips.size(); i++)
{
wxDELETE(m_tooltips[i]);
}
+#endif // wxUSE_TOOLTIPS
wxDELETE(m_pDC);
}
// keep in synch also our m_tooltips array
+#if wxUSE_TOOLTIPS
// reset all current tooltips
for (size_t i=0; i<m_tooltips.size(); i++)
{
// shrink/expand the array:
m_tooltips.resize(nFields, NULL);
+#endif // wxUSE_TOOLTIPS
wxStatusBarBase::SetFieldsCount(nFields, widths);
int *pWidths = new int[count];
int nCurPos = 0;
- for ( int i = 0; i < count; i++ )
+ int i;
+ for ( i = 0; i < count; i++ )
{
nCurPos += widthsAbs[i] + extraWidth;
pWidths[i] = nCurPos;
-
- DoUpdateStatusText(i);
}
// The total width of the panes passed to Windows must be equal to the
wxLogLastError("StatusBar_SetParts");
}
+ // Now that all parts have been created, set their text.
+ for ( i = 0; i < count; i++ )
+ {
+ DoUpdateStatusText(i);
+ }
+
delete [] pWidths;
}
style = SBT_NOBORDERS;
break;
+ case wxSB_SUNKEN:
case wxSB_NORMAL:
default:
style = 0;
// 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()) )
+ if ( !StatusBar_SetText(GetHwnd(), nField | style, text.t_str()) )
{
wxLogLastError("StatusBar_SetText");
}
+#if wxUSE_TOOLTIPS
if (HasFlag(wxSTB_SHOW_TIPS))
{
wxASSERT(m_tooltips.size() == m_panes.GetCount());
//else: leave m_tooltips[nField]==NULL
}
}
+#endif // wxUSE_TOOLTIPS
}
wxStatusBar::MSWBorders wxStatusBar::MSWGetBorders() const
// into account to make sure the text drawn by user fits inside the
// pane. Notice that it's not the value returned by SB_GETBORDERS
// which, at least on this Windows 2003 system, returns {0, 2, 2}
+#if wxUSE_UXTHEME
if ( wxUxThemeEngine::GetIfActive() )
{
s_metrics.gripWidth = 20;
s_metrics.textMargin = 8;
}
else // classic/unthemed look
+#endif // wxUSE_UXTHEME
{
s_metrics.gripWidth = 18;
s_metrics.textMargin = 4;
void wxStatusBar::SetMinHeight(int height)
{
- SendMessage(GetHwnd(), SB_SETMINHEIGHT, height + 2*GetBorderY(), 0);
+ // It looks like we need to count the border twice to really make the
+ // controls taking exactly height pixels fully fit in the status bar:
+ // at least under Windows 7 the checkbox in the custom status bar of the
+ // statbar sample gets truncated otherwise.
+ height += 4*GetBorderY();
+
+ // We need to set the size and not the size to reflect the height because
+ // wxFrame uses our size and not the minimal size as it assumes that the
+ // size of a status bar never changes anyhow.
+ SetSize(-1, height);
+
+ SendMessage(GetHwnd(), SB_SETMINHEIGHT, height, 0);
// we have to send a (dummy) WM_SIZE to redraw it now
SendMessage(GetHwnd(), WM_SIZE, 0, 0);
width = 2*DEFAULT_FIELD_WIDTH;
}
- // calculate height
- int height;
- wxGetCharSize(GetHWND(), NULL, &height, GetFont());
- height = EDIT_HEIGHT_FROM_CHAR_HEIGHT(height);
- height += borders.vert;
+ // calculate height: by default it should be just big enough to show text
+ // (see SetMinHeight() for the explanation of 4 factor)
+ int height = GetCharHeight();
+ height += 4*borders.vert;
wxSize best(width, height);
CacheBestSize(best);
case wxSB_FLAT:
style = SBT_NOBORDERS;
break;
+ case wxSB_SUNKEN:
case wxSB_NORMAL:
default:
style = 0;
// 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()))
+ if (!StatusBar_SetText(GetHwnd(), style | i, text.t_str()))
{
wxLogLastError("StatusBar_SetText");
}