Add corner label orientation toggle to grid sample

This commit is contained in:
Pavel Kalugin
2018-09-04 18:20:34 +03:00
parent ccc93c0cd9
commit 34416d7507
2 changed files with 24 additions and 0 deletions

View File

@@ -174,6 +174,7 @@ wxBEGIN_EVENT_TABLE( GridFrame, wxFrame )
EVT_MENU( ID_COLLABELVERTALIGN, GridFrame::SetColLabelVertAlignment )
EVT_MENU( ID_CORNERLABELHORIZALIGN, GridFrame::SetCornerLabelHorizAlignment )
EVT_MENU( ID_CORNERLABELVERTALIGN, GridFrame::SetCornerLabelVertAlignment )
EVT_MENU( ID_CORNERLABELORIENTATION, GridFrame::ToggleCornerLabelOrientation )
EVT_MENU( ID_GRIDLINECOLOUR, GridFrame::SetGridLineColour )
EVT_MENU( ID_INSERTROW, GridFrame::InsertRow )
EVT_MENU( ID_INSERTCOL, GridFrame::InsertCol )
@@ -332,6 +333,8 @@ GridFrame::GridFrame()
cornerLabelMenu->AppendRadioItem( ID_CORNERLABELHORIZALIGN, wxT("&Horizontal") );
cornerLabelMenu->AppendRadioItem( ID_CORNERLABELVERTALIGN, wxT("&Vertical") );
viewMenu->Append( ID_CORNERLABELORIENTATION, wxT("Toggle corner label orientation") );
wxMenu *colHeaderMenu = new wxMenu;
viewMenu->Append( ID_ROWLABELALIGN, wxT("Col header style"),
@@ -980,6 +983,25 @@ void GridFrame::SetCornerLabelVertAlignment( wxCommandEvent& WXUNUSED(ev) )
}
void GridFrame::ToggleCornerLabelOrientation( wxCommandEvent& WXUNUSED(ev) )
{
int orientation = grid->GetCornerLabelTextOrientation();
switch(orientation)
{
case wxHORIZONTAL:
orientation = wxVERTICAL;
break;
case wxVERTICAL:
orientation = wxHORIZONTAL;
break;
}
grid->SetCornerLabelTextOrientation(orientation);
}
void GridFrame::SetGridLineColour( wxCommandEvent& WXUNUSED(ev) )
{
wxColourDialog dlg( NULL );

View File

@@ -56,6 +56,7 @@ class GridFrame : public wxFrame
void SetColLabelVertAlignment( wxCommandEvent& );
void SetCornerLabelHorizAlignment( wxCommandEvent& );
void SetCornerLabelVertAlignment( wxCommandEvent& );
void ToggleCornerLabelOrientation( wxCommandEvent& );
void SetGridLineColour( wxCommandEvent& );
void SetCellFgColour(wxCommandEvent &);
@@ -158,6 +159,7 @@ public:
ID_CORNERLABELALIGN,
ID_CORNERLABELHORIZALIGN,
ID_CORNERLABELVERTALIGN,
ID_CORNERLABELORIENTATION,
ID_COLDEFAULTHEADER,
ID_COLNATIVEHEADER,
ID_COLCUSTOMHEADER,