From 34416d75076758dfa415c02a25260a593f227699 Mon Sep 17 00:00:00 2001
From: Pavel Kalugin
Date: Tue, 4 Sep 2018 18:20:34 +0300
Subject: [PATCH] Add corner label orientation toggle to grid sample
---
samples/grid/griddemo.cpp | 22 ++++++++++++++++++++++
samples/grid/griddemo.h | 2 ++
2 files changed, 24 insertions(+)
diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp
index 7918859965..52fac38477 100644
--- a/samples/grid/griddemo.cpp
+++ b/samples/grid/griddemo.cpp
@@ -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 );
diff --git a/samples/grid/griddemo.h b/samples/grid/griddemo.h
index 680614af3d..c9ce9b924e 100644
--- a/samples/grid/griddemo.h
+++ b/samples/grid/griddemo.h
@@ -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,