diff --git a/include/wx/generic/imaglist.h b/include/wx/generic/imaglist.h index 3c40702483..78a0b7796f 100644 --- a/include/wx/generic/imaglist.h +++ b/include/wx/generic/imaglist.h @@ -29,6 +29,7 @@ public: virtual int GetImageCount() const; virtual bool GetSize( int index, int &width, int &height ) const; + virtual wxSize GetSize() const { return wxSize(m_width, m_height); } int Add( const wxBitmap& bitmap ); int Add( const wxBitmap& bitmap, const wxBitmap& mask ); diff --git a/include/wx/msw/imaglist.h b/include/wx/msw/imaglist.h index d0a7e45f1a..daedc31878 100644 --- a/include/wx/msw/imaglist.h +++ b/include/wx/msw/imaglist.h @@ -46,6 +46,9 @@ public: // Returns the size (same for all images) of the images in the list bool GetSize(int index, int &width, int &height) const; + // Returns the overall size + wxSize GetSize() const { return m_size; } + // Operations //////////////////////////////////////////////////////////////////////////// @@ -197,6 +200,7 @@ public: protected: WXHIMAGELIST m_hImageList; + wxSize m_size; wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxImageList); }; diff --git a/include/wx/osx/imaglist.h b/include/wx/osx/imaglist.h index 32c8f26cc1..0173832e75 100644 --- a/include/wx/osx/imaglist.h +++ b/include/wx/osx/imaglist.h @@ -30,6 +30,7 @@ public: virtual int GetImageCount() const; virtual bool GetSize( int index, int &width, int &height ) const; + virtual wxSize GetSize() const { return wxSize(m_width, m_height); } int Add( const wxIcon& bitmap ); int Add( const wxBitmap& bitmap ); diff --git a/interface/wx/imaglist.h b/interface/wx/imaglist.h index b2b7c55a0d..507a2ea913 100644 --- a/interface/wx/imaglist.h +++ b/interface/wx/imaglist.h @@ -185,6 +185,14 @@ public: */ virtual bool GetSize(int index, int& width, int& height) const; + /** + Retrieves the size of the image list as passed to Create(). + + @return the size of the image list, which may be zero if the image list + was not yet initialised. + */ + virtual wxSize GetSize() const; + /** Removes the image at the given position. */ diff --git a/src/msw/imaglist.cpp b/src/msw/imaglist.cpp index 06da2b58bf..0b216d5b39 100644 --- a/src/msw/imaglist.cpp +++ b/src/msw/imaglist.cpp @@ -70,11 +70,13 @@ static HBITMAP GetMaskForImage(const wxBitmap& bitmap, const wxBitmap& mask); wxImageList::wxImageList() { m_hImageList = 0; + m_size = wxSize(0,0); } // Creates an image list bool wxImageList::Create(int width, int height, bool mask, int initial) { + m_size = wxSize(width, height); UINT flags = 0; // as we want to be able to use 32bpp bitmaps in the image lists, we always