X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1dc17bcafb89b0bde0406e692df79111c197d38e..11e3c6ef36393fb5863ea2f9601d8facd73acb12:/samples/grid/griddemo.cpp diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index dc0f993dfa..f10c12a51c 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -211,6 +211,11 @@ BEGIN_EVENT_TABLE( GridFrame, wxFrame ) EVT_MENU( ID_SIZE_LABELS_ROW, GridFrame::AutoSizeLabelsRow ) EVT_MENU( ID_SIZE_GRID, GridFrame::AutoSizeTable ) + EVT_MENU( ID_HIDECOL, GridFrame::HideCol ) + EVT_MENU( ID_SHOWCOL, GridFrame::ShowCol ) + EVT_MENU( ID_HIDEROW, GridFrame::HideRow ) + EVT_MENU( ID_SHOWROW, GridFrame::ShowRow ) + EVT_MENU( ID_SET_HIGHLIGHT_WIDTH, GridFrame::OnSetHighlightWidth) EVT_MENU( ID_SET_RO_HIGHLIGHT_WIDTH, GridFrame::OnSetROHighlightWidth) @@ -293,7 +298,10 @@ GridFrame::GridFrame() viewMenu->AppendCheckItem(ID_AUTOSIZECOLS, "&Auto-size cols"); viewMenu->AppendCheckItem(ID_CELLOVERFLOW, "&Overflow cells"); viewMenu->AppendCheckItem(ID_RESIZECELL, "&Resize cell (7,1)"); - + viewMenu->Append(ID_HIDECOL, "&Hide column A"); + viewMenu->Append(ID_SHOWCOL, "&Show column A"); + viewMenu->Append(ID_HIDEROW, "&Hide row 2"); + viewMenu->Append(ID_SHOWROW, "&Show row 2"); wxMenu *rowLabelMenu = new wxMenu; viewMenu->Append( ID_ROWLABELALIGN, wxT("R&ow label alignment"), @@ -444,6 +452,9 @@ GridFrame::GridFrame() grid->SetCellValue( 0, 5, wxT("Press\nCtrl+arrow\nto skip over\ncells") ); grid->SetRowSize( 99, 60 ); + grid->SetCellValue(98, 98, "Test background colour setting"); + grid->SetCellBackgroundColour(98, 99, wxColour(255, 127, 127)); + grid->SetCellBackgroundColour(99, 98, wxColour(255, 127, 127)); grid->SetCellValue( 99, 99, wxT("Ctrl+End\nwill go to\nthis cell") ); grid->SetCellValue( 1, 0, wxT("This default cell will overflow into neighboring cells, but not if you turn overflow off.")); @@ -465,6 +476,7 @@ GridFrame::GridFrame() grid->SetCellRenderer(3, 0, new wxGridCellBoolRenderer); grid->SetCellEditor(3, 0, new wxGridCellBoolEditor); + grid->SetCellBackgroundColour(3, 0, wxColour(255, 127, 127)); wxGridCellAttr *attr; attr = new wxGridCellAttr; @@ -988,6 +1000,7 @@ void GridFrame::AutoSizeLabelsRow(wxCommandEvent& WXUNUSED(event)) void GridFrame::AutoSizeTable(wxCommandEvent& WXUNUSED(event)) { grid->AutoSize(); + Layout(); } @@ -2304,3 +2317,23 @@ void GridFrame::OnRenderPaint( wxPaintEvent& event ) m_gridBitmap.GetHeight(), &memDc, 0, 0 ); } + +void GridFrame::HideCol( wxCommandEvent& WXUNUSED(event) ) +{ + grid->HideCol(0); +} + +void GridFrame::ShowCol( wxCommandEvent& WXUNUSED(event) ) +{ + grid->ShowCol(0); +} + +void GridFrame::HideRow( wxCommandEvent& WXUNUSED(event) ) +{ + grid->HideRow(1); +} + +void GridFrame::ShowRow( wxCommandEvent& WXUNUSED(event) ) +{ + grid->ShowRow(1); +}