]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/imaglist.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxImageList class. Note: if your GUI doesn't have
4 // an image list equivalent, you can use the generic class
10 // Copyright: (c) AUTHOR
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
14 #ifndef _WX_IMAGLIST_H_
15 #define _WX_IMAGLIST_H_
18 #pragma interface "imaglist.h"
21 #include "wx/bitmap.h"
24 * wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to
25 * images for their items by an index into an image list.
26 * A wxImageList is capable of creating images with optional masks from
27 * a variety of sources - a single bitmap plus a colour to indicate the mask,
28 * two bitmaps, or an icon.
33 #define wxIMAGELIST_DRAW_NORMAL 0x0001
34 #define wxIMAGELIST_DRAW_TRANSPARENT 0x0002
35 #define wxIMAGELIST_DRAW_SELECTED 0x0004
36 #define wxIMAGELIST_DRAW_FOCUSED 0x0008
38 // Flag values for Set/GetImageList
40 wxIMAGE_LIST_NORMAL
, // Normal icons
41 wxIMAGE_LIST_SMALL
, // Small icons
42 wxIMAGE_LIST_STATE
// State icons: unimplemented (see WIN32 documentation)
45 // Eventually we'll make this a reference-counted wxGDIObject. For
46 // now, the app must take care of ownership issues. That is, the
47 // image lists must be explicitly deleted after the control(s) that uses them
48 // is (are) deleted, or when the app exits.
49 class WXDLLEXPORT wxImageList
: public wxObject
51 DECLARE_DYNAMIC_CLASS(wxImageList
)
59 // Creates an image list.
60 // Specify the width and height of the images in the list,
61 // whether there are masks associated with them (e.g. if creating images
62 // from icons), and the initial size of the list.
63 inline wxImageList(int width
, int height
, bool mask
= TRUE
, int initialCount
= 1)
65 Create(width
, height
, mask
, initialCount
);
71 ////////////////////////////////////////////////////////////////////////////
73 // Returns the number of images in the image list.
74 int GetImageCount() const;
77 ////////////////////////////////////////////////////////////////////////////
79 // Creates an image list
80 // width, height specify the size of the images in the list (all the same).
81 // mask specifies whether the images have masks or not.
82 // initialNumber is the initial number of images to reserve.
83 bool Create(int width
, int height
, bool mask
= TRUE
, int initialNumber
= 1);
85 // Adds a bitmap, and optionally a mask bitmap.
86 // Note that wxImageList creates *new* bitmaps, so you may delete
87 // 'bitmap' and 'mask' after calling Add.
88 int Add(const wxBitmap
& bitmap
, const wxBitmap
& mask
= wxNullBitmap
);
90 // Adds a bitmap, using the specified colour to create the mask bitmap
91 // Note that wxImageList creates *new* bitmaps, so you may delete
92 // 'bitmap' after calling Add.
93 int Add(const wxBitmap
& bitmap
, const wxColour
& maskColour
);
95 // Adds a bitmap and mask from an icon.
96 int Add(const wxIcon
& icon
);
98 // Replaces a bitmap, optionally passing a mask bitmap.
99 // Note that wxImageList creates new bitmaps, so you may delete
100 // 'bitmap' and 'mask' after calling Replace.
101 bool Replace(int index
, const wxBitmap
& bitmap
, const wxBitmap
& mask
= wxNullBitmap
);
103 /* Not supported by Win95
104 // Replacing a bitmap, using the specified colour to create the mask bitmap
105 // Note that wxImageList creates new bitmaps, so you may delete
107 bool Replace(int index, const wxBitmap& bitmap, const wxColour& maskColour);
110 // Replaces a bitmap and mask from an icon.
111 // You can delete 'icon' after calling Replace.
112 bool Replace(int index
, const wxIcon
& icon
);
114 // Removes the image at the given index.
115 bool Remove(int index
);
120 // Draws the given image on a dc at the specified position.
121 // If 'solidBackground' is TRUE, Draw sets the image list background
122 // colour to the background colour of the wxDC, to speed up
123 // drawing by eliminating masked drawing where possible.
124 bool Draw(int index
, wxDC
& dc
, int x
, int y
,
125 int flags
= wxIMAGELIST_DRAW_NORMAL
, bool solidBackground
= FALSE
);
128 wxIcon *MakeIcon(int index);
133 ////////////////////////////////////////////////////////////////////////////
135 // Returns the native image list handle
136 inline WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; }
139 WXHIMAGELIST m_hImageList;