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 %name(EmptyIcon) wxIcon();
34 %name(IconFromLocation) wxIcon(const wxIconLocation& loc);
36 %name(IconFromBitmap) wxIcon(const wxBitmap& bmp) {
37 wxIcon* icon = new wxIcon();
38 icon->CopyFromBitmap(bmp);
41 %name(IconFromXPMData) wxIcon(PyObject* listOfStrings) {
45 cArray = ConvertListOfStrings(listOfStrings);
48 icon = new wxIcon(cArray);
56 bool LoadFile(const wxString& name, wxBitmapType type);
63 void SetHandle(long handle) { self->SetHandle((WXHANDLE)handle); }
71 void SetHeight(int h);
74 void SetSize(const wxSize& size);
76 void CopyFromBitmap(const wxBitmap& bmp);
78 %pythoncode { def __nonzero__(self): return self.Ok() }
81 //---------------------------------------------------------------------------
86 // ctor takes the name of the file where the icon is
88 wxIconLocation(const wxString* filename = &wxPyEmptyString, int num = 0) {
90 return new wxIconLocation(*filename, num);
92 return new wxIconLocation(*filename);
100 // returns True if this object is valid/initialized
102 %pythoncode { def __nonzero__(self): return self.Ok() }
104 // set/get the icon file name
105 void SetFileName(const wxString& filename);
106 const wxString& GetFileName() const;
109 void SetIndex(int num) {
119 return self->GetIndex();
130 //---------------------------------------------------------------------------
135 // default constructor
138 // initializes the bundle with the icon(s) found in the file
139 %name(IconBundleFromFile) wxIconBundle( const wxString& file, long type );
141 // initializes the bundle with a single icon
142 %name(IconBundleFromIcon)wxIconBundle( const wxIcon& icon );
146 // adds the icon to the collection, if the collection already
147 // contains an icon with the same width and height, it is
149 void AddIcon( const wxIcon& icon );
151 // adds all the icons contained in the file to the collection,
152 // if the collection already contains icons with the same
153 // width and height, they are replaced
154 %name(AddIconFromFile)void AddIcon( const wxString& file, long type );
156 // returns the icon with the given size; if no such icon exists,
157 // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
158 // returns the first icon in the bundle
159 const wxIcon& GetIcon( const wxSize& size ) const;
162 //---------------------------------------------------------------------------