added EVT_DATAVIEW_CACHE_HINT event (closes #9891)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61331 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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 EVT_DATAVIEW_CACHE_HINT() event (Trigve).
|
||||
|
||||
GTK:
|
||||
|
||||
|
@@ -754,7 +754,9 @@ public:
|
||||
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),
|
||||
@@ -769,7 +771,9 @@ public:
|
||||
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),
|
||||
@@ -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; }
|
||||
|
||||
// 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; }
|
||||
@@ -821,6 +831,8 @@ protected:
|
||||
wxVariant m_value;
|
||||
wxDataViewColumn *m_column;
|
||||
wxPoint m_pos;
|
||||
int m_cacheFrom;
|
||||
int m_cacheTo;
|
||||
|
||||
#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_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 );
|
||||
@@ -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_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)
|
||||
|
@@ -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.
|
||||
@event{EVT_DATAVIEW_CACHE_HINT(id, func)}
|
||||
Process a @c wxEVT_COMMAND_DATAVIEW_CACHE_HINT event.
|
||||
@endEventTable
|
||||
|
||||
@library{wxadv}
|
||||
@@ -2419,5 +2421,15 @@ public:
|
||||
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;
|
||||
};
|
||||
|
||||
|
@@ -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_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 );
|
||||
|
||||
|
||||
|
||||
// -------------------------------------
|
||||
// wxDataViewSpinRenderer
|
||||
// -------------------------------------
|
||||
|
@@ -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;
|
||||
// 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();
|
||||
|
Reference in New Issue
Block a user