No changes, just use symbolic NO_IMAGE constant instead of -1 or wxNOT_FOUND.
Existing declarations used -1 in several places to indicate the absence of the image which wasn't especially clear and was also inconsistent with other places that used wxNOT_FOUND which didn't make much sense in this context. Add a new symbolic constant NO_IMAGE in wxWithImages and use it in the classes deriving from it. This still doesn't help with wx{Tree,List}Ctrl but improves clarity for the other classes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68810 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -21,6 +21,11 @@
|
||||
class WXDLLIMPEXP_CORE wxWithImages
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
NO_IMAGE = -1
|
||||
};
|
||||
|
||||
wxWithImages()
|
||||
{
|
||||
m_imageList = NULL;
|
||||
@@ -55,13 +60,13 @@ protected:
|
||||
|
||||
// Return the image with the given index from the image list.
|
||||
//
|
||||
// If there is no image list or if index == -1 (which traditionally means
|
||||
// that no image should be used for the given item), silently returns
|
||||
// If there is no image list or if index == NO_IMAGE, silently returns
|
||||
// wxNullIcon.
|
||||
wxIcon GetImage(int iconIndex) const
|
||||
{
|
||||
return m_imageList && iconIndex != -1 ? m_imageList->GetIcon(iconIndex)
|
||||
: wxNullIcon;
|
||||
return m_imageList && iconIndex != NO_IMAGE
|
||||
? m_imageList->GetIcon(iconIndex)
|
||||
: wxNullIcon;
|
||||
}
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user