49 bool aShowOpenFolder,
const wxString& aAuxiliaryAction,
50 const wxSize& aInitialSize ) :
51 DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, aInitialSize,
52 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
58 wxBoxSizer* mainSizer =
new wxBoxSizer( wxVERTICAL );
59 SetSizer( mainSizer );
62 mainSizer->Add(
m_infoBar, 0, wxEXPAND, 0 );
64 WX_PANEL* treebookPanel =
new WX_PANEL(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
65 wxBORDER_NONE | wxTAB_TRAVERSAL );
66 treebookPanel->
SetBorders(
false,
false,
false,
true );
67 wxBoxSizer* treebookSizer =
new wxBoxSizer( wxVERTICAL );
68 treebookPanel->SetSizer( treebookSizer );
74 long treeCtrlFlags =
m_treebook->GetTreeCtrl()->GetWindowStyleFlag();
75 treeCtrlFlags = ( treeCtrlFlags & ~wxBORDER_MASK ) | wxBORDER_NONE;
76 m_treebook->GetTreeCtrl()->SetWindowStyleFlag( treeCtrlFlags );
78 treebookSizer->Add(
m_treebook, 1, wxEXPAND|wxBOTTOM, 2 );
79 mainSizer->Add( treebookPanel, 1, wxEXPAND, 0 );
85 m_resetButton =
new wxButton(
this, wxID_ANY,
_(
"Reset to Defaults" ) );
97 wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5 );
100 if( !aAuxiliaryAction.IsEmpty() )
108 wxStdDialogButtonSizer* sdbSizer =
new wxStdDialogButtonSizer();
109 wxButton* sdbSizerOK =
new wxButton(
this, wxID_OK );
110 sdbSizer->AddButton( sdbSizerOK );
111 wxButton* sdbSizerCancel =
new wxButton(
this, wxID_CANCEL );
112 sdbSizer->AddButton( sdbSizerCancel );
183 wxString lastPage = wxEmptyString;
184 wxString lastParentPage = wxEmptyString;
188 if( selected != wxNOT_FOUND )
190 lastPage =
m_treebook->GetPageText( (
unsigned) selected );
192 int parent =
m_treebook->GetPageParent( (
unsigned) selected );
194 if( parent != wxNOT_FOUND )
195 lastParentPage =
m_treebook->GetPageText( (
unsigned) parent );
222 if( !DIALOG_SHIM::TransferDataToWindow() )
228 int lastPageIndex = wxNOT_FOUND;
230 for(
size_t i = 0; i <
m_treebook->GetPageCount(); ++i )
232 if(
m_treebook->GetPageText( i ) == lastPage )
234 if( lastParentPage.IsEmpty() )
249 lastPageIndex = std::max( 0, lastPageIndex );
294 m_infoBar->ShowMessageFor( aMessage, 10000, wxICON_WARNING );
296 if( wxTextCtrl* textCtrl =
dynamic_cast<wxTextCtrl*
>( aCtrl ) )
298 textCtrl->SetSelection( -1, -1 );
299 textCtrl->SetFocus();
303 if( wxStyledTextCtrl* scintilla =
dynamic_cast<wxStyledTextCtrl*
>( aCtrl ) )
307 int pos = scintilla->PositionFromLine( aRow - 1 ) + ( aCol - 1 );
308 scintilla->GotoPos( pos );
311 scintilla->SetFocus();
315 if( wxGrid*
grid =
dynamic_cast<wxGrid*
>( aCtrl ) )
318 grid->MakeCellVisible( aRow, aCol );
319 grid->SetGridCursor( aRow, aCol );
321 grid->EnableCellEditControl(
true );
322 grid->ShowCellEditControl();
359 if(
dynamic_cast<wxTextEntry*
>( aEvent.GetEventObject() )
360 ||
dynamic_cast<wxStyledTextCtrl*
>( aEvent.GetEventObject() )
361 ||
dynamic_cast<wxListView*
>( aEvent.GetEventObject() )
362 ||
dynamic_cast<wxGrid*
>( FindFocus() ) )
368 if( aEvent.GetKeyCode() == WXK_UP )
374 if(
m_treebook->GetPage( page - 1 )->GetChildren().IsEmpty() )
375 m_treebook->SetSelection( std::max( page - 2, 0 ) );
382 else if( aEvent.GetKeyCode() == WXK_DOWN )
399 size_t page =
event.GetSelection();
402 if(
m_treebook->GetCurrentPage()->GetChildren().IsEmpty()
413 SetMinSize( wxDefaultSize );
414 wxSize
minSize = GetBestSize();
415 minSize.IncTo( FromDIP( wxSize( 600, 500 ) ) );
416 minSize.DecTo( FromDIP( wxSize( 1500, 900 ) ) );
419 wxSize currentSize = GetSize();
420 wxSize newSize = currentSize;
423 if( newSize != currentSize )
431 wxSize pageSize =
m_treebook->GetPage( page )->GetSize();
435 m_treebook->GetPage( page )->SetSize( pageSize );
439 wxSizeEvent evt( wxDefaultSize );
DIALOG_SHIM(wxWindow *aParent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER, const wxString &name=wxDialogNameStr)
virtual void onOpenPrefsDir(wxCommandEvent &aEvent)
bool TransferDataToWindow() override
PAGED_DIALOG(wxWindow *aParent, const wxString &aTitle, bool aShowReset, bool aShowOpenFolder, const wxString &aAuxiliaryAction=wxEmptyString, const wxSize &aInitialSize=wxDefaultSize)
wxButton * m_auxiliaryButton
std::vector< bool > m_macHack
wxButton * m_openPrefsDirButton
bool TransferDataFromWindow() override
void finishInitialization()
void UpdateResetButton(int aPage)
void SetInitialPage(const wxString &aPage, const wxString &aParentPage=wxEmptyString)
virtual void onPageChanging(wxBookCtrlEvent &aEvent)
virtual void onCharHook(wxKeyEvent &aEvent)
virtual void onAuxiliaryAction(wxCommandEvent &aEvent)
static PAGED_DIALOG * GetDialog(wxWindow *aWindow)
virtual void onResetButton(wxCommandEvent &aEvent)
virtual void onPageChanged(wxBookCtrlEvent &aEvent)
wxBoxSizer * m_buttonsSizer
void SetError(const wxString &aMessage, const wxString &aPageName, int aCtrlId, int aRow=-1, int aCol=-1)
std::map< wxString, wxString > g_lastPage
std::map< wxString, wxString > g_lastParentPage