]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/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
6 // Author: Stefan Csomor
10 // Copyright: (c) Stefan Csomor
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
14 #ifndef _WX_IMAGLIST_H_
15 #define _WX_IMAGLIST_H_
17 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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;
76 bool GetSize(int index
, int&width
, int &height
) const;
79 ////////////////////////////////////////////////////////////////////////////
81 // Creates an image list
82 // width, height specify the size of the images in the list (all the same).
83 // mask specifies whether the images have masks or not.
84 // initialNumber is the initial number of images to reserve.
85 bool Create(int width
, int height
, bool mask
= TRUE
, int initialNumber
= 1);
87 // Adds a bitmap, and optionally a mask bitmap.
88 // Note that wxImageList creates *new* bitmaps, so you may delete
89 // 'bitmap' and 'mask' after calling Add.
90 int Add(const wxBitmap
& bitmap
, const wxBitmap
& mask
= wxNullBitmap
);
92 // Adds a bitmap, using the specified colour to create the mask bitmap
93 // Note that wxImageList creates *new* bitmaps, so you may delete
94 // 'bitmap' after calling Add.
95 int Add(const wxBitmap
& bitmap
, const wxColour
& maskColour
);
97 // Adds a bitmap and mask from an icon.
98 int Add(const wxIcon
& icon
);
100 // Replaces a bitmap, optionally passing a mask bitmap.
101 // Note that wxImageList creates new bitmaps, so you may delete
102 // 'bitmap' and 'mask' after calling Replace.
103 bool Replace(int index
, const wxBitmap
& bitmap
, const wxBitmap
& mask
= wxNullBitmap
);
105 /* Not supported by Win95
106 // Replacing a bitmap, using the specified colour to create the mask bitmap
107 // Note that wxImageList creates new bitmaps, so you may delete
109 bool Replace(int index, const wxBitmap& bitmap, const wxColour& maskColour);
112 // Replaces a bitmap and mask from an icon.
113 // You can delete 'icon' after calling Replace.
114 bool Replace(int index
, const wxIcon
& icon
);
116 // Removes the image at the given index.
117 bool Remove(int index
);
122 // Draws the given image on a dc at the specified position.
123 // If 'solidBackground' is TRUE, Draw sets the image list background
124 // colour to the background colour of the wxDC, to speed up
125 // drawing by eliminating masked drawing where possible.
126 bool Draw(int index
, wxDC
& dc
, int x
, int y
,
127 int flags
= wxIMAGELIST_DRAW_NORMAL
, bool solidBackground
= FALSE
);
130 wxIcon *MakeIcon(int index);
135 ////////////////////////////////////////////////////////////////////////////
137 // Returns the native image list handle
138 inline WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; }
141 WXHIMAGELIST m_hImageList;