我尝试使用自定义标签实现自定义 wxGrid。根据 wxwidgets 文档,需要实现 Method:SetColLabelValue 和 GetColLabelValue。遗憾的是,来自 wxGridTableBase 类的方法不会被我的代码覆盖。
#pragma once
#include <wx/grid.h>
#include <wx/string.h>
#include <wx/event.h>
#include <wx/string.h>
#include <vector>
class Grid :
public wxGrid
{
unsigned int m_rows_occupied;
std::vector<wxString> m_colLabels;
wxString* m_colLabelsArr;
public:
Grid(wxWindow* _parent,wxWindowID _ID,wxPoint _pos,wxSize _size,long _style);
~Grid(void);
void InsertValues(char* _col1,char* _col2);
void SetRow(unsigned int _row,char* _col1,char* _col2);
void SetCell(unsigned int _row,unsigned int _cell,char* _col1);
unsigned int* Size(void){return &m_rows_occupied;};
virtual void SetColLabelValue( int WXUNUSED(col), const wxString& )override;
virtual wxString GetColLabelValue(int col) override{return wxString("");};
};