1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 00:20:06 +02:00

Add ShuttleGui functions to make simple book controls...

... analogous to StartNotebook() and EndNotebook()

This will be needed to rewrite export dialogs
This commit is contained in:
Paul Licameli 2017-10-20 10:45:04 -04:00
parent 1802b9316e
commit 3b69a038c8
2 changed files with 30 additions and 2 deletions

View File

@ -107,6 +107,7 @@ for registering for changes.
#include <wx/grid.h> #include <wx/grid.h>
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/simplebook.h>
#include <wx/treectrl.h> #include <wx/treectrl.h>
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/stattext.h> #include <wx/stattext.h>
@ -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 ) wxNotebookPage * ShuttleGuiBase::StartNotebookPage( const wxString & Name )
{ {
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return NULL; return NULL;
// return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx); // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
wxNotebook * pNotebook = (wxNotebook*)mpParent; auto pNotebook = static_cast< wxBookCtrlBase* >( mpParent );
wxNotebookPage * pPage = safenew wxPanelWrapper(GetParent()); wxNotebookPage * pPage = safenew wxPanelWrapper(GetParent());
pPage->SetName(Name); pPage->SetName(Name);
@ -1004,7 +1026,7 @@ void ShuttleGuiBase::StartNotebookPage( const wxString & Name, wxNotebookPage *
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return; return;
// return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx); // return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wx);
wxNotebook * pNotebook = (wxNotebook*)mpParent; auto pNotebook = static_cast< wxBookCtrlBase* >( mpParent );
// wxNotebookPage * pPage = safenew wxPanelWrapper(GetParent()); // wxNotebookPage * pPage = safenew wxPanelWrapper(GetParent());
pPage->Create( mpParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, wxT("panel")); pPage->Create( mpParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, wxT("panel"));
pPage->SetName(Name); pPage->SetName(Name);

View File

@ -58,6 +58,7 @@ class wxTreeCtrl;
class wxTextCtrl; class wxTextCtrl;
class wxSlider; class wxSlider;
class wxNotebook; class wxNotebook;
class wxSimplebook;
typedef wxWindow wxNotebookPage; // so far, any window can be a page typedef wxWindow wxNotebookPage; // so far, any window can be a page
class wxButton; class wxButton;
class wxBitmapButton; class wxBitmapButton;
@ -360,11 +361,16 @@ public:
wxNotebook * StartNotebook(); wxNotebook * StartNotebook();
void EndNotebook(); void EndNotebook();
wxSimplebook * StartSimplebook();
void EndSimplebook();
// Use within any kind of book control:
// IDs of notebook pages cannot be chosen by the caller // IDs of notebook pages cannot be chosen by the caller
wxNotebookPage * StartNotebookPage( const wxString & Name ); wxNotebookPage * StartNotebookPage( const wxString & Name );
void StartNotebookPage( const wxString & Name, wxNotebookPage * pPage ); void StartNotebookPage( const wxString & Name, wxNotebookPage * pPage );
void EndNotebookPage(); void EndNotebookPage();
wxPanel * StartInvisiblePanel(); wxPanel * StartInvisiblePanel();
void EndInvisiblePanel(); void EndInvisiblePanel();