X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4617be085fb55acce74f4d4687b098918dc9d107..c33c11fa1d2a0c4999e04386e04ac96cd350e853:/wxPython/src/_display.i diff --git a/wxPython/src/_display.i b/wxPython/src/_display.i index 32a52cd25c..1003365dfc 100644 --- a/wxPython/src/_display.i +++ b/wxPython/src/_display.i @@ -17,6 +17,7 @@ %{ #include +#include %} @@ -31,32 +32,30 @@ struct wxVideoMode { wxVideoMode(int width = 0, int height = 0, int depth = 0, int freq = 0); ~wxVideoMode(); - + DocDeclStr( bool , Matches(const wxVideoMode& other) const, - "Returns true if this mode matches the other one in the sense that all -non zero fields of the other mode have the same value in this + "Returns True if this mode matches the other one in the sense that all +non-zero fields of the other mode have the same value in this one (except for refresh which is allowed to have a greater value)", ""); DocDeclStr( int , GetWidth() const, "Returns the screen width in pixels (e.g. 640*480), 0 means unspecified", ""); - + DocDeclStr( int , GetHeight() const, - "Returns the screen width in pixels (e.g. 640*480), 0 means -unspecified", ""); - + "Returns the screen height in pixels (e.g. 640*480), 0 means unspecified", ""); + DocDeclStr( int , GetDepth() const, "Returns the screen's bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known", ""); - + DocDeclStr( bool , IsOk() const, "returns true if the object has been initialized", ""); - %pythoncode { def __nonzero__(self): return self.IsOk() } @@ -65,7 +64,7 @@ means unspecified/known", ""); bool __ne__(const wxVideoMode* other) { return other ? (*self != *other) : true; } } - + // the screen size in pixels (e.g. 640*480), 0 means unspecified int w, h; @@ -74,9 +73,19 @@ means unspecified/known", ""); // refresh frequency in Hz, 0 means unspecified/unknown int refresh; + + %property(Depth, GetDepth, doc="See `GetDepth`"); + %property(Height, GetHeight, doc="See `GetHeight`"); + %property(Width, GetWidth, doc="See `GetWidth`"); }; +%{ +#if !wxUSE_DISPLAY +const wxVideoMode wxDefaultVideoMode; +#endif +%} + %immutable; const wxVideoMode wxDefaultVideoMode; %mutable; @@ -85,114 +94,63 @@ const wxVideoMode wxDefaultVideoMode; //--------------------------------------------------------------------------- -%{ -// 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: - // DocCtorStr( - wxDisplay(size_t index = 0), + wxDisplay(unsigned index = 0), "Set up a Display instance with the specified display. The displays are numbered from 0 to GetCount() - 1, 0 is always the primary display and the only one which is always supported", ""); - virtual ~wxDisplay(); - + ~wxDisplay(); + DocDeclStr( - static size_t , GetCount(), + static unsigned , GetCount(), "Return the number of available displays.", ""); - DocDeclStr( static int , GetFromPoint(const wxPoint& pt), "Find the display where the given point lies, return wx.NOT_FOUND if it doesn't belong to any display", ""); - DocStr(GetFromWindow, "Find the display where the given window lies, return wx.NOT_FOUND if it is not shown at all.", ""); -#ifdef __WXMSW__ + static int GetFromWindow(wxWindow *window); -#else - %extend { - static int GetFromWindow(wxWindow *window) - { wxPyRaiseNotImplemented(); return wxNOT_FOUND; } - } -#endif - + + DocDeclStr( - virtual bool , IsOk() const, + bool , IsOk() const, "Return true if the object was initialized successfully", ""); %pythoncode { def __nonzero__(self): return self.IsOk() } - DocDeclStr( - virtual wxRect , GetGeometry() const, + wxRect , GetGeometry() const, "Returns the bounding rectangle of the display whose index was passed to the constructor.", ""); - DocDeclStr( - virtual wxString , GetName() const, + wxRect , GetClientArea() const, + "Returns the bounding rectangle the client area of the display, +i.e., without taskbars and such.", ""); + + DocDeclStr( + wxString , GetName() const, "Returns the display's name. A name is not available on all platforms.", ""); - DocDeclStr( bool , IsPrimary() const, - "Returns true if the display is the primary display. The primary + "Returns True if the display is the primary display. The primary display is the one whose index is 0.", ""); - - %extend { + %extend + { DocAStr(GetModes, "GetModes(VideoMode mode=DefaultVideoMode) -> [videoMode...]", "Enumerate all video modes supported by this display matching the given @@ -202,13 +160,16 @@ As any mode matches the default value of the argument and there is always at least one video mode supported by display, the returned array is only empty for the default value of the argument if this function is not supported at all on this platform.", ""); - - PyObject* GetModes(const wxVideoMode& mode = wxDefaultVideoMode) { + + PyObject* GetModes(const wxVideoMode& mode = wxDefaultVideoMode) + { +%#if wxUSE_DISPLAY PyObject* pyList = NULL; wxArrayVideoModes arr = self->GetModes(mode); wxPyBlock_t blocked = wxPyBeginBlockThreads(); pyList = PyList_New(0); - for (int i=0; i < arr.GetCount(); i++) { + for (size_t i=0; i < arr.GetCount(); i++) + { wxVideoMode* m = new wxVideoMode(arr.Item(i)); PyObject* pyObj = wxPyConstructObject(m, wxT("wxVideoMode"), true); PyList_Append(pyList, pyObj); @@ -216,18 +177,28 @@ function is not supported at all on this platform.", ""); } wxPyEndBlockThreads(blocked); return pyList; +%#else + wxPyRaiseNotImplemented(); + return NULL; +%#endif } - } - - DocDeclStr( - virtual wxVideoMode , GetCurrentMode() const, - "Get the current video mode.", ""); - + DocStr(GetCurrentMode, + "Get the current video mode.", ""); + wxVideoMode GetCurrentMode() const + { +%#if wxUSE_DISPLAY + return self->GetCurrentMode(); +%#else + wxPyRaiseNotImplemented(); + return wxDefaultVideoMode; +%#endif + } - DocDeclStr( - virtual bool , ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode), - "Changes the video mode of this display to the mode specified in the + + DocStr( + ChangeMode, + "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 @@ -243,13 +214,38 @@ 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( - void , ResetMode(), - "Restore the default video mode (just a more readable synonym)", ""); - + bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode) + { +%#if wxUSE_DISPLAY + return self->ChangeMode(mode); +%#else + wxPyRaiseNotImplemented(); + return false; +%#endif + } + + DocStr( + ResetMode, + "Restore the default video mode (just a more readable synonym)", ""); + void ResetMode() + { +%#if wxUSE_DISPLAY + self->ResetMode(); +%#else + wxPyRaiseNotImplemented(); +%#endif + } + + } // end of %extend + + %property(ClientArea, GetClientArea, doc="See `GetClientArea`"); + %property(CurrentMode, GetCurrentMode, doc="See `GetCurrentMode`"); + %property(Geometry, GetGeometry, doc="See `GetGeometry`"); + %property(Modes, GetModes, doc="See `GetModes`"); + %property(Name, GetName, doc="See `GetName`"); + }; //---------------------------------------------------------------------------