X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e421922f90186d0619a806d277a0a2182e61b5fb..31a06b07cce898a22d0ca3992501e85da9c22f13:/src/msw/notebook.cpp diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index dc4f4d5d4c..379f7dea9f 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -110,7 +110,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) // common part of all ctors void wxNotebook::Init() { - m_bOwnsImageList = FALSE; m_imageList = NULL; m_nSelection = -1; } @@ -162,7 +161,7 @@ bool wxNotebook::Create(wxWindow *parent, 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) @@ -173,9 +172,7 @@ bool wxNotebook::Create(wxWindow *parent, tabStyle |= TCS_VERTICAL|TCS_RIGHT; - if ( !MSWCreate(GetId(), GetParent(), WC_TABCONTROL, - this, NULL, pos.x, pos.y, size.x, size.y, - tabStyle, NULL, 0) ) + if ( !MSWCreateControl(WC_TABCONTROL, tabStyle, pos, size) ) { return FALSE; } @@ -188,21 +185,13 @@ bool wxNotebook::Create(wxWindow *parent, if ( parent != NULL ) parent->AddChild(this); - SubclassWin(m_hWnd); - return TRUE; } -// dtor -wxNotebook::~wxNotebook() -{ - if (m_bOwnsImageList) - delete m_imageList; -} - // ---------------------------------------------------------------------------- // wxNotebook accessors // ---------------------------------------------------------------------------- + int wxNotebook::GetPageCount() const { // consistency check @@ -276,21 +265,12 @@ bool wxNotebook::SetPageImage(int nPage, int nImage) 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; } // ---------------------------------------------------------------------------- @@ -342,7 +322,7 @@ bool wxNotebook::DeletePage(int nPage) 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 @@ -358,13 +338,12 @@ bool wxNotebook::DeletePage(int nPage) // 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