Add OSX layout hack to PAGED_DIALOG for preferences.
This commit is contained in:
parent
4966ab802e
commit
811968716c
|
@ -78,6 +78,8 @@ PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle,
|
|||
|
||||
if( m_auxiliaryButton )
|
||||
m_auxiliaryButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PAGED_DIALOG::OnAuxiliaryAction ), nullptr, this );
|
||||
|
||||
m_treebook->Connect( wxEVT_TREEBOOK_PAGE_CHANGED, wxBookCtrlEventHandler( PAGED_DIALOG::OnPageChange ), NULL, this );
|
||||
Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PAGED_DIALOG::OnUpdateUI ), nullptr, this );
|
||||
}
|
||||
|
||||
|
@ -98,6 +100,9 @@ void PAGED_DIALOG::finishInitialization()
|
|||
m_treebook->Fit();
|
||||
m_treebook->Layout();
|
||||
|
||||
for( int i = 0; i < m_treebook->GetPageCount(); ++i )
|
||||
m_macHack.push_back( true );
|
||||
|
||||
FinishDialogSettings();
|
||||
}
|
||||
|
||||
|
@ -133,6 +138,9 @@ PAGED_DIALOG::~PAGED_DIALOG()
|
|||
|
||||
if( m_auxiliaryButton )
|
||||
m_auxiliaryButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PAGED_DIALOG::OnAuxiliaryAction ), nullptr, this );
|
||||
|
||||
m_treebook->Disconnect( wxEVT_TREEBOOK_PAGE_CHANGED, wxBookCtrlEventHandler( PAGED_DIALOG::OnPageChange ), NULL, this );
|
||||
|
||||
Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PAGED_DIALOG::OnUpdateUI ), nullptr, this );
|
||||
}
|
||||
|
||||
|
@ -266,3 +274,25 @@ void PAGED_DIALOG::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PAGED_DIALOG::OnPageChange( wxBookCtrlEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Work around an OSX bug where the wxGrid children don't get placed correctly until
|
||||
// the first resize event
|
||||
int page = event.GetSelection();
|
||||
|
||||
if( page + 1 <= m_macHack.size() && m_macHack[ page ] )
|
||||
{
|
||||
wxSize pageSize = m_treebook->GetPage( page )->GetSize();
|
||||
pageSize.x -= 3;
|
||||
pageSize.y += 2;
|
||||
|
||||
m_treebook->GetPage( page )->SetSize( pageSize );
|
||||
m_macHack[ page ] = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ private:
|
|||
int m_errorRow; // the row if m_errorCtrl is a grid
|
||||
int m_errorCol; // the column if m_errorCtrl is a grid
|
||||
|
||||
std::vector<bool> m_macHack;
|
||||
|
||||
public:
|
||||
PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle,
|
||||
const wxString& aAuxiliaryAction = wxEmptyString );
|
||||
|
@ -55,6 +57,7 @@ protected:
|
|||
|
||||
virtual void OnAuxiliaryAction( wxCommandEvent& event ) { event.Skip(); }
|
||||
void OnUpdateUI( wxUpdateUIEvent& event );
|
||||
void OnPageChange( wxBookCtrlEvent& event );
|
||||
|
||||
wxTreebook* m_treebook;
|
||||
wxButton* m_auxiliaryButton;
|
||||
|
|
Loading…
Reference in New Issue