X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e53b3d16de127872e39bf276f7e616b32f161645..24b4db9b0de92ef5c899b98a556f8cd09ad1fc54:/src/osx/notebook_osx.cpp?ds=sidebyside diff --git a/src/osx/notebook_osx.cpp b/src/osx/notebook_osx.cpp index 053c972bbe..d78e3b4040 100644 --- a/src/osx/notebook_osx.cpp +++ b/src/osx/notebook_osx.cpp @@ -4,7 +4,7 @@ // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: notebmac.cpp 55079 2008-08-13 14:56:42Z PC $ +// RCS-ID: $Id$ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -82,7 +82,7 @@ bool wxNotebook::Create( wxWindow *parent, return false; m_peer = wxWidgetImpl::CreateTabView(this,parent, id, pos, size, style, GetExtraStyle() ); - + MacPostControlCreate( pos, size ); return true ; @@ -282,7 +282,7 @@ bool wxNotebook::InsertPage(size_t nPage, return true; } -int wxNotebook::HitTest(const wxPoint& pt, long * flags) const +int wxNotebook::HitTest(const wxPoint& WXUNUSED(pt), long * WXUNUSED(flags)) const { int resultV = wxNOT_FOUND; #if 0 @@ -373,9 +373,21 @@ void wxNotebook::OnSize(wxSizeEvent& event) for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) { wxNotebookPage *pPage = m_pages[nPage]; - pPage->SetSize(rect); - if ( pPage->GetAutoLayout() ) - pPage->Layout(); + pPage->SetSize(rect, wxSIZE_FORCE_EVENT); + } + + // If the selected page is hidden at this point, the notebook + // has become visible for the first time after creation, and + // we postponed showing the page in ChangePage(). + // So show the selected page now. + if ( m_nSelection != -1 ) + { + wxNotebookPage *pPage = m_pages[m_nSelection]; + if ( !pPage->IsShown() ) + { + pPage->Show( true ); + pPage->SetFocus(); + } } // Processing continues to next OnSize @@ -502,15 +514,27 @@ void wxNotebook::ChangePage(int nOldSel, int nSel) if ( nSel != -1 ) { wxNotebookPage *pPage = m_pages[nSel]; - pPage->Show( true ); - pPage->SetFocus(); + if ( IsShownOnScreen() ) + { + pPage->Show( true ); + pPage->SetFocus(); + } + else + { + // Postpone Show() until the control is actually shown. + // Otherwise this forces the containing toplevel window + // to show, even if it's just being created and called + // AddPage() without intent to show the window yet. + // We Show() the selected page in our OnSize handler, + // unless it already is shown. + } } m_nSelection = nSel; m_peer->SetValue( m_nSelection + 1 ) ; } -bool wxNotebook::HandleClicked( double timestampsec ) +bool wxNotebook::OSXHandleClicked( double WXUNUSED(timestampsec) ) { bool status = false ;