make it possible to specify the virtual table size (this makes it easier to
see that the memory taken by the grid doesn't depend on it with top) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6182 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -612,8 +612,18 @@ void GridFrame::OnQuit( wxCommandEvent& WXUNUSED(ev) )
|
|||||||
|
|
||||||
void GridFrame::OnVTable(wxCommandEvent& )
|
void GridFrame::OnVTable(wxCommandEvent& )
|
||||||
{
|
{
|
||||||
BigGridFrame* win = new BigGridFrame();
|
static long s_sizeGrid = 10000;
|
||||||
win->Show(TRUE);
|
|
||||||
|
s_sizeGrid = wxGetNumberFromUser("Size of the table to create",
|
||||||
|
"Size: ",
|
||||||
|
"wxGridDemo question",
|
||||||
|
s_sizeGrid,
|
||||||
|
0, 32000, this);
|
||||||
|
if ( s_sizeGrid != -1 )
|
||||||
|
{
|
||||||
|
BigGridFrame* win = new BigGridFrame(s_sizeGrid);
|
||||||
|
win->Show(TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -642,11 +652,11 @@ void MyGridCellRenderer::Draw(wxGrid& grid,
|
|||||||
// BigGridFrame and BigGridTable: Sample of a non-standard table
|
// BigGridFrame and BigGridTable: Sample of a non-standard table
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
BigGridFrame::BigGridFrame()
|
BigGridFrame::BigGridFrame(long sizeGrid)
|
||||||
: wxFrame(NULL, -1, "Plugin Virtual Table", wxDefaultPosition,
|
: wxFrame(NULL, -1, "Plugin Virtual Table",
|
||||||
wxSize(500, 450))
|
wxDefaultPosition, wxSize(500, 450))
|
||||||
{
|
{
|
||||||
m_grid = new wxGrid(this, -1, wxDefaultPosition, wxDefaultSize);
|
m_grid = new wxGrid(this, -1, wxDefaultPosition, wxDefaultSize);
|
||||||
m_table = new BigGridTable;
|
m_table = new BigGridTable(sizeGrid);
|
||||||
m_grid->SetTable(m_table, TRUE);
|
m_grid->SetTable(m_table, TRUE);
|
||||||
}
|
}
|
||||||
|
@@ -114,25 +114,35 @@ public:
|
|||||||
bool isSelected);
|
bool isSelected);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// demonstration of virtual table which doesn't store all of its data in
|
||||||
|
// memory
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class BigGridTable : public wxGridTableBase {
|
class BigGridTable : public wxGridTableBase
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
long GetNumberRows() { return 10000; }
|
BigGridTable(long sizeGrid) { m_sizeGrid = sizeGrid; }
|
||||||
long GetNumberCols() { return 10000; }
|
|
||||||
|
|
||||||
wxString GetValue( int row, int col ) {
|
long GetNumberRows() { return m_sizeGrid; }
|
||||||
wxString str;
|
long GetNumberCols() { return m_sizeGrid; }
|
||||||
str.Printf("(%d, %d)", row, col);
|
|
||||||
return str;
|
wxString GetValue( int row, int col )
|
||||||
|
{
|
||||||
|
return wxString::Format("(%d, %d)", row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetValue( int , int , const wxString& ) {}
|
void SetValue( int , int , const wxString& ) { /* ignore */ }
|
||||||
bool IsEmptyCell( int , int ) { return FALSE; }
|
bool IsEmptyCell( int , int ) { return FALSE; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
long m_sizeGrid;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BigGridFrame : public wxFrame {
|
class BigGridFrame : public wxFrame
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
BigGridFrame();
|
BigGridFrame(long sizeGrid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxGrid* m_grid;
|
wxGrid* m_grid;
|
||||||
@@ -140,5 +150,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif // griddemo_h
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user