Show images added to its wxImageList later in wxListbook again
Fix a regression in 3.1.6 which resulted in not showing any images if the associated image list was empty when it was associated with the control, as HasImages() returned false in this case and so wxLC_ICON style was not set. The fix is to return true from HasImages() if we have image list even if it is currently empty, as we can't know when (or if) it will become non-empty and it's better to assume that it will be used (as nothing really catastrophic should happen if it is not used, finally) rather than not taking into account the images added to it later. Closes #22364.
This commit is contained in:
parent
5f7d4a70c2
commit
ebf5e8813e
1 changed files with 9 additions and 2 deletions
|
|
@ -55,10 +55,17 @@ public:
|
|||
return m_imageList ? m_imageList->GetImageCount() : 0;
|
||||
}
|
||||
|
||||
// Return true if we have any images at all.
|
||||
// Return true if we are using any images.
|
||||
bool HasImages() const
|
||||
{
|
||||
return GetImageCount() != 0;
|
||||
// Note that the sole presence of the image list indicates that we're
|
||||
// using images, even if it is currently empty, because images can be
|
||||
// added to it at any moment (it's common and valid to create an image
|
||||
// list and associate it with the control first and fill it later) and
|
||||
// it's better to err on the side of having the images and not showing
|
||||
// anything if there are really none than decide that we don't have any
|
||||
// and not show those that we do have.
|
||||
return !m_images.empty() || m_imageList;
|
||||
}
|
||||
|
||||
// Sets the images to use.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue