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
38 all 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
47 int , GetHeight() const,
48 "Returns the screen width in pixels (e.g. 640*480), 0 means
52 int , GetDepth() const,
53 "Returns the screen's bits per pixel (e.g. 32), 1 is monochrome
54 and 0 means unspecified/known");
59 "returns true if the object has been initialized");
63 %pythoncode { def __nonzero__(self): return self.IsOk() }
65 bool __eq__(const wxVideoMode* other) { return other ? (*self == *other) : False; }
66 bool __ne__(const wxVideoMode* other) { return other ? (*self != *other) : True; }
70 // the screen size in pixels (e.g. 640*480), 0 means unspecified
73 // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known
76 // refresh frequency in Hz, 0 means unspecified/unknown
82 const wxVideoMode wxDefaultVideoMode;
86 //---------------------------------------------------------------------------
89 "Represents a display/monitor attached to the system");
97 wxDisplay(size_t index = 0),
98 "Set up a Display instance with the specified display. The
99 displays are numbered from 0 to GetCount() - 1, 0 is always the
100 primary display and the only one which is always supported");
102 virtual ~wxDisplay();
105 static size_t , GetCount(),
106 "Return the number of available displays.");
110 static int , GetFromPoint(const wxPoint& pt),
111 "Find the display where the given point lies, return wx.NOT_FOUND
112 if it doesn't belong to any display");
115 DocStr(GetFromWindow,
116 "Find the display where the given window lies, return wx.NOT_FOUND
117 if it is not shown at all.");
119 static int GetFromWindow(wxWindow *window);
122 static int GetFromWindow(wxWindow *window)
123 { wxPyRaiseNotImplemented(); return wxNOT_FOUND; }
128 virtual bool , IsOk() const,
129 "Return true if the object was initialized successfully");
130 %pythoncode { def __nonzero__(self): return self.IsOk() }
134 virtual wxRect , GetGeometry() const,
135 "Returns the bounding rectangle of the display whose index was
136 passed to the constructor.");
140 virtual wxString , GetName() const,
141 "Returns the display's name. A name is not available on all platforms.");
145 bool , IsPrimary() const,
146 "Returns true if the display is the primary display. The primary
147 display is the one whose index is 0.");
153 "GetModes(VideoMode mode=DefaultVideoMode) -> [videoMode...]",
154 "Enumerate all video modes supported by this display matching the
155 given one (in the sense of VideoMode.Match()).
157 As any mode matches the default value of the argument and there
158 is always at least one video mode supported by display, the
159 returned array is only empty for the default value of the
160 argument if this function is not supported at all on this
163 PyObject* GetModes(const wxVideoMode& mode = wxDefaultVideoMode) {
164 PyObject* pyList = NULL;
165 wxArrayVideoModes arr = self->GetModes(mode);
166 bool blocked = wxPyBeginBlockThreads();
167 pyList = PyList_New(0);
168 for (int i=0; i < arr.GetCount(); i++) {
169 wxVideoMode* m = new wxVideoMode(arr.Item(i));
170 PyObject* pyObj = wxPyConstructObject(m, wxT("wxVideoMode"), true);
171 PyList_Append(pyList, pyObj);
173 wxPyEndBlockThreads(blocked);
180 virtual wxVideoMode , GetCurrentMode() const,
181 "Get the current video mode.");
185 virtual bool , ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode),
186 "Change current mode, return true if succeeded, false otherwise");
191 "Restore the default video mode (just a more readable synonym)");
196 //---------------------------------------------------------------------------