]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/newgrid/griddemo.h
Added view menu items to toggle row and col drag-resizing.
[wxWidgets.git] / samples / newgrid / griddemo.h
index d586e320f290b05760ef5e9245f0aa04b56f1516..4af53be9602bd232ca96499e9d44f93f6bfda2bb 100644 (file)
@@ -37,6 +37,8 @@ class GridFrame : public wxFrame
     void ToggleRowLabels( wxCommandEvent& );
     void ToggleColLabels( wxCommandEvent& );
     void ToggleEditing( wxCommandEvent& );
+    void ToggleRowSizing( wxCommandEvent& );
+    void ToggleColSizing( wxCommandEvent& );
     void SetLabelColour( wxCommandEvent& );
     void SetLabelTextColour( wxCommandEvent& );
     void SetRowLabelHorizAlignment( wxCommandEvent& );
@@ -79,6 +81,8 @@ public:
         ID_TOGGLEROWLABELS = 100,
         ID_TOGGLECOLLABELS,
         ID_TOGGLEEDIT,
+        ID_TOGGLEROWSIZING,
+        ID_TOGGLECOLSIZING,
         ID_SETLABELCOLOUR,
         ID_SETLABELTEXTCOLOUR,
         ID_ROWLABELALIGN,
@@ -121,6 +125,24 @@ public:
 // memory
 // ----------------------------------------------------------------------------
 
+class SimpleTable : public wxGridStringTable {
+public:
+    SimpleTable( int numRows, int numCols )
+        : wxGridStringTable( numRows, numCols ) {}
+
+    // override this to fake a row as all bools
+    wxString GetTypeName( int row, int col )
+        {
+            if (row == 8)
+                return wxT("bool");
+            else if (row == 9 && col == 1)
+                return wxT("unknown type");  // to test fallback
+            else
+                return wxGridStringTable::GetTypeName(row, col);
+        }
+
+};
+
 class BigGridTable : public wxGridTableBase
 {
 public:
@@ -128,7 +150,6 @@ public:
 
     long GetNumberRows() { return m_sizeGrid; }
     long GetNumberCols() { return m_sizeGrid; }
-
     wxString GetValue( int row, int col )
     {
         return wxString::Format("(%d, %d)", row, col);