]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/datavgen.cpp
No real changes, just spelling fixes to comments. Closes #15030.
[wxWidgets.git] / src / generic / datavgen.cpp
index 89bc7ebfc0142dd6ba874e26bd0e52f70d83a0b0..a640773ce3e6afbb2c95a6e0bff4025b1178e4e1 100644 (file)
@@ -678,6 +678,7 @@ public:
 
     void SetRowHeight( int lineHeight ) { m_lineHeight = lineHeight; }
     int GetRowHeight() const { return m_lineHeight; }
+    int GetDefaultRowHeight() const;
 
     // Some useful functions for row and item mapping
     wxDataViewItem GetItemByRow( unsigned int row ) const;
@@ -1398,15 +1399,7 @@ wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID i
     m_currentColSetByKeyboard = false;
     m_useCellFocus = false;
     m_currentRow = (unsigned)-1;
-
-#ifdef __WXMSW__
-    // We would like to use the same line height that Explorer uses. This is
-    // different from standard ListView control since Vista.
-    if ( wxGetWinVersion() >= wxWinVersion_Vista )
-        m_lineHeight = wxMax(16, GetCharHeight()) + 6; // 16 = mini icon height
-    else
-#endif // __WXMSW__
-        m_lineHeight = wxMax(16, GetCharHeight()) + 1; // 16 = mini icon height
+    m_lineHeight = GetDefaultRowHeight();
 
 #if wxUSE_DRAG_AND_DROP
     m_dragCount = 0;
@@ -1449,6 +1442,20 @@ wxDataViewMainWindow::~wxDataViewMainWindow()
 }
 
 
+int wxDataViewMainWindow::GetDefaultRowHeight() const
+{
+#ifdef __WXMSW__
+    // We would like to use the same line height that Explorer uses. This is
+    // different from standard ListView control since Vista.
+    if ( wxGetWinVersion() >= wxWinVersion_Vista )
+        return wxMax(16, GetCharHeight()) + 6; // 16 = mini icon height
+    else
+#endif // __WXMSW__
+        return wxMax(16, GetCharHeight()) + 1; // 16 = mini icon height
+}
+
+
+
 #if wxUSE_DRAG_AND_DROP
 bool wxDataViewMainWindow::EnableDragSource( const wxDataFormat &format )
 {
@@ -3943,10 +3950,11 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
         return;
     }
 
-    if(event.LeftDown())
+    if(event.ButtonDown())
     {
-        // Not skipping this event would prevent the system from setting focus
-        // to this window.
+        // Not skipping button down events would prevent the system from
+        // setting focus to this window as most (all?) of them do by default,
+        // so skip it to enable default handling.
         event.Skip();
     }
 
@@ -4542,6 +4550,31 @@ void wxDataViewCtrl::SetFocus()
         m_clientArea->SetFocus();
 }
 
+bool wxDataViewCtrl::SetFont(const wxFont & font)
+{
+    if (!wxControl::SetFont(font))
+        return false;
+
+    if (m_headerArea)
+        m_headerArea->SetFont(font);
+
+    if (m_clientArea)
+    {
+        m_clientArea->SetFont(font);
+        m_clientArea->SetRowHeight(m_clientArea->GetDefaultRowHeight());
+    }
+
+    if (m_headerArea || m_clientArea)
+    {
+        InvalidateColBestWidths();
+        Layout();
+    }
+
+    return true;
+}
+
+
+
 bool wxDataViewCtrl::AssociateModel( wxDataViewModel *model )
 {
     if (!wxDataViewCtrlBase::AssociateModel( model ))