+ wxCHECK_MSG( (nField >= 0) && (nField < m_nFields), wxEmptyString,
+ _T("invalid statusbar field index") );
+
+ wxString str;
+ int len = StatusBar_GetTextLen(GetHwnd(), nField);
+ if ( len > 0 )
+ {
+ StatusBar_GetText(GetHwnd(), nField, wxStringBuffer(str, len));
+ }
+
+ return str;
+}
+
+int wxStatusBar95::GetBorderX() const
+{
+ int aBorders[3];
+ SendMessage(GetHwnd(), SB_GETBORDERS, 0, (LPARAM)aBorders);
+
+ return aBorders[0];
+}
+
+int wxStatusBar95::GetBorderY() const
+{
+ int aBorders[3];
+ SendMessage(GetHwnd(), SB_GETBORDERS, 0, (LPARAM)aBorders);
+
+ return aBorders[1];
+}
+
+void wxStatusBar95::SetMinHeight(int height)
+{
+ SendMessage(GetHwnd(), SB_SETMINHEIGHT, height + 2*GetBorderY(), 0);
+
+ // have to send a (dummy) WM_SIZE to redraw it now
+ SendMessage(GetHwnd(), WM_SIZE, 0, 0);
+}
+
+bool wxStatusBar95::GetFieldRect(int i, wxRect& rect) const
+{
+ wxCHECK_MSG( (i >= 0) && (i < m_nFields), false,
+ _T("invalid statusbar field index") );
+
+ RECT r;
+ if ( !::SendMessage(GetHwnd(), SB_GETRECT, i, (LPARAM)&r) )
+ {
+ wxLogLastError(wxT("SendMessage(SB_GETRECT)"));
+ }
+
+#if wxUSE_UXTHEME
+ wxUxThemeHandle theme((wxStatusBar95 *)this, L"Status"); // const_cast
+ if ( theme )
+ {
+ // by default Windows has a 2 pixel border to the right of the left
+ // divider (or it could be a bug) but it looks wrong so remove it
+ if ( i != 0 )
+ {
+ r.left -= 2;
+ }
+
+ wxUxThemeEngine::Get()->GetThemeBackgroundContentRect(theme, NULL,
+ 1 /* SP_PANE */, 0,
+ &r, &r);
+ }
+#endif
+
+ wxCopyRECTToRect(r, rect);
+
+ return true;
+}
+
+// no idea for a default width, just choose something
+#define DEFAULT_FIELD_WIDTH 25
+
+wxSize wxStatusBar95::DoGetBestSize() const
+{
+ int borders[3];
+ SendMessage(GetHwnd(), SB_GETBORDERS, 0, (LPARAM)borders);
+
+ // calculate width
+ int width = 0;
+ for ( int i = 0; i < m_nFields; ++i )
+ {
+ int widthField = m_statusWidths ? m_statusWidths[i]
+ : DEFAULT_FIELD_WIDTH;
+ if ( widthField >= 0 )
+ {
+ width += m_statusWidths[i];
+ }
+ else
+ {
+ // variable width field, its width is really a proportion
+ // related to the other fields
+ width += -widthField*DEFAULT_FIELD_WIDTH;
+ }
+
+ // add the space between fields
+ width += borders[2];
+ }
+
+ if ( !width )
+ {
+ // still need something even for an empty status bar
+ width = 2*DEFAULT_FIELD_WIDTH;
+ }