Merge branch 'simplify-imagelist'
Merge Mac-specific and generic wxImageList versions and modernize the code. See https://github.com/wxWidgets/wxWidgets/pull/1001
This commit is contained in:
@@ -10,10 +10,11 @@
|
||||
#ifndef _WX_IMAGLISTG_H_
|
||||
#define _WX_IMAGLISTG_H_
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/vector.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxDC;
|
||||
class WXDLLIMPEXP_FWD_CORE wxBitmap;
|
||||
class WXDLLIMPEXP_FWD_CORE wxIcon;
|
||||
class WXDLLIMPEXP_FWD_CORE wxColour;
|
||||
|
||||
@@ -21,23 +22,23 @@ class WXDLLIMPEXP_FWD_CORE wxColour;
|
||||
class WXDLLIMPEXP_CORE wxGenericImageList: public wxObject
|
||||
{
|
||||
public:
|
||||
wxGenericImageList() { m_width = m_height = 0; }
|
||||
wxGenericImageList() { }
|
||||
wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 );
|
||||
virtual ~wxGenericImageList();
|
||||
bool Create( int width, int height, bool mask = true, int initialCount = 1 );
|
||||
bool Create();
|
||||
|
||||
virtual int GetImageCount() const;
|
||||
virtual bool GetSize( int index, int &width, int &height ) const;
|
||||
virtual wxSize GetSize() const { return wxSize(m_width, m_height); }
|
||||
virtual wxSize GetSize() const { return m_size; }
|
||||
|
||||
int Add( const wxBitmap& bitmap );
|
||||
int Add( const wxBitmap& bitmap, const wxBitmap& mask );
|
||||
int Add( const wxBitmap& bitmap, const wxColour& maskColour );
|
||||
wxBitmap GetBitmap(int index) const;
|
||||
wxIcon GetIcon(int index) const;
|
||||
bool Replace( int index, const wxBitmap &bitmap );
|
||||
bool Replace( int index, const wxBitmap &bitmap, const wxBitmap& mask );
|
||||
bool Replace( int index,
|
||||
const wxBitmap& bitmap,
|
||||
const wxBitmap& mask = wxNullBitmap );
|
||||
bool Remove( int index );
|
||||
bool RemoveAll();
|
||||
|
||||
@@ -45,13 +46,21 @@ public:
|
||||
int flags = wxIMAGELIST_DRAW_NORMAL,
|
||||
bool solidBackground = false);
|
||||
|
||||
// Internal use only
|
||||
const wxBitmap *GetBitmapPtr(int index) const;
|
||||
private:
|
||||
wxObjectList m_images;
|
||||
#if WXWIN_COMPATIBILITY_3_0
|
||||
wxDEPRECATED_MSG("Don't use this overload: it's not portable and does nothing")
|
||||
bool Create() { return true; }
|
||||
|
||||
int m_width;
|
||||
int m_height;
|
||||
wxDEPRECATED_MSG("Use GetBitmap() instead")
|
||||
const wxBitmap *GetBitmapPtr(int index) const { return DoGetPtr(index); }
|
||||
#endif // WXWIN_COMPATIBILITY_3_0
|
||||
|
||||
private:
|
||||
const wxBitmap *DoGetPtr(int index) const;
|
||||
|
||||
wxVector<wxBitmap> m_images;
|
||||
|
||||
// Size of a single bitmap in the list.
|
||||
wxSize m_size;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericImageList);
|
||||
};
|
||||
|
@@ -41,16 +41,11 @@ enum
|
||||
#define wxIMAGELIST_DRAW_SELECTED 0x0004
|
||||
#define wxIMAGELIST_DRAW_FOCUSED 0x0008
|
||||
|
||||
#if defined(__WXMSW__) || defined(__WXMAC__)
|
||||
#define wxHAS_NATIVE_IMAGELIST
|
||||
#endif
|
||||
|
||||
#if !defined(wxHAS_NATIVE_IMAGELIST)
|
||||
#include "wx/generic/imaglist.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/imaglist.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/osx/imaglist.h"
|
||||
#define wxHAS_NATIVE_IMAGELIST
|
||||
#else
|
||||
#include "wx/generic/imaglist.h"
|
||||
#endif
|
||||
|
||||
#endif // _WX_IMAGLIST_H_BASE_
|
||||
|
@@ -1,60 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/imaglist.h
|
||||
// Purpose:
|
||||
// Author: Robert Roebling, Stefan Csomor
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling and Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_IMAGLIST_H_
|
||||
#define _WX_IMAGLIST_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/icon.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxDC;
|
||||
class WXDLLIMPEXP_FWD_CORE wxBitmap;
|
||||
class WXDLLIMPEXP_FWD_CORE wxColour;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxImageList: public wxObject
|
||||
{
|
||||
public:
|
||||
wxImageList() { m_width = m_height = 0; }
|
||||
wxImageList( int width, int height, bool mask = true, int initialCount = 1 );
|
||||
virtual ~wxImageList();
|
||||
bool Create( int width, int height, bool mask = true, int initialCount = 1 );
|
||||
bool Create();
|
||||
|
||||
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 );
|
||||
int Add( const wxBitmap& bitmap, const wxColour& maskColour );
|
||||
wxBitmap GetBitmap(int index) const;
|
||||
wxIcon GetIcon(int index) const;
|
||||
bool Replace( int index, const wxIcon &bitmap );
|
||||
bool Replace( int index, const wxBitmap &bitmap );
|
||||
bool Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask );
|
||||
bool Remove( int index );
|
||||
bool RemoveAll();
|
||||
|
||||
virtual bool Draw(int index, wxDC& dc, int x, int y,
|
||||
int flags = wxIMAGELIST_DRAW_NORMAL,
|
||||
bool solidBackground = false);
|
||||
|
||||
private:
|
||||
wxList m_images;
|
||||
|
||||
int m_width;
|
||||
int m_height;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxImageList);
|
||||
};
|
||||
|
||||
#endif // _WX_IMAGLIST_H_
|
||||
|
Reference in New Issue
Block a user