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 );
176 wxString lastPage = wxEmptyString;
177 wxString lastParentPage = wxEmptyString;
181 if( selected != wxNOT_FOUND )
183 lastPage =
m_treebook->GetPageText( (
unsigned) selected );
185 int parent =
m_treebook->GetPageParent( (
unsigned) selected );
187 if( parent != wxNOT_FOUND )
188 lastParentPage =
m_treebook->GetPageText( (
unsigned) parent );
215 if( !DIALOG_SHIM::TransferDataToWindow() )
221 int lastPageIndex = wxNOT_FOUND;
223 for(
size_t i = 0; i <
m_treebook->GetPageCount(); ++i )
225 if(
m_treebook->GetPageText( i ) == lastPage )
227 if( lastParentPage.IsEmpty() )
242 lastPageIndex = std::max( 0, lastPageIndex );
287 m_infoBar->ShowMessageFor( aMessage, 10000, wxICON_WARNING );
289 if( wxTextCtrl* textCtrl =
dynamic_cast<wxTextCtrl*
>( aCtrl ) )
291 textCtrl->SetSelection( -1, -1 );
292 textCtrl->SetFocus();
296 if( wxStyledTextCtrl* scintilla =
dynamic_cast<wxStyledTextCtrl*
>( aCtrl ) )
300 int pos = scintilla->PositionFromLine( aRow - 1 ) + ( aCol - 1 );
301 scintilla->GotoPos( pos );
304 scintilla->SetFocus();
308 if( wxGrid*
grid =
dynamic_cast<wxGrid*
>( aCtrl ) )
311 grid->MakeCellVisible( aRow, aCol );
312 grid->SetGridCursor( aRow, aCol );
314 grid->EnableCellEditControl(
true );
315 grid->ShowCellEditControl();
352 if(
dynamic_cast<wxTextEntry*
>( aEvent.GetEventObject() )
353 ||
dynamic_cast<wxStyledTextCtrl*
>( aEvent.GetEventObject() )
354 ||
dynamic_cast<wxListView*
>( aEvent.GetEventObject() )
355 ||
dynamic_cast<wxGrid*
>( FindFocus() ) )
361 if( aEvent.GetKeyCode() == WXK_UP )
367 if(
m_treebook->GetPage( page - 1 )->GetChildren().IsEmpty() )
368 m_treebook->SetSelection( std::max( page - 2, 0 ) );
375 else if( aEvent.GetKeyCode() == WXK_DOWN )
392 size_t page =
event.GetSelection();
395 if(
m_treebook->GetCurrentPage()->GetChildren().IsEmpty()
406 SetMinSize( wxDefaultSize );
407 wxSize
minSize = GetBestSize();
408 minSize.IncTo( FromDIP( wxSize( 600, 500 ) ) );
409 minSize.DecTo( FromDIP( wxSize( 1500, 900 ) ) );
412 wxSize currentSize = GetSize();
413 wxSize newSize = currentSize;
416 if( newSize != currentSize )
424 wxSize pageSize =
m_treebook->GetPage( page )->GetSize();
428 m_treebook->GetPage( page )->SetSize( pageSize );
432 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