From 7d229dd695a2e0034a99c54914f6cef48559cc8b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 10 Jul 2019 16:29:50 +0200 Subject: [PATCH] Allow really using wxHeaderCtrl in the grid sample The "Native" menu item actually only toggled drawing native-lookalike labels, but didn't use wxHeaderCtrl as could be expected. Rename the existing menu item to "Native-like" and add the new "Native" one which really enables the use of wxHeaderCtrl. --- samples/grid/griddemo.cpp | 13 +++++++++++++ samples/grid/griddemo.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index aaef518711..943d8ee76d 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -157,6 +157,7 @@ wxBEGIN_EVENT_TABLE( GridFrame, wxFrame ) EVT_MENU( ID_TOGGLEGRIDSIZING, GridFrame::ToggleGridSizing ) EVT_MENU( ID_TOGGLEGRIDDRAGCELL, GridFrame::ToggleGridDragCell ) EVT_MENU( ID_COLNATIVEHEADER, GridFrame::SetNativeColHeader ) + EVT_MENU( ID_COLNATIVELABELS, GridFrame::SetNativeColLabels ) EVT_MENU( ID_COLDEFAULTHEADER, GridFrame::SetDefaultColHeader ) EVT_MENU( ID_COLCUSTOMHEADER, GridFrame::SetCustomColHeader ) EVT_MENU_RANGE( ID_TAB_STOP, ID_TAB_LEAVE, GridFrame::SetTabBehaviour ) @@ -343,6 +344,7 @@ GridFrame::GridFrame() colHeaderMenu->AppendRadioItem( ID_COLDEFAULTHEADER, "&Default" ); colHeaderMenu->AppendRadioItem( ID_COLNATIVEHEADER, "&Native" ); + colHeaderMenu->AppendRadioItem( ID_COLNATIVELABELS, "Native-&like" ); colHeaderMenu->AppendRadioItem( ID_COLCUSTOMHEADER, "&Custom" ); wxMenu *tabBehaviourMenu = new wxMenu; @@ -704,6 +706,15 @@ void GridFrame::SetNativeColHeader( wxCommandEvent& WXUNUSED(ev) ) CustomColumnHeadersProvider* provider = static_cast(grid->GetTable()->GetAttrProvider()); provider->UseCustomColHeaders(false); + grid->UseNativeColHeader(true); +} + +void GridFrame::SetNativeColLabels( wxCommandEvent& WXUNUSED(ev) ) +{ + CustomColumnHeadersProvider* provider = + static_cast(grid->GetTable()->GetAttrProvider()); + provider->UseCustomColHeaders(false); + grid->UseNativeColHeader(false); grid->SetUseNativeColLabels(true); } @@ -712,6 +723,7 @@ void GridFrame::SetCustomColHeader( wxCommandEvent& WXUNUSED(ev) ) CustomColumnHeadersProvider* provider = static_cast(grid->GetTable()->GetAttrProvider()); provider->UseCustomColHeaders(true); + grid->UseNativeColHeader(false); grid->SetUseNativeColLabels(false); } @@ -720,6 +732,7 @@ void GridFrame::SetDefaultColHeader( wxCommandEvent& WXUNUSED(ev) ) CustomColumnHeadersProvider* provider = static_cast(grid->GetTable()->GetAttrProvider()); provider->UseCustomColHeaders(false); + grid->UseNativeColHeader(false); grid->SetUseNativeColLabels(false); } diff --git a/samples/grid/griddemo.h b/samples/grid/griddemo.h index 4e89135a42..c8abd6d453 100644 --- a/samples/grid/griddemo.h +++ b/samples/grid/griddemo.h @@ -39,6 +39,7 @@ class GridFrame : public wxFrame void ToggleGridSizing( wxCommandEvent& ); void ToggleGridDragCell ( wxCommandEvent& ); void SetNativeColHeader ( wxCommandEvent& ); + void SetNativeColLabels ( wxCommandEvent& ); void SetCustomColHeader( wxCommandEvent& ); void SetDefaultColHeader( wxCommandEvent& ); void SetTabBehaviour( wxCommandEvent& ); @@ -162,6 +163,7 @@ public: ID_CORNERLABELORIENTATION, ID_COLDEFAULTHEADER, ID_COLNATIVEHEADER, + ID_COLNATIVELABELS, ID_COLCUSTOMHEADER, ID_TAB_STOP, ID_TAB_WRAP,