+class BigGridTable : public wxGridTableBase
+{
+public:
+ BigGridTable(long sizeGrid) { m_sizeGrid = sizeGrid; }
+
+ int GetNumberRows() { return m_sizeGrid; }
+ int GetNumberCols() { return m_sizeGrid; }
+ wxString GetValue( int row, int col )
+ {
+ return wxString::Format(wxT("(%d, %d)"), row, col);
+ }
+
+ void SetValue( int , int , const wxString& ) { /* ignore */ }
+ bool IsEmptyCell( int , int ) { return FALSE; }
+
+private:
+ long m_sizeGrid;
+};
+
+class BigGridFrame : public wxFrame
+{
+public:
+ BigGridFrame(long sizeGrid);
+
+private:
+ wxGrid* m_grid;
+ BigGridTable* m_table;
+};
+
+// ----------------------------------------------------------------------------
+// an example of custom attr provider: this one makes all odd rows appear grey
+// ----------------------------------------------------------------------------
+
+class MyGridCellAttrProvider : public wxGridCellAttrProvider
+{
+public:
+ MyGridCellAttrProvider();
+ virtual ~MyGridCellAttrProvider();
+
+ virtual wxGridCellAttr *GetAttr(int row, int col,
+ wxGridCellAttr::wxAttrKind kind) const;
+
+private:
+ wxGridCellAttr *m_attrForOddRows;
+};
+
+// ----------------------------------------------------------------------------
+// another, more realistic, grid example: shows typed columns and more
+// ----------------------------------------------------------------------------
+
+class BugsGridTable : public wxGridTableBase
+{
+public:
+ BugsGridTable();
+
+ virtual int GetNumberRows();
+ virtual int GetNumberCols();
+ virtual bool IsEmptyCell( int row, int col );
+ virtual wxString GetValue( int row, int col );
+ virtual void SetValue( int row, int col, const wxString& value );
+
+ virtual wxString GetColLabelValue( int col );
+
+ virtual wxString GetTypeName( int row, int col );
+ virtual bool CanGetValueAs( int row, int col, const wxString& typeName );
+ virtual bool CanSetValueAs( int row, int col, const wxString& typeName );
+
+ virtual long GetValueAsLong( int row, int col );
+ virtual bool GetValueAsBool( int row, int col );
+
+ virtual void SetValueAsLong( int row, int col, long value );
+ virtual void SetValueAsBool( int row, int col, bool value );
+};
+
+class BugsGridFrame : public wxFrame
+{
+public:
+ BugsGridFrame();
+};
+
+
+#endif // griddemo_h