// common part of all ctors
void wxNotebook::Init()
{
- m_bOwnsImageList = FALSE;
m_imageList = NULL;
m_nSelection = -1;
}
if ( m_windowStyle & wxTC_MULTILINE )
tabStyle |= TCS_MULTILINE;
if ( m_windowStyle & wxBORDER )
- tabStyle &= WS_BORDER;
+ tabStyle |= WS_BORDER;
if (m_windowStyle & wxNB_FIXEDWIDTH)
tabStyle |= TCS_FIXEDWIDTH ;
if (m_windowStyle & wxNB_BOTTOM)
return TRUE;
}
-// dtor
-wxNotebook::~wxNotebook()
-{
- if (m_bOwnsImageList) delete m_pImageList;
-}
-
// ----------------------------------------------------------------------------
// wxNotebook accessors
// ----------------------------------------------------------------------------
+
int wxNotebook::GetPageCount() const
{
// consistency check
void wxNotebook::SetImageList(wxImageList* imageList)
{
- if ( m_bOwnsImageList )
+ wxNotebookBase::SetImageList(imageList);
+
+ if ( imageList )
{
- delete m_imageList;
+ TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST());
}
-
- m_bOwnsImageList = FALSE;
- m_imageList = imageList;
-
- TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST());
-}
-
-void wxNotebook::AssignImageList(wxImageList* imageList)
-{
- SetImageList(imageList);
- m_bOwnsImageList = TRUE;
}
// ----------------------------------------------------------------------------
TabCtrl_DeleteItem(m_hwnd, nPage);
delete m_pages[nPage];
- m_pages.Remove(nPage);
+ m_pages.RemoveAt(nPage);
if ( m_pages.IsEmpty() ) {
// no selection if the notebook became empty
// remove one page from the notebook, without deleting
wxNotebookPage *wxNotebook::DoRemovePage(int nPage)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), NULL, wxT("notebook page out of range") );
+ wxNotebookPage *pageRemoved = wxNotebookBase::DoRemovePage(nPage);
+ if ( !pageRemoved )
+ return NULL;
TabCtrl_DeleteItem(m_hwnd, nPage);
- wxNotebookPage *pageRemoved = m_pages[nPage];
- m_pages.Remove(nPage);
-
if ( m_pages.IsEmpty() )
m_nSelection = -1;
else