]> git.saurik.com Git - wxWidgets.git/commitdiff
added EVT_DATAVIEW_CACHE_HINT event (closes #9891)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 5 Jul 2009 15:21:52 +0000 (15:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 5 Jul 2009 15:21:52 +0000 (15:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61331 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/dataview.h
interface/wx/dataview.h
src/common/datavcmn.cpp
src/generic/datavgen.cpp

index caedfce93e3cf6f01e06dc1ec65f2b73b0673062..b1bd83d83325a554e63ab31494126e2ecf18627d 100644 (file)
@@ -364,6 +364,7 @@ All (GUI):
 - Added wxFont::[Make]{Bold,Italic,Smaller,Larger} and Scale[d]() methods.
 - Added wxDC::CopyAttributes() and use it in wxBufferedDC.
 - Added wxTextWrapper helper class useful for wrapping lines of text.
 - Added wxFont::[Make]{Bold,Italic,Smaller,Larger} and Scale[d]() methods.
 - Added wxDC::CopyAttributes() and use it in wxBufferedDC.
 - Added wxTextWrapper helper class useful for wrapping lines of text.
+- Added EVT_DATAVIEW_CACHE_HINT() event (Trigve).
 
 GTK:
 
 
 GTK:
 
index 951653494589319a59565eb0fab3bd684657e549..25cce4838fbc25faaef587ee6c554c891382d82b 100644 (file)
@@ -754,7 +754,9 @@ public:
         m_model(NULL),
         m_value(wxNullVariant),
         m_column(NULL),
         m_model(NULL),
         m_value(wxNullVariant),
         m_column(NULL),
-        m_pos(-1,-1)
+        m_pos(-1,-1),
+        m_cacheFrom(0),
+        m_cacheTo(0)
 #if wxUSE_DRAG_AND_DROP
         , m_dataObject(NULL),
         m_dataBuffer(NULL),
 #if wxUSE_DRAG_AND_DROP
         , m_dataObject(NULL),
         m_dataBuffer(NULL),
@@ -769,7 +771,9 @@ public:
         m_model(event.m_model),
         m_value(event.m_value),
         m_column(event.m_column),
         m_model(event.m_model),
         m_value(event.m_value),
         m_column(event.m_column),
-        m_pos(m_pos)
+        m_pos(m_pos),
+        m_cacheFrom(event.m_cacheFrom),
+        m_cacheTo(event.m_cacheTo)
 #if wxUSE_DRAG_AND_DROP
         , m_dataObject(event.m_dataObject),
         m_dataFormat(event.m_dataFormat),
 #if wxUSE_DRAG_AND_DROP
         , m_dataObject(event.m_dataObject),
         m_dataFormat(event.m_dataFormat),
@@ -798,6 +802,12 @@ public:
     wxPoint GetPosition() const { return m_pos; }
     void SetPosition( int x, int y ) { m_pos.x = x; m_pos.y = y; }
 
     wxPoint GetPosition() const { return m_pos; }
     void SetPosition( int x, int y ) { m_pos.x = x; m_pos.y = y; }
 
+    // For wxEVT_COMMAND_DATAVIEW_CACHE_HINT
+    int GetCacheFrom() const { return m_cacheFrom; }
+    int GetCacheTo() const { return m_cacheTo; }
+    void SetCache(int from, int to) { m_cacheFrom = from; m_cacheTo = to; }
+
+
 #if wxUSE_DRAG_AND_DROP
     // For drag operations
     void SetDataObject( wxDataObject *obj ) { m_dataObject = obj; }
 #if wxUSE_DRAG_AND_DROP
     // For drag operations
     void SetDataObject( wxDataObject *obj ) { m_dataObject = obj; }
@@ -821,6 +831,8 @@ protected:
     wxVariant           m_value;
     wxDataViewColumn   *m_column;
     wxPoint             m_pos;
     wxVariant           m_value;
     wxDataViewColumn   *m_column;
     wxPoint             m_pos;
+    int                 m_cacheFrom;
+    int                 m_cacheTo;
 
 #if wxUSE_DRAG_AND_DROP
     wxDataObject       *m_dataObject;
 
 #if wxUSE_DRAG_AND_DROP
     wxDataObject       *m_dataObject;
@@ -853,6 +865,8 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_
 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, wxDataViewEvent );
 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED, wxDataViewEvent );
 
 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, wxDataViewEvent );
 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED, wxDataViewEvent );
 
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_CACHE_HINT, wxDataViewEvent );
+
 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG, wxDataViewEvent );
 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, wxDataViewEvent );
 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_DROP, wxDataViewEvent );
 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG, wxDataViewEvent );
 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, wxDataViewEvent );
 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_DROP, wxDataViewEvent );
