Fix usage of wxWithImages::Images in wxTreebook

This commit is contained in:
Alexander Koshelev
2022-02-22 17:17:22 +01:00
committed by Vadim Zeitlin
parent c3b232dcfd
commit ca1eefdba2
2 changed files with 10 additions and 11 deletions

View File

@@ -132,14 +132,14 @@ public:
virtual int SetSelection(size_t n) wxOVERRIDE { return DoSetSelection(n, SetSelection_SendEvent); }
virtual int ChangeSelection(size_t n) wxOVERRIDE { return DoSetSelection(n); }
virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE;
virtual void SetImageList(wxImageList *imageList) wxOVERRIDE;
virtual void AssignImageList(wxImageList *imageList);
virtual bool DeleteAllPages() wxOVERRIDE;
protected:
// Implementation of a page removal. See DeletPage for comments.
wxTreebookPage *DoRemovePage(size_t pos) wxOVERRIDE;
virtual void OnImagesChanged() wxOVERRIDE;
// This subclass of wxBookCtrlBase accepts NULL page pointers (empty pages)
virtual bool AllowNullPage() const wxOVERRIDE { return true; }
virtual wxWindow *TryGetNonNullPage(size_t page) wxOVERRIDE;

View File

@@ -564,16 +564,15 @@ wxWindow *wxTreebook::TryGetNonNullPage(size_t n)
return page;
}
void wxTreebook::SetImageList(wxImageList *imageList)
void wxTreebook::OnImagesChanged()
{
wxBookCtrlBase::SetImageList(imageList);
GetTreeCtrl()->SetImageList(imageList);
}
void wxTreebook::AssignImageList(wxImageList *imageList)
{
wxBookCtrlBase::AssignImageList(imageList);
GetTreeCtrl()->SetImageList(imageList);
// Propagate the images to the tree control which will actually use them.
wxTreeCtrl* const tree = GetTreeCtrl();
const Images& images = GetImages();
if ( !images.empty() )
tree->SetImages(images);
else
tree->SetImageList(GetImageList());
}
// ----------------------------------------------------------------------------