diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index d8c775988c..7918859965 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -172,6 +172,8 @@ wxBEGIN_EVENT_TABLE( GridFrame, wxFrame ) EVT_MENU( ID_ROWLABELVERTALIGN, GridFrame::SetRowLabelVertAlignment ) EVT_MENU( ID_COLLABELHORIZALIGN, GridFrame::SetColLabelHorizAlignment ) EVT_MENU( ID_COLLABELVERTALIGN, GridFrame::SetColLabelVertAlignment ) + EVT_MENU( ID_CORNERLABELHORIZALIGN, GridFrame::SetCornerLabelHorizAlignment ) + EVT_MENU( ID_CORNERLABELVERTALIGN, GridFrame::SetCornerLabelVertAlignment ) EVT_MENU( ID_GRIDLINECOLOUR, GridFrame::SetGridLineColour ) EVT_MENU( ID_INSERTROW, GridFrame::InsertRow ) EVT_MENU( ID_INSERTCOL, GridFrame::InsertCol ) @@ -322,6 +324,14 @@ GridFrame::GridFrame() colLabelMenu->AppendRadioItem( ID_COLLABELHORIZALIGN, wxT("&Horizontal") ); colLabelMenu->AppendRadioItem( ID_COLLABELVERTALIGN, wxT("&Vertical") ); + wxMenu *cornerLabelMenu = new wxMenu; + viewMenu->Append( ID_CORNERLABELALIGN, wxT("Corner label alignment"), + cornerLabelMenu, + wxT("Change alignment of corner label") ); + + cornerLabelMenu->AppendRadioItem( ID_CORNERLABELHORIZALIGN, wxT("&Horizontal") ); + cornerLabelMenu->AppendRadioItem( ID_CORNERLABELVERTALIGN, wxT("&Vertical") ); + wxMenu *colHeaderMenu = new wxMenu; viewMenu->Append( ID_ROWLABELALIGN, wxT("Col header style"), @@ -922,6 +932,54 @@ void GridFrame::SetColLabelVertAlignment( wxCommandEvent& WXUNUSED(ev) ) } +void GridFrame::SetCornerLabelHorizAlignment( wxCommandEvent& WXUNUSED(ev) ) +{ + int horiz, vert; + grid->GetCornerLabelAlignment( &horiz, &vert ); + + switch ( horiz ) + { + case wxALIGN_LEFT: + horiz = wxALIGN_CENTRE; + break; + + case wxALIGN_CENTRE: + horiz = wxALIGN_RIGHT; + break; + + case wxALIGN_RIGHT: + horiz = wxALIGN_LEFT; + break; + } + + grid->SetCornerLabelAlignment( horiz, vert ); +} + + +void GridFrame::SetCornerLabelVertAlignment( wxCommandEvent& WXUNUSED(ev) ) +{ + int horiz, vert; + grid->GetCornerLabelAlignment( &horiz, &vert ); + + switch ( vert ) + { + case wxALIGN_TOP: + vert = wxALIGN_CENTRE; + break; + + case wxALIGN_CENTRE: + vert = wxALIGN_BOTTOM; + break; + + case wxALIGN_BOTTOM: + vert = wxALIGN_TOP; + break; + } + + grid->SetCornerLabelAlignment( horiz, vert ); +} + + void GridFrame::SetGridLineColour( wxCommandEvent& WXUNUSED(ev) ) { wxColourDialog dlg( NULL ); diff --git a/samples/grid/griddemo.h b/samples/grid/griddemo.h index 6d3e60667c..680614af3d 100644 --- a/samples/grid/griddemo.h +++ b/samples/grid/griddemo.h @@ -54,6 +54,8 @@ class GridFrame : public wxFrame void SetRowLabelVertAlignment( wxCommandEvent& ); void SetColLabelHorizAlignment( wxCommandEvent& ); void SetColLabelVertAlignment( wxCommandEvent& ); + void SetCornerLabelHorizAlignment( wxCommandEvent& ); + void SetCornerLabelVertAlignment( wxCommandEvent& ); void SetGridLineColour( wxCommandEvent& ); void SetCellFgColour(wxCommandEvent &); @@ -153,6 +155,9 @@ public: ID_COLLABELALIGN, ID_COLLABELHORIZALIGN, ID_COLLABELVERTALIGN, + ID_CORNERLABELALIGN, + ID_CORNERLABELHORIZALIGN, + ID_CORNERLABELVERTALIGN, ID_COLDEFAULTHEADER, ID_COLNATIVEHEADER, ID_COLCUSTOMHEADER,