@@ -883,6 +897,7 @@ typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&);
 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
 #define EVT_DATAVIEW_COLUMN_REORDERED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_REORDERED, id, fn)
 #define EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_HEADER_RIGHT_CLICK, id, fn)
 #define EVT_DATAVIEW_COLUMN_SORTED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_SORTED, id, fn)
 #define EVT_DATAVIEW_COLUMN_REORDERED(id, fn) wx__DECLARE_DATAVIEWEVT(COLUMN_REORDERED, id, fn)
+#define EVT_DATAVIEW_CACHE_HINT(id, fn) wx__DECLARE_DATAVIEWEVT(CACHE_HINT, id, fn)
 
 #define EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_BEGIN_DRAG, id, fn)
 #define EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_DROP_POSSIBLE, id, fn)
 
 #define EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_BEGIN_DRAG, id, fn)
 #define EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, fn) wx__DECLARE_DATAVIEWEVT(ITEM_DROP_POSSIBLE, id, fn)
index fcdd636a19fca325da2111b5f5c063a0788ef2e6..f7497f28d9eab5bbc9a63806b1b2b431cb82a2bd 100644 (file)
@@ -2318,6 +2318,8 @@ public:
            Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event.
     @event{EVT_DATAVIEW_ITEM_DROP(id, func)}
            Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event.
            Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event.
     @event{EVT_DATAVIEW_ITEM_DROP(id, func)}
            Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event.
+    @event{EVT_DATAVIEW_CACHE_HINT(id, func)}
+           Process a @c wxEVT_COMMAND_DATAVIEW_CACHE_HINT event.
     @endEventTable
     
     @library{wxadv}
     @endEventTable
     
     @library{wxadv}
@@ -2419,5 +2421,15 @@ public:
         Gets the data buffer for a drop data transfer.
     */
     void *GetDataBuffer() const;
         Gets the data buffer for a drop data transfer.
     */
     void *GetDataBuffer() const;
+
+    /**
+        Return the first row that will be displayed.
+    */
+    int GetCacheFrom() const;
+
+    /**
+        Return the last row that will be displayed.
+    */
+    int GetCacheTo() const;
 };
 
 };
 
index ddfbd8c7e6306a4a28f7611af10944d7c120416c..b54ad1982fc5c0ce31d61801ba37562a5702ed06 100644 (file)
@@ -1250,10 +1250,14 @@ wxDEFINE_EVENT( wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, wxDataViewEven
 wxDEFINE_EVENT( wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, wxDataViewEvent );
 wxDEFINE_EVENT( wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED, wxDataViewEvent );
 
 wxDEFINE_EVENT( wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, wxDataViewEvent );
 wxDEFINE_EVENT( wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED, wxDataViewEvent );
 
+wxDEFINE_EVENT( wxEVT_COMMAND_DATAVIEW_CACHE_HINT, wxDataViewEvent );
+
 wxDEFINE_EVENT( wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG, wxDataViewEvent );
 wxDEFINE_EVENT( wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, wxDataViewEvent );
 wxDEFINE_EVENT( wxEVT_COMMAND_DATAVIEW_ITEM_DROP, wxDataViewEvent );
 
 wxDEFINE_EVENT( wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG, wxDataViewEvent );
 wxDEFINE_EVENT( wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE, wxDataViewEvent );
 wxDEFINE_EVENT( wxEVT_COMMAND_DATAVIEW_ITEM_DROP, wxDataViewEvent );
 
+
+
 // -------------------------------------
 // wxDataViewSpinRenderer
 // -------------------------------------
 // -------------------------------------
 // wxDataViewSpinRenderer
 // -------------------------------------
index 9980dc7ab3a3aca8cb38dec097a9d9f4792d78c1..26af4a3b9c2d274377dc62a2225e16df70c50248 100644 (file)
@@ -1676,6 +1676,12 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
         wxMin( (int)(  GetLineAt( wxMax(0,update.y+update.height) ) - item_start + 1),
             (int)(GetRowCount( ) - item_start));
     unsigned int item_last = item_start + item_count;
         wxMin( (int)(  GetLineAt( wxMax(0,update.y+update.height) ) - item_start + 1),
             (int)(GetRowCount( ) - item_start));
     unsigned int item_last = item_start + item_count;
+    // Get the parent of DataViewCtrl
+    wxWindow *parent = GetParent()->GetParent();
+    wxDataViewEvent cache_event(wxEVT_COMMAND_DATAVIEW_CACHE_HINT, parent->GetId());
+    cache_event.SetEventObject(GetParent());
+    cache_event.SetCache(item_start, item_last - 1);
+    parent->ProcessWindowEvent(cache_event);
 
     // compute which columns needs to be redrawn
     unsigned int cols = GetOwner()->GetColumnCount();
 
     // compute which columns needs to be redrawn
     unsigned int cols = GetOwner()->GetColumnCount();