#pragma once
|
#include <wx/wx.h>
|
#include <wx/listctrl.h>
|
#include <wx/dataview.h>
|
class MyDataViewListCtrl:public wxDataViewListCtrl{
|
private:
|
wxBitmap m_buffer;
|
public:
|
MyDataViewListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style = wxDV_ROW_LINES)
|
: wxDataViewListCtrl(parent, id, pos, size, style) {
|
// Initialize buffer with the size of the control
|
m_buffer.Create(size.GetWidth(), size.GetHeight());
|
}
|
|
void OnPaint(wxPaintEvent& event) {
|
wxPaintDC dc(this);
|
wxMemoryDC memDC;
|
memDC.SelectObject(m_buffer);
|
|
// Draw your items onto memDC instead of dc
|
// Example: DrawItems(memDC);
|
|
dc.Blit(0, 0, m_buffer.GetWidth(), m_buffer.GetHeight(), &memDC, 0, 0);
|
}
|
|
void UpdateBuffer() {
|
wxClientDC dc(this);
|
wxMemoryDC memDC;
|
memDC.SelectObject(m_buffer);
|
|
// Clear the buffer if needed
|
memDC.SetBackground(wxBrush(GetBackgroundColour()));
|
memDC.Clear();
|
|
// Redraw items onto memDC
|
// Example: RedrawItems(memDC);
|
|
// Ensure all drawing is complete
|
memDC.SelectObject(wxNullBitmap);
|
|
// Refresh the screen
|
Refresh();
|
}
|
|
void HandleDataUpdate() {
|
// Update internal data structures as needed
|
// Example: UpdateInternalData();
|
|
// Update the buffer
|
UpdateBuffer();
|
}
|
|
|
};
|