]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_display.i
Fixed typo
[wxWidgets.git] / wxPython / src / _display.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _display.i
3 // Purpose: SWIG interface for wxVideoMode and wxDisplay
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 9-Mar-2004
8 // RCS-ID: $Id$
9 // Copyright: (c) 2004 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17
18 %{
19 #include "wx/display.h"
20 %}
21
22
23 //---------------------------------------------------------------------------
24 %newgroup
25
26
27 DocStr(wxVideoMode,
28 "A simple struct containing video mode parameters for a display", "");
29
30 struct wxVideoMode
31 {
32 wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0);
33 ~wxVideoMode();
34
35 DocDeclStr(
36 bool , Matches(const wxVideoMode& other) const,
37 "Returns true if this mode matches the other one in the sense that all
38 non zero fields of the other mode have the same value in this
39 one (except for refresh which is allowed to have a greater value)", "");
40
41 DocDeclStr(
42 int , GetWidth() const,
43 "Returns the screen width in pixels (e.g. 640*480), 0 means unspecified", "");
44
45 DocDeclStr(
46 int , GetHeight() const,
47 "Returns the screen width in pixels (e.g. 640*480), 0 means
48 unspecified", "");
49
50 DocDeclStr(
51 int , GetDepth() const,
52 "Returns the screen's bits per pixel (e.g. 32), 1 is monochrome and 0
53 means unspecified/known", "");
54
55
56 DocDeclStr(
57 bool , IsOk() const,
58 "returns true if the object has been initialized", "");
59
60
61
62 %pythoncode { def __nonzero__(self): return self.IsOk() }
63 %extend {
64 bool __eq__(const wxVideoMode* other) { return other ? (*self == *other) : False; }
65 bool __ne__(const wxVideoMode* other) { return other ? (*self != *other) : True; }
66 }
67
68
69 // the screen size in pixels (e.g. 640*480), 0 means unspecified
70 int w, h;
71
72 // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known
73 int bpp;
74
75 // refresh frequency in Hz, 0 means unspecified/unknown
76 int refresh;
77 };
78
79
80 %immutable;
81 const wxVideoMode wxDefaultVideoMode;
82 %mutable;
83
84
85 //---------------------------------------------------------------------------
86
87 DocStr(wxDisplay,
88 "Represents a display/monitor attached to the system", "");
89
90
91 class wxDisplay
92 {
93 public:
94 //
95 DocCtorStr(
96 wxDisplay(size_t index = 0),
97 "Set up a Display instance with the specified display. The displays
98 are numbered from 0 to GetCount() - 1, 0 is always the primary display
99 and the only one which is always supported", "");
100
101 virtual ~wxDisplay();
102
103 DocDeclStr(
104 static size_t , GetCount(),
105 "Return the number of available displays.", "");
106
107
108 DocDeclStr(
109 static int , GetFromPoint(const wxPoint& pt),
110 "Find the display where the given point lies, return wx.NOT_FOUND if it
111 doesn't belong to any display", "");
112
113
114 DocStr(GetFromWindow,
115 "Find the display where the given window lies, return wx.NOT_FOUND if
116 it is not shown at all.", "");
117 #ifdef __WXMSW__
118 static int GetFromWindow(wxWindow *window);
119 #else
120 %extend {
121 static int GetFromWindow(wxWindow *window)
122 { wxPyRaiseNotImplemented(); return wxNOT_FOUND; }
123 }
124 #endif
125
126 DocDeclStr(
127 virtual bool , IsOk() const,
128 "Return true if the object was initialized successfully", "");
129 %pythoncode { def __nonzero__(self): return self.IsOk() }
130
131
132 DocDeclStr(
133 virtual wxRect , GetGeometry() const,
134 "Returns the bounding rectangle of the display whose index was passed
135 to the constructor.", "");
136
137
138 DocDeclStr(
139 virtual wxString , GetName() const,
140 "Returns the display's name. A name is not available on all platforms.", "");
141
142
143 DocDeclStr(
144 bool , IsPrimary() const,
145 "Returns true if the display is the primary display. The primary
146 display is the one whose index is 0.", "");
147
148
149
150 %extend {
151 DocAStr(GetModes,
152 "GetModes(VideoMode mode=DefaultVideoMode) -> [videoMode...]",
153 "Enumerate all video modes supported by this display matching the given
154 one (in the sense of VideoMode.Match()).
155
156 As any mode matches the default value of the argument and there is
157 always at least one video mode supported by display, the returned
158 array is only empty for the default value of the argument if this
159 function is not supported at all on this platform.", "");
160
161 PyObject* GetModes(const wxVideoMode& mode = wxDefaultVideoMode) {
162 PyObject* pyList = NULL;
163 wxArrayVideoModes arr = self->GetModes(mode);
164 bool blocked = wxPyBeginBlockThreads();
165 pyList = PyList_New(0);
166 for (int i=0; i < arr.GetCount(); i++) {
167 wxVideoMode* m = new wxVideoMode(arr.Item(i));
168 PyObject* pyObj = wxPyConstructObject(m, wxT("wxVideoMode"), true);
169 PyList_Append(pyList, pyObj);
170 Py_DECREF(pyObj);
171 }
172 wxPyEndBlockThreads(blocked);
173 return pyList;
174 }
175 }
176
177
178 DocDeclStr(
179 virtual wxVideoMode , GetCurrentMode() const,
180 "Get the current video mode.", "");
181
182
183 DocDeclStr(
184 virtual bool , ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode),
185 "Change current mode, return true if succeeded, false otherwise", "");
186
187
188 DocDeclStr(
189 void , ResetMode(),
190 "Restore the default video mode (just a more readable synonym)", "");
191
192
193 };
194
195 //---------------------------------------------------------------------------