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 //---------------------------------------------------------------------------
 
  23 class wxIcon : public wxGDIObject
 
  26     wxIcon(const wxString& name, wxBitmapType type,
 
  27            int desiredWidth = -1, int desiredHeight = -1);
 
  30     // alternate constructors
 
  31     %name(EmptyIcon) wxIcon();
 
  32     %name(IconFromLocation) wxIcon(const wxIconLocation& loc);
 
  34         %name(IconFromBitmap) wxIcon(const wxBitmap& bmp) {
 
  35             wxIcon* icon = new wxIcon();
 
  36             icon->CopyFromBitmap(bmp);
 
  39         %name(IconFromXPMData) wxIcon(PyObject* listOfStrings) {
 
  43             cArray = ConvertListOfStrings(listOfStrings);
 
  46             icon = new wxIcon(cArray);
 
  54     bool LoadFile(const wxString& name, wxBitmapType type);
 
  61         void SetHandle(long handle) { self->SetHandle((WXHANDLE)handle); }
 
  69     void SetHeight(int h);
 
  72     void SetSize(const wxSize& size);
 
  74     void CopyFromBitmap(const wxBitmap& bmp);
 
  76     %pythoncode { def __nonzero__(self): return self.Ok() }
 
  79 //---------------------------------------------------------------------------
 
  84     // ctor takes the name of the file where the icon is
 
  86         wxIconLocation(const wxString* filename = &wxPyEmptyString, int num = 0) {
 
  88             return new wxIconLocation(*filename, num);
 
  90             return new wxIconLocation(*filename);
 
  98     // returns True if this object is valid/initialized
 
 100     %pythoncode { def __nonzero__(self): return self.Ok() }
 
 102     // set/get the icon file name
 
 103     void SetFileName(const wxString& filename);
 
 104     const wxString& GetFileName() const;
 
 107         void SetIndex(int num) {
 
 117             return self->GetIndex();
 
 128 //---------------------------------------------------------------------------
 
 133     // default constructor
 
 136     // initializes the bundle with the icon(s) found in the file
 
 137     %name(IconBundleFromFile) wxIconBundle( const wxString& file, long type );
 
 139     // initializes the bundle with a single icon
 
 140     %name(IconBundleFromIcon)wxIconBundle( const wxIcon& icon );
 
 144     // adds the icon to the collection, if the collection already
 
 145     // contains an icon with the same width and height, it is
 
 147     void AddIcon( const wxIcon& icon );
 
 149     // adds all the icons contained in the file to the collection,
 
 150     // if the collection already contains icons with the same
 
 151     // width and height, they are replaced
 
 152     %name(AddIconFromFile)void AddIcon( const wxString& file, long type );
 
 154     // returns the icon with the given size; if no such icon exists,
 
 155     // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
 
 156     // returns the first icon in the bundle
 
 157     const wxIcon& GetIcon( const wxSize& size ) const;
 
 160 //---------------------------------------------------------------------------