]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/imaglist.h
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     interface of wxImageList 
   4 // Author:      wxWidgets team 
   6 // Licence:     wxWindows license 
   7 ///////////////////////////////////////////////////////////////////////////// 
  12     A wxImageList contains a list of images, which are stored in an unspecified 
  13     form. Images can have masks for transparent drawing, and can be made from a 
  14     variety of sources including bitmaps and icons. 
  16     wxImageList is used principally in conjunction with wxTreeCtrl and 
  22     @see wxTreeCtrl, wxListCtrl 
  24 class wxImageList 
: public wxObject
 
  33         Constructor specifying the image size, whether image masks should be created, 
  34         and the initial size of the list. 
  37             Width of the images in the list. 
  39             Height of the images in the list. 
  41             @true if masks should be created for all images. 
  43             The initial size of the list. 
  47     wxImageList(int width
, int height
, bool mask 
= true, 
  48                 int initialCount 
= 1); 
  51         Adds a new image or images using a bitmap and optional mask bitmap. 
  54             Bitmap representing the opaque areas of the image. 
  56             Monochrome mask bitmap, representing the transparent areas of the image. 
  58         @return The new zero-based image index. 
  60         @remarks The original bitmap or icon is not affected by the Add() 
  61                  operation, and can be deleted afterwards. 
  62                  If the bitmap is wider than the images in the list, then the 
  63                  bitmap will automatically be split into smaller images, each 
  64                  matching the dimensions of the image list. 
  65                  This does not apply when adding icons. 
  67     int Add(const wxBitmap
& bitmap
, 
  68             const wxBitmap
& mask 
= wxNullBitmap
); 
  71         Adds a new image or images using a bitmap and mask colour. 
  74             Bitmap representing the opaque areas of the image. 
  76             Colour indicating which parts of the image are transparent. 
  78         @return The new zero-based image index. 
  80         @remarks The original bitmap or icon is not affected by the Add() 
  81                  operation, and can be deleted afterwards. 
  82                  If the bitmap is wider than the images in the list, then the 
  83                  bitmap will automatically be split into smaller images, each 
  84                  matching the dimensions of the image list. 
  85                  This does not apply when adding icons. 
  87     int Add(const wxBitmap
& bitmap
, const wxColour
& maskColour
); 
  90         Adds a new image using an icon. 
  93             Icon to use as the image. 
  95         @return The new zero-based image index. 
  97         @remarks The original bitmap or icon is not affected by the Add() 
  98                  operation, and can be deleted afterwards. 
  99                  If the bitmap is wider than the images in the list, then the 
 100                  bitmap will automatically be split into smaller images, each 
 101                  matching the dimensions of the image list. 
 102                  This does not apply when adding icons. 
 104         @onlyfor{wxmsw,wxmac} 
 106     int Add(const wxIcon
& icon
); 
 109         Initializes the list. See wxImageList() for details. 
 111     bool Create(int width
, int height
, bool mask 
= true, 
 112                 int initialCount 
= 1); 
 115         Draws a specified image onto a device context. 
 118             Image index, starting from zero. 
 120             Device context to draw on. 
 122             X position on the device context. 
 124             Y position on the device context. 
 126             How to draw the image. A bitlist of a selection of the following: 
 127             - wxIMAGELIST_DRAW_NORMAL: Draw the image normally. 
 128             - wxIMAGELIST_DRAW_TRANSPARENT: Draw the image with transparency. 
 129             - wxIMAGELIST_DRAW_SELECTED: Draw the image in selected state. 
 130             - wxIMAGELIST_DRAW_FOCUSED: Draw the image in a focused state. 
 131         @param solidBackground 
 132             For optimisation - drawing can be faster if the function is told 
 133             that the background is solid. 
 135     virtual bool Draw(int index
, wxDC
& dc
, int x
, int y
, 
 136                       int flags 
= wxIMAGELIST_DRAW_NORMAL
, 
 137                       bool solidBackground 
= false); 
 140         Returns the bitmap corresponding to the given index. 
 142     wxBitmap 
GetBitmap(int index
) const; 
 145         Returns the icon corresponding to the given index. 
 147     wxIcon 
GetIcon(int index
) const; 
 150         Returns the number of images in the list. 
 152     virtual int GetImageCount() const; 
 155         Retrieves the size of the images in the list. Currently, the @a index 
 156         parameter is ignored as all images in the list have the same size. 
 159             currently unused, should be 0 
 161             receives the width of the images in the list 
 163             receives the height of the images in the list 
 165         @return @true if the function succeeded, @false if it failed 
 166                 (for example, if the image list was not yet initialized). 
 168     virtual bool GetSize(int index
, int& width
, int& height
) const; 
 171         Removes the image at the given position. 
 173     bool Remove(int index
); 
 176         Removes all the images in the list. 
 181         Replaces the existing image with the new image. 
 185             The index of the bitmap to be replaced. 
 187             Bitmap representing the opaque areas of the image. 
 189             Monochrome mask bitmap, representing the transparent areas of the image. 
 191         @return @true if the replacement was successful, @false otherwise. 
 193         @remarks The original bitmap or icon is not affected by the Replace() 
 194                  operation, and can be deleted afterwards. 
 196     bool Replace(int index
, const wxBitmap
& bitmap
, 
 197                  const wxBitmap
& mask 
= wxNullBitmap
); 
 200         Replaces the existing image with the new image. 
 203             The index of the bitmap to be replaced. 
 205             Icon to use as the image. 
 207         @return @true if the replacement was successful, @false otherwise. 
 209         @remarks The original bitmap or icon is not affected by the Replace() 
 210                  operation, and can be deleted afterwards. 
 212         @onlyfor{wxmsw,wxmac} 
 214     bool Replace(int index
, const wxIcon
& icon
);