1 /////////////////////////////////////////////////////////////////////////////
 
   3 // Purpose:     SWIG interface for wxIcon and related classes
 
   7 // Created:     7-July-1997
 
   9 // Copyright:   (c) 2003 by Total Control Software
 
  10 // Licence:     wxWindows license
 
  11 /////////////////////////////////////////////////////////////////////////////
 
  16 //---------------------------------------------------------------------------
 
  18 #include <wx/iconbndl.h>
 
  20 //---------------------------------------------------------------------------
 
  25 class wxIcon : public wxGDIObject
 
  28     wxIcon(const wxString& name, wxBitmapType type,
 
  29            int desiredWidth = -1, int desiredHeight = -1);
 
  32     // alternate constructors
 
  33     %RenameCtor(EmptyIcon, wxIcon());
 
  34     %RenameCtor(IconFromLocation,  wxIcon(const wxIconLocation& loc));
 
  36         %RenameCtor(IconFromBitmap, wxIcon(const wxBitmap& bmp))
 
  38             wxIcon* icon = new wxIcon();
 
  39             icon->CopyFromBitmap(bmp);
 
  42         %RenameCtor(IconFromXPMData, wxIcon(PyObject* listOfStrings))
 
  47             cArray = ConvertListOfStrings(listOfStrings);
 
  50             icon = new wxIcon(cArray);
 
  58     bool LoadFile(const wxString& name, wxBitmapType type);
 
  65         void SetHandle(long handle) { self->SetHandle((WXHANDLE)handle); }
 
  69     %pythoncode { Ok = IsOk }
 
  74     void SetHeight(int h);
 
  77     void SetSize(const wxSize& size);
 
  79     void CopyFromBitmap(const wxBitmap& bmp);
 
  81     %pythoncode { def __nonzero__(self): return self.IsOk() }
 
  83     %property(Depth, GetDepth, SetDepth, doc="See `GetDepth` and `SetDepth`");
 
  84     %property(Height, GetHeight, SetHeight, doc="See `GetHeight` and `SetHeight`");
 
  85     %property(Width, GetWidth, SetWidth, doc="See `GetWidth` and `SetWidth`");
 
  89 //---------------------------------------------------------------------------
 
  94     // ctor takes the name of the file where the icon is
 
  96         wxIconLocation(const wxString* filename = &wxPyEmptyString, int num = 0) {
 
  98             return new wxIconLocation(*filename, num);
 
 100             return new wxIconLocation(*filename);
 
 108     // returns True if this object is valid/initialized
 
 110     %pythoncode { def __nonzero__(self): return self.IsOk() }
 
 112     // set/get the icon file name
 
 113     void SetFileName(const wxString& filename);
 
 114     const wxString& GetFileName() const;
 
 117         void SetIndex(int num) {
 
 127             return self->GetIndex();
 
 134     %property(FileName, GetFileName, SetFileName, doc="See `GetFileName` and `SetFileName`");
 
 135     %property(Index, GetIndex, SetIndex, doc="See `GetIndex` and `SetIndex`");
 
 142 //---------------------------------------------------------------------------
 
 147     // default constructor
 
 150     // initializes the bundle with the icon(s) found in the file
 
 151     %RenameCtor(IconBundleFromFile, wxIconBundle( const wxString& file, long type ));
 
 153     // initializes the bundle with a single icon
 
 154     %RenameCtor(IconBundleFromIcon, wxIconBundle( const wxIcon& icon ));
 
 158     virtual bool IsOk() const;
 
 159     %pythoncode { def __nonzero__(self): return self.IsOk() }
 
 163         void , AddIcon( const wxIcon& icon ),
 
 164         "Adds the icon to the collection, if the collection already contains an
 
 165 icon with the same width and height, it is replaced", "");
 
 169         void , AddIcon( const wxString& file, long type ),
 
 170         "Adds all the icons contained in the file to the collection, if the
 
 171 collection already contains icons with the same width and height, they
 
 177         const wxIcon& , GetIcon( const wxSize& size ) const,
 
 178         "Returns the icon with the given size; if no such icon exists, returns
 
 179 the icon with size wxSYS_ICON_[XY]; if no such icon exists, returns
 
 180 the first icon in the bundle", "");
 
 185         wxIcon , GetIconOfExactSize(const wxSize& size) const,
 
 186         "Returns the icon exactly of the specified size or wxNullIcon if no
 
 187 icon of exactly given size are available.", "");
 
 192         size_t , GetIconCount() const,
 
 193         "return the number of available icons", "");
 
 197         wxIcon , GetIconByIndex(size_t n) const,
 
 198         "Return the icon at index (must be < GetIconCount())", "");
 
 202         bool , IsEmpty() const,
 
 203         "Check if we have any icons at all", "");    
 
 207 //---------------------------------------------------------------------------