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"
23 //---------------------------------------------------------------------------
28 "A simple struct containing video mode parameters for a display", "");
32 wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0);
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)", "");
42 int , GetWidth() const,
43 "Returns the screen width in pixels (e.g. 640*480), 0 means unspecified", "");
46 int , GetHeight() const,
47 "Returns the screen width in pixels (e.g. 640*480), 0 means
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", "");
62 %pythoncode { def __nonzero__(self): return self.IsOk() }
64 bool __eq__(const wxVideoMode* other) { return other ? (*self == *other) : False; }
65 bool __ne__(const wxVideoMode* other) { return other ? (*self != *other) : True; }
69 // the screen size in pixels (e.g. 640*480), 0 means unspecified
72 // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known
75 // refresh frequency in Hz, 0 means unspecified/unknown
81 const wxVideoMode wxDefaultVideoMode;
85 //---------------------------------------------------------------------------
88 "Represents a display/monitor attached to the system", "");
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", "");
101 virtual ~wxDisplay();
104 static size_t , GetCount(),
105 "Return the number of available displays.", "");
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", "");
114 DocStr(GetFromWindow,
115 "Find the display where the given window lies, return wx.NOT_FOUND if
116 it is not shown at all.", "");
118 static int GetFromWindow(wxWindow *window);
121 static int GetFromWindow(wxWindow *window)
122 { wxPyRaiseNotImplemented(); return wxNOT_FOUND; }
127 virtual bool , IsOk() const,
128 "Return true if the object was initialized successfully", "");
129 %pythoncode { def __nonzero__(self): return self.IsOk() }
133 virtual wxRect , GetGeometry() const,
134 "Returns the bounding rectangle of the display whose index was passed
135 to the constructor.", "");
139 virtual wxString , GetName() const,
140 "Returns the display's name. A name is not available on all platforms.", "");
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.", "");
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()).
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.", "");
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);
172 wxPyEndBlockThreads(blocked);
179 virtual wxVideoMode , GetCurrentMode() const,
180 "Get the current video mode.", "");
184 virtual bool , ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode),
185 "Change current mode, return true if succeeded, false otherwise", "");
190 "Restore the default video mode (just a more readable synonym)", "");
195 //---------------------------------------------------------------------------