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);
60 void SetHandle(long handle);
67 void SetHeight(int h);
70 void SetSize(const wxSize& size);
72 void CopyFromBitmap(const wxBitmap& bmp);
74 %pythoncode { def __nonzero__(self): return self.Ok() }
77 //---------------------------------------------------------------------------
82 // ctor takes the name of the file where the icon is
84 wxIconLocation(const wxString* filename = &wxPyEmptyString, int num = 0) {
86 return new wxIconLocation(*filename, num);
88 return new wxIconLocation(*filename);
96 // returns True if this object is valid/initialized
98 %pythoncode { def __nonzero__(self): return self.Ok() }
100 // set/get the icon file name
101 void SetFileName(const wxString& filename);
102 const wxString& GetFileName() const;
105 void SetIndex(int num) {
115 return self->GetIndex();
126 //---------------------------------------------------------------------------
131 // default constructor
134 // initializes the bundle with the icon(s) found in the file
135 %name(IconBundleFromFile) wxIconBundle( const wxString& file, long type );
137 // initializes the bundle with a single icon
138 %name(IconBundleFromIcon)wxIconBundle( const wxIcon& icon );
142 // adds the icon to the collection, if the collection already
143 // contains an icon with the same width and height, it is
145 void AddIcon( const wxIcon& icon );
147 // adds all the icons contained in the file to the collection,
148 // if the collection already contains icons with the same
149 // width and height, they are replaced
150 %name(AddIconFromFile)void AddIcon( const wxString& file, long type );
152 // returns the icon with the given size; if no such icon exists,
153 // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
154 // returns the first icon in the bundle
155 const wxIcon& GetIcon( const wxSize& size ) const;
158 //---------------------------------------------------------------------------