]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/listctrl.cpp
Translate the label used by the font picker dialog.
[wxWidgets.git] / src / generic / listctrl.cpp
index 4cd96c9e6acfaeceab48d19f93cfe6839df071a8..ae17c83a8a0553776824915c298389eed2fbc55f 100644 (file)
@@ -4272,7 +4272,6 @@ void wxGenericListCtrl::Init()
 
     m_mainWin = NULL;
     m_headerWin = NULL;
-    m_headerHeight = wxRendererNative::Get().GetHeaderButtonHeight(this);
 }
 
 wxGenericListCtrl::~wxGenericListCtrl()
@@ -4299,22 +4298,20 @@ void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded()
                       (
                         this, wxID_ANY, m_mainWin,
                         wxPoint(0,0),
-                        wxSize(GetClientSize().x, m_headerHeight),
+                        wxSize
+                        (
+                          GetClientSize().x,
+                          wxRendererNative::Get().GetHeaderButtonHeight(this)
+                        ),
                         wxTAB_TRAVERSAL
                       );
 
 #if defined( __WXMAC__ )
-        wxFont font;
-        font.CreateSystemFont( wxOSX_SYSTEM_FONT_SMALL );
+        static wxFont font( wxOSX_SYSTEM_FONT_SMALL );
         m_headerWin->SetFont( font );
 #endif
 
         GetSizer()->Prepend( m_headerWin, 0, wxGROW );
-#ifdef __WXOSX__
-        // TODO not tested under other platforms, remove the platform condition if
-        // it works on those as well
-        GetSizer()->SetItemMinSize( m_headerWin, wxSize(-1,m_headerHeight) ); 
-#endif
     }
     else
     {
@@ -4446,6 +4443,10 @@ void wxGenericListCtrl::SetSingleStyle( long style, bool add )
 
 void wxGenericListCtrl::SetWindowStyleFlag( long flag )
 {
+    // update the window style first so that the header is created or destroyed
+    // corresponding to the new style
+    wxWindow::SetWindowStyleFlag( flag );
+
     if (m_mainWin)
     {
         // m_mainWin->DeleteEverything();  wxMSW doesn't do that
@@ -4454,8 +4455,6 @@ void wxGenericListCtrl::SetWindowStyleFlag( long flag )
 
         GetSizer()->Layout();
     }
-
-    wxWindow::SetWindowStyleFlag( flag );
 }
 
 bool wxGenericListCtrl::GetColumn(int col, wxListItem &item) const
@@ -4592,7 +4591,7 @@ bool wxGenericListCtrl::GetSubItemRect(long item,
         return false;
 
     if ( m_mainWin->HasHeader() )
-        rect.y += m_headerHeight + 1;
+        rect.y += m_headerWin->GetSize().y + 1;
 
     return true;
 }