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 height in pixels (e.g. 640*480), 0 means unspecified", "");
 
  50         int , GetDepth() const,
 
  51         "Returns the screen's bits per pixel (e.g. 32), 1 is monochrome and 0
 
  52 means unspecified/known", "");
 
  57         "returns true if the object has been initialized", "");
 
  60     %pythoncode { def __nonzero__(self): return self.IsOk() }
 
  62         bool __eq__(const wxVideoMode* other) { return other ? (*self == *other) : false; }
 
  63         bool __ne__(const wxVideoMode* other) { return other ? (*self != *other) : true;  }
 
  67     // the screen size in pixels (e.g. 640*480), 0 means unspecified
 
  70     // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known
 
  73     // refresh frequency in Hz, 0 means unspecified/unknown
 
  76     %property(Depth, GetDepth, doc="See `GetDepth`");
 
  77     %property(Height, GetHeight, doc="See `GetHeight`");
 
  78     %property(Width, GetWidth, doc="See `GetWidth`");
 
  84 const wxVideoMode     wxDefaultVideoMode;
 
  89 const wxVideoMode     wxDefaultVideoMode;
 
  93 //---------------------------------------------------------------------------
 
  98        "Represents a display/monitor attached to the system", "");
 
 103         wxDisplay(size_t index = 0),
 
 104         "Set up a Display instance with the specified display.  The displays
 
 105 are numbered from 0 to GetCount() - 1, 0 is always the primary display
 
 106 and the only one which is always supported", "");
 
 111         static size_t , GetCount(),
 
 112         "Return the number of available displays.", "");
 
 115         static int , GetFromPoint(const wxPoint& pt),
 
 116         "Find the display where the given point lies, return wx.NOT_FOUND if it
 
 117 doesn't belong to any display", "");
 
 119     DocStr(GetFromWindow,
 
 120            "Find the display where the given window lies, return wx.NOT_FOUND if
 
 121 it is not shown at all.", "");
 
 123     static int GetFromWindow(wxWindow *window);
 
 128         "Return true if the object was initialized successfully", "");
 
 129     %pythoncode { def __nonzero__(self): return self.IsOk() }
 
 132         wxRect , GetGeometry() const,
 
 133         "Returns the bounding rectangle of the display whose index was passed
 
 134 to the constructor.", "");
 
 137         wxRect , GetClientArea() const,
 
 138         "Returns the bounding rectangle the client area of the display,
 
 139 i.e., without taskbars and such.", "");
 
 142         wxString , GetName() const,
 
 143         "Returns the display's name. A name is not available on all platforms.", "");
 
 146         bool , IsPrimary() const,
 
 147         "Returns True if the display is the primary display. The primary
 
 148 display is the one whose index is 0.", "");
 
 154                 "GetModes(VideoMode mode=DefaultVideoMode) -> [videoMode...]",
 
 155                 "Enumerate all video modes supported by this display matching the given
 
 156 one (in the sense of VideoMode.Match()).
 
 158 As any mode matches the default value of the argument and there is
 
 159 always at least one video mode supported by display, the returned
 
 160 array is only empty for the default value of the argument if this
 
 161 function is not supported at all on this platform.", "");
 
 163         PyObject* GetModes(const wxVideoMode& mode = wxDefaultVideoMode)
 
 166             PyObject* pyList = NULL;
 
 167             wxArrayVideoModes arr = self->GetModes(mode);
 
 168             wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
 169             pyList = PyList_New(0);
 
 170             for (size_t i=0; i < arr.GetCount(); i++)
 
 172                 wxVideoMode* m = new wxVideoMode(arr.Item(i));
 
 173                 PyObject* pyObj = wxPyConstructObject(m, wxT("wxVideoMode"), true);
 
 174                 PyList_Append(pyList, pyObj);
 
 177             wxPyEndBlockThreads(blocked);
 
 180         wxPyRaiseNotImplemented();
 
 185         DocStr(GetCurrentMode,
 
 186                "Get the current video mode.", "");
 
 187         wxVideoMode GetCurrentMode() const
 
 190             return self->GetCurrentMode();
 
 192             wxPyRaiseNotImplemented();
 
 193             return wxDefaultVideoMode;
 
 200             "Changes the video mode of this display to the mode specified in the
 
 203 If wx.DefaultVideoMode is passed in as the mode parameter, the defined
 
 204 behaviour is that wx.Display will reset the video mode to the default
 
 205 mode used by the display.  On Windows, the behavior is normal.
 
 206 However, there are differences on other platforms. On Unix variations
 
 207 using X11 extensions it should behave as defined, but some
 
 208 irregularities may occur.
 
 210 On wxMac passing in wx.DefaultVideoMode as the mode parameter does
 
 211 nothing.  This happens because Carbon no longer has access to
 
 212 DMUseScreenPrefs, an undocumented function that changed the video mode
 
 213 to the system default by using the system's 'scrn' resource.
 
 215 Returns True if succeeded, False otherwise", "");
 
 217         bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode)
 
 220             return self->ChangeMode(mode);
 
 222             wxPyRaiseNotImplemented();
 
 230             "Restore the default video mode (just a more readable synonym)", "");
 
 236             wxPyRaiseNotImplemented();
 
 242     %property(ClientArea, GetClientArea, doc="See `GetClientArea`");
 
 243     %property(CurrentMode, GetCurrentMode, doc="See `GetCurrentMode`");
 
 244     %property(Geometry, GetGeometry, doc="See `GetGeometry`");
 
 245     %property(Modes, GetModes, doc="See `GetModes`");
 
 246     %property(Name, GetName, doc="See `GetName`");
 
 250 //---------------------------------------------------------------------------