1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2000-07-15 15:51:35 -04:00
|
|
|
// Name: wx/generic/imaglist.h
|
1998-05-20 10:01:55 -04:00
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Created: 01/02/97
|
|
|
|
// Id:
|
2003-03-17 05:34:04 -05:00
|
|
|
// Copyright: (c) 1998 Robert Roebling and Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __IMAGELISTH_G__
|
|
|
|
#define __IMAGELISTH_G__
|
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1998-07-03 12:36:10 -04:00
|
|
|
#pragma interface "imaglist.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
2003-02-03 15:56:40 -05:00
|
|
|
#include "wx/list.h"
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxDC;
|
|
|
|
class WXDLLEXPORT wxBitmap;
|
|
|
|
class WXDLLEXPORT wxColour;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to
|
|
|
|
* images for their items by an index into an image list.
|
|
|
|
* A wxImageList is capable of creating images with optional masks from
|
|
|
|
* a variety of sources - a single bitmap plus a colour to indicate the mask,
|
|
|
|
* two bitmaps, or an icon.
|
|
|
|
*
|
|
|
|
* Image lists can also create and draw images used for drag and drop functionality.
|
|
|
|
* This is not yet implemented in wxImageList. We need to discuss a generic API
|
|
|
|
* for doing drag and drop and see whether it ties in with the Win95 view of it.
|
|
|
|
* See below for candidate functions and an explanation of how they might be
|
|
|
|
* used.
|
|
|
|
*/
|
|
|
|
|
2002-07-22 04:51:49 -04:00
|
|
|
#if !defined(wxIMAGELIST_DRAW_NORMAL)
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
// Flags for Draw
|
|
|
|
#define wxIMAGELIST_DRAW_NORMAL 0x0001
|
|
|
|
#define wxIMAGELIST_DRAW_TRANSPARENT 0x0002
|
|
|
|
#define wxIMAGELIST_DRAW_SELECTED 0x0004
|
|
|
|
#define wxIMAGELIST_DRAW_FOCUSED 0x0008
|
|
|
|
|
1998-07-20 14:05:48 -04:00
|
|
|
// Flag values for Set/GetImageList
|
|
|
|
enum {
|
|
|
|
wxIMAGE_LIST_NORMAL, // Normal icons
|
|
|
|
wxIMAGE_LIST_SMALL, // Small icons
|
|
|
|
wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation)
|
|
|
|
};
|
|
|
|
|
2002-07-22 04:51:49 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxGenericImageList: public wxObject
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
2000-07-15 15:51:35 -04:00
|
|
|
public:
|
2003-08-03 18:53:55 -04:00
|
|
|
wxGenericImageList() { m_width = m_height = 0; }
|
2004-06-17 12:22:36 -04:00
|
|
|
wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 );
|
2002-07-22 04:51:49 -04:00
|
|
|
~wxGenericImageList();
|
2004-06-17 12:22:36 -04:00
|
|
|
bool Create( int width, int height, bool mask = true, int initialCount = 1 );
|
1998-07-01 11:43:03 -04:00
|
|
|
bool Create();
|
2000-07-15 15:51:35 -04:00
|
|
|
|
2002-07-22 04:51:49 -04:00
|
|
|
virtual int GetImageCount() const;
|
|
|
|
virtual bool GetSize( int index, int &width, int &height ) const;
|
2000-07-15 15:51:35 -04:00
|
|
|
|
2000-03-05 09:15:47 -05:00
|
|
|
int Add( const wxBitmap& bitmap );
|
|
|
|
int Add( const wxBitmap& bitmap, const wxBitmap& mask );
|
|
|
|
int Add( const wxBitmap& bitmap, const wxColour& maskColour );
|
1998-09-25 00:03:41 -04:00
|
|
|
const wxBitmap *GetBitmap(int index) const;
|
1998-07-01 11:43:03 -04:00
|
|
|
bool Replace( int index, const wxBitmap &bitmap );
|
|
|
|
bool Remove( int index );
|
|
|
|
bool RemoveAll();
|
1998-07-04 11:17:59 -04:00
|
|
|
|
2002-07-22 04:51:49 -04:00
|
|
|
virtual bool Draw(int index, wxDC& dc, int x, int y,
|
2000-07-15 15:51:35 -04:00
|
|
|
int flags = wxIMAGELIST_DRAW_NORMAL,
|
2004-06-17 12:22:36 -04:00
|
|
|
bool solidBackground = false);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
private:
|
1998-05-20 10:01:55 -04:00
|
|
|
wxList m_images;
|
2000-07-15 15:51:35 -04:00
|
|
|
|
1998-07-12 16:06:59 -04:00
|
|
|
int m_width;
|
|
|
|
int m_height;
|
2000-07-15 15:51:35 -04:00
|
|
|
|
2002-07-22 04:51:49 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxGenericImageList)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
2004-03-28 08:10:14 -05:00
|
|
|
#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__)
|
2002-07-22 19:03:03 -04:00
|
|
|
/*
|
|
|
|
* wxImageList has to be a real class or we have problems with
|
|
|
|
* the run-time information.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxImageList: public wxGenericImageList
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxImageList)
|
|
|
|
|
|
|
|
public:
|
|
|
|
wxImageList() {}
|
|
|
|
|
2004-06-17 12:22:36 -04:00
|
|
|
wxImageList( int width, int height, bool mask = true, int initialCount = 1 )
|
2002-07-22 19:03:03 -04:00
|
|
|
: wxGenericImageList(width, height, mask, initialCount)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
2004-03-28 08:10:14 -05:00
|
|
|
#endif // !__WXMSW__ || __WXUNIVERSAL__
|
2002-07-22 19:03:03 -04:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif // __IMAGELISTH_G__
|
|
|
|
|