Added Auto-size cols option to the View menu

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7404 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Bedward
2000-05-16 03:25:16 +00:00
parent 015e85cdf7
commit 5b0d059b3e
2 changed files with 11 additions and 1 deletions

View File

@@ -72,6 +72,7 @@ BEGIN_EVENT_TABLE( GridFrame, wxFrame )
EVT_MENU( ID_TOGGLECOLSIZING, GridFrame::ToggleColSizing ) EVT_MENU( ID_TOGGLECOLSIZING, GridFrame::ToggleColSizing )
EVT_MENU( ID_TOGGLEGRIDSIZING, GridFrame::ToggleGridSizing ) EVT_MENU( ID_TOGGLEGRIDSIZING, GridFrame::ToggleGridSizing )
EVT_MENU( ID_TOGGLEGRIDLINES, GridFrame::ToggleGridLines ) EVT_MENU( ID_TOGGLEGRIDLINES, GridFrame::ToggleGridLines )
EVT_MENU( ID_AUTOSIZECOLS, GridFrame::AutoSizeCols )
EVT_MENU( ID_SETLABELCOLOUR, GridFrame::SetLabelColour ) EVT_MENU( ID_SETLABELCOLOUR, GridFrame::SetLabelColour )
EVT_MENU( ID_SETLABELTEXTCOLOUR, GridFrame::SetLabelTextColour ) EVT_MENU( ID_SETLABELTEXTCOLOUR, GridFrame::SetLabelTextColour )
EVT_MENU( ID_ROWLABELHORIZALIGN, GridFrame::SetRowLabelHorizAlignment ) EVT_MENU( ID_ROWLABELHORIZALIGN, GridFrame::SetRowLabelHorizAlignment )
@@ -131,7 +132,7 @@ GridFrame::GridFrame()
viewMenu->Append( ID_TOGGLECOLSIZING, "C&ol drag-resize", "", TRUE ); viewMenu->Append( ID_TOGGLECOLSIZING, "C&ol drag-resize", "", TRUE );
viewMenu->Append( ID_TOGGLEGRIDSIZING, "&Grid drag-resize", "", TRUE ); viewMenu->Append( ID_TOGGLEGRIDSIZING, "&Grid drag-resize", "", TRUE );
viewMenu->Append( ID_TOGGLEGRIDLINES, "&Grid Lines", "", TRUE ); viewMenu->Append( ID_TOGGLEGRIDLINES, "&Grid Lines", "", TRUE );
viewMenu->Append( ID_AUTOSIZECOLS, "&Auto-size cols" );
wxMenu *rowLabelMenu = new wxMenu; wxMenu *rowLabelMenu = new wxMenu;
@@ -355,6 +356,13 @@ void GridFrame::ToggleGridLines( wxCommandEvent& WXUNUSED(ev) )
} }
void GridFrame::AutoSizeCols( wxCommandEvent& WXUNUSED(ev) )
{
grid->AutoSizeColumns();
grid->Refresh();
}
void GridFrame::SetLabelColour( wxCommandEvent& WXUNUSED(ev) ) void GridFrame::SetLabelColour( wxCommandEvent& WXUNUSED(ev) )
{ {
wxColourDialog dlg( NULL ); wxColourDialog dlg( NULL );

View File

@@ -41,6 +41,7 @@ class GridFrame : public wxFrame
void ToggleColSizing( wxCommandEvent& ); void ToggleColSizing( wxCommandEvent& );
void ToggleGridSizing( wxCommandEvent& ); void ToggleGridSizing( wxCommandEvent& );
void ToggleGridLines( wxCommandEvent& ); void ToggleGridLines( wxCommandEvent& );
void AutoSizeCols( wxCommandEvent& );
void SetLabelColour( wxCommandEvent& ); void SetLabelColour( wxCommandEvent& );
void SetLabelTextColour( wxCommandEvent& ); void SetLabelTextColour( wxCommandEvent& );
void SetRowLabelHorizAlignment( wxCommandEvent& ); void SetRowLabelHorizAlignment( wxCommandEvent& );
@@ -90,6 +91,7 @@ public:
ID_TOGGLECOLSIZING, ID_TOGGLECOLSIZING,
ID_TOGGLEGRIDSIZING, ID_TOGGLEGRIDSIZING,
ID_TOGGLEGRIDLINES, ID_TOGGLEGRIDLINES,
ID_AUTOSIZECOLS,
ID_SETLABELCOLOUR, ID_SETLABELCOLOUR,
ID_SETLABELTEXTCOLOUR, ID_SETLABELTEXTCOLOUR,
ID_ROWLABELALIGN, ID_ROWLABELALIGN,