1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface for wxVideoMode and wxDisplay
9 // Copyright: (c) 2004 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
19 #include <wx/display.h>
20 #include <wx/vidmode.h>
24 //---------------------------------------------------------------------------
29 "A simple struct containing video mode parameters for a display", "");
33 wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0);
37 bool , Matches(const wxVideoMode& other) const,
38 "Returns True if this mode matches the other one in the sense that all
39 non-zero fields of the other mode have the same value in this
40 one (except for refresh which is allowed to have a greater value)", "");
43 int , GetWidth() const,
44 "Returns the screen width in pixels (e.g. 640*480), 0 means unspecified", "");
47 int , GetHeight() const,
48 "Returns the screen height in pixels (e.g. 640*480), 0 means unspecified", "");
51 int , GetDepth() const,
52 "Returns the screen's bits per pixel (e.g. 32), 1 is monochrome and 0
53 means unspecified/known", "");
58 "returns true if the object has been initialized", "");
61 %pythoncode { def __nonzero__(self): return self.IsOk() }
63 bool __eq__(const wxVideoMode* other) { return other ? (*self == *other) : false; }
64 bool __ne__(const wxVideoMode* other) { return other ? (*self != *other) : true; }
68 // the screen size in pixels (e.g. 640*480), 0 means unspecified
71 // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known
74 // refresh frequency in Hz, 0 means unspecified/unknown
77 %property(Depth, GetDepth, doc="See `GetDepth`");
78 %property(Height, GetHeight, doc="See `GetHeight`");
79 %property(Width, GetWidth, doc="See `GetWidth`");
85 const wxVideoMode wxDefaultVideoMode;
90 const wxVideoMode wxDefaultVideoMode;
94 //---------------------------------------------------------------------------
99 "Represents a display/monitor attached to the system", "");
104 wxDisplay(unsigned index = 0),
105 "Set up a Display instance with the specified display. The displays
106 are numbered from 0 to GetCount() - 1, 0 is always the primary display
107 and the only one which is always supported", "");
112 static unsigned , GetCount(),
113 "Return the number of available displays.", "");
116 static int , GetFromPoint(const wxPoint& pt),
117 "Find the display where the given point lies, return wx.NOT_FOUND if it
118 doesn't belong to any display", "");
120 DocStr(GetFromWindow,
121 "Find the display where the given window lies, return wx.NOT_FOUND if
122 it is not shown at all.", "");
124 static int GetFromWindow(wxWindow *window);
129 "Return true if the object was initialized successfully", "");
130 %pythoncode { def __nonzero__(self): return self.IsOk() }
133 wxRect , GetGeometry() const,
134 "Returns the bounding rectangle of the display whose index was passed
135 to the constructor.", "");
138 wxRect , GetClientArea() const,
139 "Returns the bounding rectangle the client area of the display,
140 i.e., without taskbars and such.", "");
143 wxString , GetName() const,
144 "Returns the display's name. A name is not available on all platforms.", "");
147 bool , IsPrimary() const,
148 "Returns True if the display is the primary display. The primary
149 display is the one whose index is 0.", "");
155 "GetModes(VideoMode mode=DefaultVideoMode) -> [videoMode...]",
156 "Enumerate all video modes supported by this display matching the given
157 one (in the sense of VideoMode.Match()).
159 As any mode matches the default value of the argument and there is
160 always at least one video mode supported by display, the returned
161 array is only empty for the default value of the argument if this
162 function is not supported at all on this platform.", "");
164 PyObject* GetModes(const wxVideoMode& mode = wxDefaultVideoMode)
167 PyObject* pyList = NULL;
168 wxArrayVideoModes arr = self->GetModes(mode);
169 wxPyBlock_t blocked = wxPyBeginBlockThreads();
170 pyList = PyList_New(0);
171 for (size_t i=0; i < arr.GetCount(); i++)
173 wxVideoMode* m = new wxVideoMode(arr.Item(i));
174 PyObject* pyObj = wxPyConstructObject(m, wxT("wxVideoMode"), true);
175 PyList_Append(pyList, pyObj);
178 wxPyEndBlockThreads(blocked);
181 wxPyRaiseNotImplemented();
186 DocStr(GetCurrentMode,
187 "Get the current video mode.", "");
188 wxVideoMode GetCurrentMode() const
191 return self->GetCurrentMode();
193 wxPyRaiseNotImplemented();
194 return wxDefaultVideoMode;
201 "Changes the video mode of this display to the mode specified in the
204 If wx.DefaultVideoMode is passed in as the mode parameter, the defined
205 behaviour is that wx.Display will reset the video mode to the default
206 mode used by the display. On Windows, the behavior is normal.
207 However, there are differences on other platforms. On Unix variations
208 using X11 extensions it should behave as defined, but some
209 irregularities may occur.
211 On wxMac passing in wx.DefaultVideoMode as the mode parameter does
212 nothing. This happens because Carbon no longer has access to
213 DMUseScreenPrefs, an undocumented function that changed the video mode
214 to the system default by using the system's 'scrn' resource.
216 Returns True if succeeded, False otherwise", "");
218 bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode)
221 return self->ChangeMode(mode);
223 wxPyRaiseNotImplemented();
231 "Restore the default video mode (just a more readable synonym)", "");
237 wxPyRaiseNotImplemented();
243 %property(ClientArea, GetClientArea, doc="See `GetClientArea`");
244 %property(CurrentMode, GetCurrentMode, doc="See `GetCurrentMode`");
245 %property(Geometry, GetGeometry, doc="See `GetGeometry`");
246 %property(Modes, GetModes, doc="See `GetModes`");
247 %property(Name, GetName, doc="See `GetName`");
251 //---------------------------------------------------------------------------