// wxWindows
#ifndef WX_PRECOMP
- #include <wx/string.h>
+ #include "wx/string.h"
#endif // WX_PRECOMP
-#include <wx/log.h>
-#include <wx/imaglist.h>
-#include <wx/event.h>
-#include <wx/control.h>
-#include <wx/notebook.h>
+#include "wx/log.h"
+#include "wx/imaglist.h"
+#include "wx/event.h"
+#include "wx/control.h"
+#include "wx/notebook.h"
-#include <wx/msw/private.h>
+#include "wx/msw/private.h"
// Windows standard headers
#ifndef __WIN95__
// event table
// ----------------------------------------------------------------------------
-#if !USE_SHARED_LIBRARIES
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
-#endif
// ============================================================================
// implementation
tabStyle |= TCS_VERTICAL;
if (m_windowStyle & wxNB_RIGHT)
tabStyle |= TCS_VERTICAL|TCS_RIGHT;
-
+
if ( !MSWCreate(GetId(), GetParent(), WC_TABCONTROL,
this, NULL, pos.x, pos.y, size.x, size.y,
// no selection if the notebook became empty
m_nSelection = -1;
}
+ else
+ m_nSelection = TabCtrl_GetCurSel(m_hwnd);
+
return TRUE;
}
m_aPages.Remove(nPage);
+ if ( m_aPages.IsEmpty() )
+ m_nSelection = -1;
+ else
+ m_nSelection = TabCtrl_GetCurSel(m_hwnd);
+
return TRUE;
}
TabCtrl_DeleteAllItems(m_hwnd);
+ m_nSelection = -1;
+
return TRUE;
}
// this updates internal flag too - otherwise it will get out of sync
pPage->Show(FALSE);
+ // fit the notebook page to the tab control's display area
+ RECT rc;
+ rc.left = rc.top = 0;
+ GetSize((int *)&rc.right, (int *)&rc.bottom);
+ TabCtrl_AdjustRect(m_hwnd, FALSE, &rc);
+ pPage->SetSize(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
+
+
// some page should be selected: either this one or the first one if there is
// still no selection
int selNew = -1;
for ( size_t nPage = 0; nPage < nCount; nPage++ ) {
wxNotebookPage *pPage = m_aPages[nPage];
pPage->SetSize(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
- if ( pPage->GetAutoLayout() )
- pPage->Layout();
}
event.Skip();
int sel = event.GetOldSelection();
if ( sel != -1 )
m_aPages[sel]->Show(FALSE);
-
+
sel = event.GetSelection();
if ( sel != -1 )
{
pPage->Show(TRUE);
pPage->SetFocus();
}
-
+
m_nSelection = sel;
}