X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c42404a58eac2c9eb0557565a471a794c387a715..d08f23a71cc77701bb2a02da0aa96835b6d5231b:/src/msw/notebook.cpp?ds=sidebyside diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index b8ac425b2e..dbaa99823a 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -106,6 +106,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) void wxNotebook::Init() { m_pImageList = NULL; + m_bOwnsImageList = FALSE; m_nSelection = -1; } @@ -188,6 +189,7 @@ bool wxNotebook::Create(wxWindow *parent, // dtor wxNotebook::~wxNotebook() { + if (m_bOwnsImageList) delete m_pImageList; } // ---------------------------------------------------------------------------- @@ -276,10 +278,18 @@ bool wxNotebook::SetPageImage(int nPage, int nImage) void wxNotebook::SetImageList(wxImageList* imageList) { + if (m_bOwnsImageList) delete m_pImageList; m_pImageList = imageList; + m_bOwnsImageList = FALSE; TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST()); } +void wxNotebook::AssignImageList(wxImageList* imageList) +{ + SetImageList(imageList); + m_bOwnsImageList = TRUE; +} + // ---------------------------------------------------------------------------- // wxNotebook size settings // ----------------------------------------------------------------------------