X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad411ab2f1582af5c334eb4d63aa1d610d780f9c..c437fde9f90fc7dfcac79053d214fc9146d7be21:/wxPython/src/_display.i diff --git a/wxPython/src/_display.i b/wxPython/src/_display.i index db32d011a8..60b2c49c60 100644 --- a/wxPython/src/_display.i +++ b/wxPython/src/_display.i @@ -16,7 +16,7 @@ //--------------------------------------------------------------------------- %{ -#include "wx/display.h" +#include %} @@ -61,8 +61,8 @@ means unspecified/known", ""); %pythoncode { def __nonzero__(self): return self.IsOk() } %extend { - bool __eq__(const wxVideoMode* other) { return other ? (*self == *other) : False; } - bool __ne__(const wxVideoMode* other) { return other ? (*self != *other) : True; } + bool __eq__(const wxVideoMode* other) { return other ? (*self == *other) : false; } + bool __ne__(const wxVideoMode* other) { return other ? (*self != *other) : true; } } @@ -84,10 +84,55 @@ const wxVideoMode wxDefaultVideoMode; //--------------------------------------------------------------------------- -DocStr(wxDisplay, - "Represents a display/monitor attached to the system", ""); +%{ +// dummy version of wxDisplay for when it is not enabled in the wxWidgets build +#if !wxUSE_DISPLAY +#include +#include + +WX_DECLARE_OBJARRAY(wxVideoMode, wxArrayVideoModes); +#include "wx/arrimpl.cpp" +WX_DEFINE_OBJARRAY(wxArrayVideoModes); +const wxVideoMode wxDefaultVideoMode; + +class wxDisplay +{ +public: + wxDisplay(size_t index = 0) { wxPyRaiseNotImplemented(); } + ~wxDisplay() {} + + static size_t GetCount() + { wxPyRaiseNotImplemented(); return 0; } + + static int GetFromPoint(const wxPoint& pt) + { wxPyRaiseNotImplemented(); return wxNOT_FOUND; } + static int GetFromWindow(wxWindow *window) + { wxPyRaiseNotImplemented(); return wxNOT_FOUND; } + + virtual bool IsOk() const { return false; } + virtual wxRect GetGeometry() const { wxRect r; return r; } + virtual wxString GetName() const { return wxEmptyString; } + bool IsPrimary() const { return false; } + + wxArrayVideoModes GetModes(const wxVideoMode& mode = wxDefaultVideoMode) + { wxArrayVideoModes a; return a; } + virtual wxVideoMode GetCurrentMode() const + { return wxDefaultVideoMode; } + + virtual bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode) + { return false; } + + void ResetMode() {} +}; +#endif +%} + + + +DocStr(wxDisplay, + "Represents a display/monitor attached to the system", ""); class wxDisplay { public: @@ -161,7 +206,7 @@ function is not supported at all on this platform.", ""); PyObject* GetModes(const wxVideoMode& mode = wxDefaultVideoMode) { PyObject* pyList = NULL; wxArrayVideoModes arr = self->GetModes(mode); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); pyList = PyList_New(0); for (int i=0; i < arr.GetCount(); i++) { wxVideoMode* m = new wxVideoMode(arr.Item(i)); @@ -182,7 +227,22 @@ function is not supported at all on this platform.", ""); DocDeclStr( virtual bool , ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode), - "Change current mode, return true if succeeded, false otherwise", ""); + "Changes the video mode of this display to the mode specified in the +mode parameter. + +If wx.DefaultVideoMode is passed in as the mode parameter, the defined +behaviour is that wx.Display will reset the video mode to the default +mode used by the display. On Windows, the behavior is normal. +However, there are differences on other platforms. On Unix variations +using X11 extensions it should behave as defined, but some +irregularities may occur. + +On wxMac passing in wx.DefaultVideoMode as the mode parameter does +nothing. This happens because Carbon no longer has access to +DMUseScreenPrefs, an undocumented function that changed the video mode +to the system default by using the system's 'scrn' resource. + +Returns True if succeeded, False otherwise", ""); DocDeclStr(