From 3b69a038c847478881d8b3dade92781524a4cb03 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 20 Oct 2017 10:45:04 -0400 Subject: [PATCH] Add ShuttleGui functions to make simple book controls... ... analogous to StartNotebook() and EndNotebook() This will be needed to rewrite export dialogs --- src/ShuttleGui.cpp | 26 ++++++++++++++++++++++++-- src/ShuttleGui.h | 6 ++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index 3aaa4bcd9..cdec607bb 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -107,6 +107,7 @@ for registering for changes. #include #include #include +#include #include #include #include @@ -977,12 +978,33 @@ void ShuttleGuiBase::EndNotebook() } +wxSimplebook * ShuttleGuiBase::StartSimplebook() +{ + UseUpId(); + if( mShuttleMode != eIsCreating ) + return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxSimplebook); + wxSimplebook * pNotebook; + mpWind = pNotebook = safenew wxSimplebook(GetParent(), + miId, wxDefaultPosition, wxDefaultSize, GetStyle( 0 )); + SetProportions( 1 ); + UpdateSizers(); + mpParent = pNotebook; + return pNotebook; +} + +void ShuttleGuiBase::EndSimplebook() +{ + //PopSizer(); + mpParent = mpParent->GetParent(); +} + + wxNotebookPage * ShuttleGuiBase::StartNotebookPage( const wxString & Name ) { if( mShuttleMode != eIsCreating ) return NULL; // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx); - wxNotebook * pNotebook = (wxNotebook*)mpParent; + auto pNotebook = static_cast< wxBookCtrlBase* >( mpParent ); wxNotebookPage * pPage = safenew wxPanelWrapper(GetParent()); pPage->SetName(Name); @@ -1004,7 +1026,7 @@ void ShuttleGuiBase::StartNotebookPage( const wxString & Name, wxNotebookPage * if( mShuttleMode != eIsCreating ) return; // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx); - wxNotebook * pNotebook = (wxNotebook*)mpParent; + auto pNotebook = static_cast< wxBookCtrlBase* >( mpParent ); // wxNotebookPage * pPage = safenew wxPanelWrapper(GetParent()); pPage->Create( mpParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, wxT("panel")); pPage->SetName(Name); diff --git a/src/ShuttleGui.h b/src/ShuttleGui.h index 054238e8d..9f047f7d8 100644 --- a/src/ShuttleGui.h +++ b/src/ShuttleGui.h @@ -58,6 +58,7 @@ class wxTreeCtrl; class wxTextCtrl; class wxSlider; class wxNotebook; +class wxSimplebook; typedef wxWindow wxNotebookPage; // so far, any window can be a page class wxButton; class wxBitmapButton; @@ -360,11 +361,16 @@ public: wxNotebook * StartNotebook(); void EndNotebook(); + wxSimplebook * StartSimplebook(); + void EndSimplebook(); + + // Use within any kind of book control: // IDs of notebook pages cannot be chosen by the caller wxNotebookPage * StartNotebookPage( const wxString & Name ); void StartNotebookPage( const wxString & Name, wxNotebookPage * pPage ); void EndNotebookPage(); + wxPanel * StartInvisiblePanel(); void EndInvisiblePanel();