Added wxImageList::GetSize to retrieve the size originally passed

This commit is contained in:
JulianSmart
2015-12-13 19:16:33 +00:00
parent 57793cb6f1
commit 0484975fed
5 changed files with 16 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ public:
virtual int GetImageCount() const; virtual int GetImageCount() const;
virtual bool GetSize( int index, int &width, int &height ) 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 );
int Add( const wxBitmap& bitmap, const wxBitmap& mask ); int Add( const wxBitmap& bitmap, const wxBitmap& mask );

View File

@@ -46,6 +46,9 @@ public:
// Returns the size (same for all images) of the images in the list // Returns the size (same for all images) of the images in the list
bool GetSize(int index, int &width, int &height) const; bool GetSize(int index, int &width, int &height) const;
// Returns the overall size
wxSize GetSize() const { return m_size; }
// Operations // Operations
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
@@ -197,6 +200,7 @@ public:
protected: protected:
WXHIMAGELIST m_hImageList; WXHIMAGELIST m_hImageList;
wxSize m_size;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxImageList); wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxImageList);
}; };

View File

@@ -30,6 +30,7 @@ public:
virtual int GetImageCount() const; virtual int GetImageCount() const;
virtual bool GetSize( int index, int &width, int &height ) 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 wxIcon& bitmap );
int Add( const wxBitmap& bitmap ); int Add( const wxBitmap& bitmap );

View File

@@ -185,6 +185,14 @@ public:
*/ */
virtual bool GetSize(int index, int& width, int& height) const; 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. Removes the image at the given position.
*/ */

View File

@@ -70,11 +70,13 @@ static HBITMAP GetMaskForImage(const wxBitmap& bitmap, const wxBitmap& mask);
wxImageList::wxImageList() wxImageList::wxImageList()
{ {
m_hImageList = 0; m_hImageList = 0;
m_size = wxSize(0,0);
} }
// Creates an image list // Creates an image list
bool wxImageList::Create(int width, int height, bool mask, int initial) bool wxImageList::Create(int width, int height, bool mask, int initial)
{ {
m_size = wxSize(width, height);
UINT flags = 0; UINT flags = 0;
// as we want to be able to use 32bpp bitmaps in the image lists, we always // as we want to be able to use 32bpp bitmaps in the image lists, we always