]> git.saurik.com Git - wxWidgets.git/commitdiff
wxStatusBarGeneric::DoGetBestSize
authorRobin Dunn <robin@alldunn.com>
Wed, 7 Apr 2004 21:48:24 +0000 (21:48 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 7 Apr 2004 21:48:24 +0000 (21:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/statusbr.h
src/generic/statusbr.cpp

index 364c1b3d0b013d1e806829b559e9d7fa94dbafe4..5fc9df0a9257797b0437f387c55c3248916c68da 100644 (file)
@@ -119,6 +119,8 @@ protected:
   wxPen             m_mediumShadowPen;
   wxPen             m_hilightPen;
 
+  virtual wxSize DoGetBestSize() const;
+
 private:
   DECLARE_EVENT_TABLE()
   DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarGeneric)
index 55eb58cc4f1338b64176025cf865e2c43d8bca1d..c12bce49e7d37b1a45b6e38b3a92177a900dfab7 100644 (file)
@@ -109,6 +109,24 @@ bool wxStatusBarGeneric::Create(wxWindow *parent,
   return TRUE;
 }
 
+
+wxSize wxStatusBarGeneric::DoGetBestSize() const
+{
+    int width, height;
+
+    // best width is the width of the parent
+    GetParent()->GetClientSize(&width, NULL);
+
+    // best height is as calculated above in Create
+    wxClientDC dc((wxWindow*)this);
+    dc.SetFont(GetFont());
+    wxCoord y;
+    dc.GetTextExtent(_T("X"), NULL, &y );
+    height = (int)( (11*y)/10 + 2*GetBorderY());
+
+    return wxSize(width, height);
+}    
+
 void wxStatusBarGeneric::SetFieldsCount(int number, const int *widths)
 {
     wxASSERT_MSG( number >= 0, _T("negative number of fields in wxStatusBar?") );