Added view menu items to toggle row and col drag-resizing.

Removed setting of cell background colour for the moment.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6199 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Bedward
2000-02-22 04:06:58 +00:00
parent 6e8524b11b
commit dd16fdaeaa
2 changed files with 24 additions and 3 deletions

View File

@@ -68,6 +68,8 @@ BEGIN_EVENT_TABLE( GridFrame, wxFrame )
EVT_MENU( ID_TOGGLEROWLABELS, GridFrame::ToggleRowLabels )
EVT_MENU( ID_TOGGLECOLLABELS, GridFrame::ToggleColLabels )
EVT_MENU( ID_TOGGLEEDIT, GridFrame::ToggleEditing )
EVT_MENU( ID_TOGGLEROWSIZING, GridFrame::ToggleRowSizing )
EVT_MENU( ID_TOGGLECOLSIZING, GridFrame::ToggleColSizing )
EVT_MENU( ID_SETLABELCOLOUR, GridFrame::SetLabelColour )
EVT_MENU( ID_SETLABELTEXTCOLOUR, GridFrame::SetLabelTextColour )
EVT_MENU( ID_ROWLABELHORIZALIGN, GridFrame::SetRowLabelHorizAlignment )
@@ -120,6 +122,8 @@ GridFrame::GridFrame()
viewMenu->Append( ID_TOGGLEROWLABELS, "&Row labels", "", TRUE );
viewMenu->Append( ID_TOGGLECOLLABELS, "&Col labels", "", TRUE );
viewMenu->Append( ID_TOGGLEEDIT, "&Editable", "", TRUE );
viewMenu->Append( ID_TOGGLEROWSIZING, "Ro&w drag-resize", "", TRUE );
viewMenu->Append( ID_TOGGLECOLSIZING, "C&ol drag-resize", "", TRUE );
wxMenu *rowLabelMenu = new wxMenu;
@@ -187,9 +191,6 @@ GridFrame::GridFrame()
//grid->CreateGrid( 100, 100 );
grid->SetTable(new SimpleTable(100, 100), TRUE);
// VZ: cell borders don't look nice otherwise :-) (for now...)
grid->SetDefaultCellBackgroundColour(wxColour(200, 200, 180));
grid->SetRowSize( 0, 60 );
grid->SetCellValue( 0, 0, "Ctrl+Home\nwill go to\nthis cell" );
@@ -260,6 +261,8 @@ void GridFrame::SetDefaults()
GetMenuBar()->Check( ID_TOGGLEROWLABELS, TRUE );
GetMenuBar()->Check( ID_TOGGLECOLLABELS, TRUE );
GetMenuBar()->Check( ID_TOGGLEEDIT, TRUE );
GetMenuBar()->Check( ID_TOGGLEROWSIZING, TRUE );
GetMenuBar()->Check( ID_TOGGLECOLSIZING, TRUE );
}
@@ -296,6 +299,20 @@ void GridFrame::ToggleEditing( wxCommandEvent& WXUNUSED(ev) )
}
void GridFrame::ToggleRowSizing( wxCommandEvent& WXUNUSED(ev) )
{
grid->EnableDragRowSize(
GetMenuBar()->IsChecked( ID_TOGGLEROWSIZING ) );
}
void GridFrame::ToggleColSizing( wxCommandEvent& WXUNUSED(ev) )
{
grid->EnableDragColSize(
GetMenuBar()->IsChecked( ID_TOGGLECOLSIZING ) );
}
void GridFrame::SetLabelColour( wxCommandEvent& WXUNUSED(ev) )
{
wxColourDialog dlg( NULL );

View 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,