]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxDisplay and wxVideoMode
authorRobin Dunn <robin@alldunn.com>
Tue, 9 Mar 2004 22:01:29 +0000 (22:01 +0000)
committerRobin Dunn <robin@alldunn.com>
Tue, 9 Mar 2004 22:01:29 +0000 (22:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26149 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/distrib/wxPythonFull.spec.in
wxPython/docs/BUILD.txt
wxPython/docs/CHANGES.txt
wxPython/setup.py
wxPython/src/_display.i [new file with mode: 0644]
wxPython/src/_misc_rename.i
wxPython/src/misc.i

index ef201326ef7cd899049a9368c3907f2e4b48bf5a..f21a9c349d1cb740fb486ba7215f1037b931e5a5 100644 (file)
@@ -108,6 +108,8 @@ cd bld
 %endif
        --enable-geometry \
        --enable-optimise \
 %endif
        --enable-geometry \
        --enable-optimise \
+       --enable-sound \
+       --enable-display \
 %if %{debug_flag}
        --enable-debug_flag \
 %endif
 %if %{debug_flag}
        --enable-debug_flag \
 %endif
index 7a185e1f09005d675c15ebe8b5095a7168d36e5d..6f5d4f519fa7e592ce14eb43c1bdbadbd5078323 100644 (file)
@@ -59,10 +59,12 @@ place, then do the same for wxPython.
                      --disable-monolithic \
                      --enable-debug \
                      --enable-geometry \
                      --disable-monolithic \
                      --enable-debug \
                      --enable-geometry \
+                     --enable-sound \
+                     --enable-display \
                      
 
    On OS X of course you'll want to use --with-mac instead of
                      
 
    On OS X of course you'll want to use --with-mac instead of
-   --with-gtk.  For GTK2 and unicode add:
+   --with-gtk.  For GTK2 and unicode add::
                         
                      --enable-gtk2 \
                      --enable-unicode \
                         
                      --enable-gtk2 \
                      --enable-unicode \
index 61f1c96e0834160992a9a8f7a509c6e052d68635..c0978cdeace313f3f6f64fc8dd5adfa006767473 100644 (file)
@@ -1,7 +1,7 @@
 CHANGES.txt for wxPython
 =====================================================================
 
 CHANGES.txt for wxPython
 =====================================================================
 
-2.5.1.x
+2.5.1.1
 -------
 
 (See also the MigrationGuide.txt file for details about some of the
 -------
 
 (See also the MigrationGuide.txt file for details about some of the
@@ -78,6 +78,8 @@ it.
 Updated wx.lib.calendar with many fixes and enhancements from Joerg
 "Adi" Sieker. 
 
 Updated wx.lib.calendar with many fixes and enhancements from Joerg
 "Adi" Sieker. 
 
+Added wx.Display and wx.VideoMode.
+
 
 
 
 
 
 
index 1434f661e647af3df33fbef1dc9df02f13f47c56..1415f77ede3e89555eff45f22a634693bfa782e5 100755 (executable)
@@ -107,6 +107,7 @@ WXPORT = 'gtk'     # On Linux/Unix there are several ports of wxWindows availabl
 
 BUILD_BASE = "build"       # Directory to use for temporary build files.
 
 
 BUILD_BASE = "build"       # Directory to use for temporary build files.
 
+CONTRIBS_INC = ""  # A dir to add as an -I flag when compiling the contribs
 
 
 # Some MSW build settings
 
 
 # Some MSW build settings
@@ -190,7 +191,8 @@ for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
                 sys.argv[x] = ''
 
 # String options
                 sys.argv[x] = ''
 
 # String options
-for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT', 'SWIG']:
+for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT', 'SWIG',
+               'CONTRIBS_INC']:
     for x in range(len(sys.argv)):
         if sys.argv[x].find(option) == 0:
             pos = sys.argv[x].find('=') + 1
     for x in range(len(sys.argv)):
         if sys.argv[x].find(option) == 0:
             pos = sys.argv[x].find('=') + 1
@@ -591,7 +593,7 @@ elif os.name == 'posix':
 
 #----------------------------------------------------------------------
 else:
 
 #----------------------------------------------------------------------
 else:
-    raise 'Sorry Charlie, platform not supported...'
+    raise 'Sorry, platform not supported...'
 
 
 #----------------------------------------------------------------------
 
 
 #----------------------------------------------------------------------
@@ -836,7 +838,7 @@ swig_sources = run_swig(['misc.i'], 'src', GENDIR, PKGDIR,
                           'src/_sound.i',         'src/_mimetype.i',
                           'src/_artprov.i',       'src/_config.i',
                           'src/_datetime.i',      'src/_dataobj.i',
                           'src/_sound.i',         'src/_mimetype.i',
                           'src/_artprov.i',       'src/_config.i',
                           'src/_datetime.i',      'src/_dataobj.i',
-                          'src/_dnd.i',
+                          'src/_dnd.i',           'src/_display.i',
                           'src/_clipbrd.i',
                           ])
 ext = Extension('_misc', swig_sources,
                           'src/_clipbrd.i',
                           ])
 ext = Extension('_misc', swig_sources,
@@ -914,8 +916,10 @@ ext = Extension('_wizard', swig_sources,
 wxpExtensions.append(ext)
 
 
 wxpExtensions.append(ext)
 
 
+#----------------------------------------------------------------------
 
 
-
+if CONTRIBS_INC:
+    includes += [ CONTRIBS_INC ]
 
 #----------------------------------------------------------------------
 # Define the GLCanvas extension module
 
 #----------------------------------------------------------------------
 # Define the GLCanvas extension module
diff --git a/wxPython/src/_display.i b/wxPython/src/_display.i
new file mode 100644 (file)
index 0000000..04ad845
--- /dev/null
@@ -0,0 +1,196 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        _display.i
+// Purpose:     SWIG interface for wxVideoMode and wxDisplay
+//
+// Author:      Robin Dunn
+//
+// Created:     9-Mar-2004
+// RCS-ID:      $Id$
+// Copyright:   (c) 2004 by Total Control Software
+// Licence:     wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// Not a %module
+
+
+//---------------------------------------------------------------------------
+
+%{
+#include "wx/display.h"
+%}
+
+
+//---------------------------------------------------------------------------
+%newgroup
+
+
+DocStr(wxVideoMode,
+       "A simple struct containing video mode parameters for a display");
+
+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
+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");
+    
+    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() }
+    %extend {
+        bool __eq__(const wxVideoMode* other) { return other ? (*self == *other) : False; }
+        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;
+
+    // bits per pixel (e.g. 32), 1 is monochrome and 0 means unspecified/known
+    int bpp;
+
+    // refresh frequency in Hz, 0 means unspecified/unknown
+    int refresh;
+};
+
+
+%immutable;
+const wxVideoMode     wxDefaultVideoMode;
+%mutable;
+
+
+//---------------------------------------------------------------------------
+
+DocStr(wxDisplay,
+       "Represents a display/monitor attached to the system");
+
+
+class wxDisplay
+{
+public:
+    // 
+    DocCtorStr(
+        wxDisplay(size_t 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();
+    
+    DocDeclStr(
+        static size_t , 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,
+        "Return true if the object was initialized successfully");
+    %pythoncode { def __nonzero__(self): return self.IsOk() }
+
+    DocDeclStr(
+        virtual wxRect , GetGeometry() const,
+        "Returns the bounding rectangle of the display whose index was
+passed to the constructor.");
+    
+
+    DocDeclStr(
+        virtual 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
+display is the one whose index is 0.");
+    
+
+
+    %extend {
+        DocAStr(GetModes,
+                "GetModes(VideoMode mode=DefaultVideoMode) -> [videoMode...]",
+                "Enumerate all video modes supported by this display matching the
+given one (in the sense of VideoMode.Match()).
+
+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* pyList = NULL;
+            wxArrayVideoModes arr = self->GetModes(mode);
+            wxPyBeginBlockThreads();
+            pyList = PyList_New(0);
+            for (int i=0; i < arr.GetCount(); i++) {
+                wxVideoMode* m = new wxVideoMode(arr.Item(i));
+                PyObject* pyObj = wxPyConstructObject(m, wxT("wxVideoMode"), true);
+                PyList_Append(pyList, pyObj);
+            }
+            wxPyEndBlockThreads();
+            return pyList;
+        }
+    }
+    
+
+    DocDeclStr(
+        virtual wxVideoMode , GetCurrentMode() const,
+        "Get the current video mode.");
+    
+
+    DocDeclStr(
+        virtual bool , ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode),
+        "Change current mode, return true if succeeded, false otherwise");
+    
+
+    DocDeclStr(
+        void , ResetMode(),
+        "Restore the default video mode (just a more readable synonym)");
+    
+
+};
+
+//---------------------------------------------------------------------------
index 17f90a74bf0b0093771718b1f92a55861db96627..c1f9c5c3e9cee76167e5823392a3a42136b35fe5 100644 (file)
 %rename(Clipboard)                          wxClipboard;
 %rename(TheClipboard)                       wxTheClipboard;
 %rename(ClipboardLocker)                    wxClipboardLocker;
 %rename(Clipboard)                          wxClipboard;
 %rename(TheClipboard)                       wxTheClipboard;
 %rename(ClipboardLocker)                    wxClipboardLocker;
+%rename(VideoMode)                          wxVideoMode;
+%rename(DefaultVideoMode)                   wxDefaultVideoMode;
+%rename(Display)                            wxDisplay;
 
 #endif
 
 #endif
index 84fb2092ba4e5720b0683615386e384a6886cf46..37342395a00ba00a2a05c7d4c0b5fa7fe6657b8c 100644 (file)
@@ -50,6 +50,6 @@ MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
 %include _dataobj.i
 %include _dnd.i
 %include _clipbrd.i
 %include _dataobj.i
 %include _dnd.i
 %include _clipbrd.i
-
+%include _display.i
 
 //---------------------------------------------------------------------------
 
 //---------------------------------------------------------------------------