X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/90b903c26306d88d3920589125ea1a03664e1b22..cbc9145c04bd3ea0a228906c8363fa8f47e3acf9:/src/generic/datavgen.cpp diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 92cf52354a..7d404f3e72 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -10,6 +10,10 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + #if wxUSE_DATAVIEWCTRL #include "wx/dataview.h" @@ -17,21 +21,20 @@ #ifdef wxUSE_GENERICDATAVIEWCTRL #ifndef WX_PRECOMP + #ifdef __WXMSW__ + #include "wx/msw/wrapwin.h" + #endif #include "wx/sizer.h" #include "wx/log.h" + #include "wx/dcclient.h" + #include "wx/timer.h" + #include "wx/settings.h" #endif #include "wx/stockitem.h" -#include "wx/dcclient.h" #include "wx/calctrl.h" #include "wx/popupwin.h" #include "wx/renderer.h" -#include "wx/timer.h" -#include "wx/settings.h" - -#ifdef __WXMSW__ - #include "wx/msw/wrapwin.h" -#endif //----------------------------------------------------------------------------- // classes @@ -51,7 +54,7 @@ public: const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxString &name = wxT("wxdataviewctrlheaderwindow") ); - ~wxDataViewHeaderWindow(); + virtual ~wxDataViewHeaderWindow(); void SetOwner( wxDataViewCtrl* owner ) { m_owner = owner; } wxDataViewCtrl *GetOwner() { return m_owner; } @@ -136,7 +139,7 @@ public: const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxString &name = wxT("wxdataviewctrlmainwindow") ); - ~wxDataViewMainWindow(); + virtual ~wxDataViewMainWindow(); // notifications from wxDataViewListModel bool RowAppended(); @@ -177,7 +180,7 @@ public: int GetEndOfLastCol(); size_t GetFirstVisibleRow(); size_t GetLastVisibleRow(); - int GetRowCount(); + size_t GetRowCount(); void SelectAllRows( bool on ); void SelectRow( size_t row, bool on ); @@ -343,7 +346,7 @@ bool wxDataViewToggleCell::SetValue( const wxVariant &value ) { m_toggle = value.GetBool(); - return true;; + return true; } bool wxDataViewToggleCell::GetValue( wxVariant &WXUNUSED(value) ) @@ -460,10 +463,6 @@ public: sizer->Fit( this ); } - virtual void OnDismiss() - { - } - void OnCalendar( wxCalendarEvent &event ); wxCalendarCtrl *m_cal; @@ -471,6 +470,11 @@ public: size_t m_col; size_t m_row; +protected: + virtual void OnDismiss() + { + } + private: DECLARE_EVENT_TABLE() }; @@ -1141,10 +1145,10 @@ size_t wxDataViewMainWindow::GetLastVisibleRow() wxSize client_size = GetClientSize(); m_owner->CalcUnscrolledPosition( client_size.x, client_size.y, &client_size.x, &client_size.y ); - return wxMin( GetRowCount()-1, (client_size.y/m_lineHeight)+1 ); + return wxMin( GetRowCount()-1, ((unsigned)client_size.y/m_lineHeight)+1 ); } -int wxDataViewMainWindow::GetRowCount() +size_t wxDataViewMainWindow::GetRowCount() { return GetOwner()->GetModel()->GetNumberOfRows(); } @@ -1158,13 +1162,13 @@ void wxDataViewMainWindow::ChangeCurrentRow( size_t row ) void wxDataViewMainWindow::SelectAllRows( bool on ) { - if (GetRowCount() == 0) return; + if (IsEmpty()) + return; if (on) { m_selection.Clear(); - size_t i; - for (i = 0; i < GetRowCount(); i++) + for (size_t i = 0; i < GetRowCount(); i++) m_selection.Add( i ); Refresh(); } @@ -1277,7 +1281,8 @@ void wxDataViewMainWindow::RefreshRows( size_t from, size_t to ) void wxDataViewMainWindow::RefreshRowsAfter( size_t firstRow ) { size_t count = GetRowCount(); - if (firstRow > count) return; + if (firstRow > count) + return; wxRect rect( 0, firstRow*m_lineHeight, GetEndOfLastCol(), count * m_lineHeight ); m_owner->CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); @@ -1291,7 +1296,7 @@ void wxDataViewMainWindow::RefreshRowsAfter( size_t firstRow ) void wxDataViewMainWindow::OnArrowChar(size_t newCurrent, const wxKeyEvent& event) { - wxCHECK_RET( newCurrent < (size_t)GetRowCount(), + wxCHECK_RET( newCurrent < GetRowCount(), _T("invalid item index in OnArrowChar()") ); // if there is no selection, we cannot move it anywhere @@ -1368,7 +1373,7 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) break; case WXK_DOWN: - if ( m_currentRow < (size_t)GetRowCount() - 1 ) + if ( m_currentRow < GetRowCount() - 1 ) OnArrowChar( m_currentRow + 1, event ); break; @@ -1519,7 +1524,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) if (m_lastOnSame) { - if ((col == m_currentCol) & (current == m_currentRow) && + if ((col == m_currentCol) && (current == m_currentRow) && (cell->GetMode() == wxDATAVIEW_CELL_EDITABLE) ) { m_renameTimer->Start( 100, true );