]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_icon.i
added overview text for wx.MediaCtrl demo, udpated CHANGES
[wxWidgets.git] / wxPython / src / _icon.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _icon.i
3// Purpose: SWIG interface for wxIcon and related classes
4//
5// Author: Robin Dunn
6//
7// Created: 7-July-1997
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
16//---------------------------------------------------------------------------
17%{
18#include <wx/iconbndl.h>
19%}
20//---------------------------------------------------------------------------
21
22
ab1f7d2a
RD
23MustHaveApp(wxIcon);
24
d14a1e28
RD
25class wxIcon : public wxGDIObject
26{
27public:
f87da722 28 wxIcon(const wxString& name, wxBitmapType type,
d14a1e28
RD
29 int desiredWidth = -1, int desiredHeight = -1);
30 ~wxIcon();
31
32 // alternate constructors
33 %name(EmptyIcon) wxIcon();
34 %name(IconFromLocation) wxIcon(const wxIconLocation& loc);
35 %extend {
36 %name(IconFromBitmap) wxIcon(const wxBitmap& bmp) {
37 wxIcon* icon = new wxIcon();
38 icon->CopyFromBitmap(bmp);
39 return icon;
40 }
41 %name(IconFromXPMData) wxIcon(PyObject* listOfStrings) {
42 char** cArray = NULL;
43 wxIcon* icon;
44
45 cArray = ConvertListOfStrings(listOfStrings);
46 if (! cArray)
47 return NULL;
48 icon = new wxIcon(cArray);
49 delete [] cArray;
50 return icon;
51 }
52 }
53
54
55#ifndef __WXMAC__
f87da722 56 bool LoadFile(const wxString& name, wxBitmapType type);
d14a1e28
RD
57#endif
58
59 // wxGDIImage methods
60#ifdef __WXMSW__
61 long GetHandle();
a0c956e8
RD
62 %extend {
63 void SetHandle(long handle) { self->SetHandle((WXHANDLE)handle); }
64 }
d14a1e28
RD
65#endif
66 bool Ok();
67 int GetWidth();
68 int GetHeight();
69 int GetDepth();
70 void SetWidth(int w);
71 void SetHeight(int h);
72 void SetDepth(int d);
73#ifdef __WXMSW__
74 void SetSize(const wxSize& size);
75#endif
76 void CopyFromBitmap(const wxBitmap& bmp);
77
78 %pythoncode { def __nonzero__(self): return self.Ok() }
79};
80
81//---------------------------------------------------------------------------
82
83class wxIconLocation
84{
85public:
86 // ctor takes the name of the file where the icon is
87 %extend {
88 wxIconLocation(const wxString* filename = &wxPyEmptyString, int num = 0) {
89#ifdef __WXMSW__
90 return new wxIconLocation(*filename, num);
91#else
92 return new wxIconLocation(*filename);
93#endif
94 }
95 }
96
97 ~wxIconLocation();
98
99
dd9f7fea 100 // returns True if this object is valid/initialized
d14a1e28
RD
101 bool IsOk() const;
102 %pythoncode { def __nonzero__(self): return self.Ok() }
103
104 // set/get the icon file name
105 void SetFileName(const wxString& filename);
106 const wxString& GetFileName() const;
107
108 %extend {
109 void SetIndex(int num) {
110#ifdef __WXMSW__
111 self->SetIndex(num);
112#else
113 // do nothing
114#endif
115 }
116
117 int GetIndex() {
118#ifdef __WXMSW__
119 return self->GetIndex();
120#else
121 return -1;
122#endif
123 }
124 }
125};
126
127
128
129
130//---------------------------------------------------------------------------
131
132class wxIconBundle
133{
134public:
135 // default constructor
136 wxIconBundle();
137
138 // initializes the bundle with the icon(s) found in the file
139 %name(IconBundleFromFile) wxIconBundle( const wxString& file, long type );
140
141 // initializes the bundle with a single icon
142 %name(IconBundleFromIcon)wxIconBundle( const wxIcon& icon );
143
144 ~wxIconBundle();
145
146 // adds the icon to the collection, if the collection already
147 // contains an icon with the same width and height, it is
148 // replaced
149 void AddIcon( const wxIcon& icon );
150
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 );
155
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;
160};
161
162//---------------------------------------------------------------------------