]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/msw/_core.py
the #ifdef around BROWSEINFO.lpszTitle assignment is bogus; should be c_str() everywhere
[wxWidgets.git] / wxPython / src / msw / _core.py
index 95d2d15e10072c86145c4df207d0a4409243e024..9f6243ecb57e844785e58223ec459ff0327007f8 100644 (file)
@@ -206,6 +206,29 @@ ID_NOTOALL = _core_.ID_NOTOALL
 ID_ABORT = _core_.ID_ABORT
 ID_RETRY = _core_.ID_RETRY
 ID_IGNORE = _core_.ID_IGNORE
+ID_ADD = _core_.ID_ADD
+ID_REMOVE = _core_.ID_REMOVE
+ID_UP = _core_.ID_UP
+ID_DOWN = _core_.ID_DOWN
+ID_HOME = _core_.ID_HOME
+ID_REFRESH = _core_.ID_REFRESH
+ID_STOP = _core_.ID_STOP
+ID_INDEX = _core_.ID_INDEX
+ID_BOLD = _core_.ID_BOLD
+ID_ITALIC = _core_.ID_ITALIC
+ID_JUSTIFY_CENTER = _core_.ID_JUSTIFY_CENTER
+ID_JUSTIFY_FILL = _core_.ID_JUSTIFY_FILL
+ID_JUSTIFY_RIGHT = _core_.ID_JUSTIFY_RIGHT
+ID_JUSTIFY_LEFT = _core_.ID_JUSTIFY_LEFT
+ID_UNDERLINE = _core_.ID_UNDERLINE
+ID_INDENT = _core_.ID_INDENT
+ID_UNINDENT = _core_.ID_UNINDENT
+ID_ZOOM_100 = _core_.ID_ZOOM_100
+ID_ZOOM_FIT = _core_.ID_ZOOM_FIT
+ID_ZOOM_IN = _core_.ID_ZOOM_IN
+ID_ZOOM_OUT = _core_.ID_ZOOM_OUT
+ID_UNDELETE = _core_.ID_UNDELETE
+ID_REVERT_TO_SAVED = _core_.ID_REVERT_TO_SAVED
 ID_HIGHEST = _core_.ID_HIGHEST
 OPEN = _core_.OPEN
 SAVE = _core_.SAVE
@@ -292,6 +315,9 @@ BORDER_RAISED = _core_.BORDER_RAISED
 BORDER_SUNKEN = _core_.BORDER_SUNKEN
 BORDER_DOUBLE = _core_.BORDER_DOUBLE
 BORDER_MASK = _core_.BORDER_MASK
+BG_STYLE_SYSTEM = _core_.BG_STYLE_SYSTEM
+BG_STYLE_COLOUR = _core_.BG_STYLE_COLOUR
+BG_STYLE_CUSTOM = _core_.BG_STYLE_CUSTOM
 DEFAULT = _core_.DEFAULT
 DECORATIVE = _core_.DECORATIVE
 ROMAN = _core_.ROMAN
@@ -1588,6 +1614,8 @@ class FSFile(Object):
         self.this = newobj.this
         self.thisown = 1
         del newobj.thisown
+        self.thisown = 0   # It will normally be deleted by the user of the wxFileSystem
+
     def __del__(self, destroy=_core_.delete_FSFile):
         """__del__(self)"""
         try:
@@ -1743,6 +1771,11 @@ class FileSystem(Object):
         return _core_.FileSystem_FileNameToURL(*args, **kwargs)
 
     FileNameToURL = staticmethod(FileNameToURL)
+    def URLToFileName(*args, **kwargs):
+        """URLToFileName(String url) -> String"""
+        return _core_.FileSystem_URLToFileName(*args, **kwargs)
+
+    URLToFileName = staticmethod(URLToFileName)
 
 class FileSystemPtr(FileSystem):
     def __init__(self, this):
@@ -1763,10 +1796,10 @@ def FileSystem_FileNameToURL(*args, **kwargs):
     """FileSystem_FileNameToURL(String filename) -> String"""
     return _core_.FileSystem_FileNameToURL(*args, **kwargs)
 
-
 def FileSystem_URLToFileName(*args, **kwargs):
     """FileSystem_URLToFileName(String url) -> String"""
     return _core_.FileSystem_URLToFileName(*args, **kwargs)
+
 class InternetFSHandler(CPPFileSystemHandler):
     def __repr__(self):
         return "<%s.%s; proxy of C++ wxInternetFSHandler instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
@@ -1837,14 +1870,22 @@ def __wxMemoryFSHandler_AddFile_wxBitmap(*args, **kwargs):
 def __wxMemoryFSHandler_AddFile_Data(*args, **kwargs):
     """__wxMemoryFSHandler_AddFile_Data(String filename, PyObject data)"""
     return _core_.__wxMemoryFSHandler_AddFile_Data(*args, **kwargs)
-def MemoryFSHandler_AddFile(filename, a, b=''):
-    if isinstance(a, wx.Image):
-        __wxMemoryFSHandler_AddFile_wxImage(filename, a, b)
-    elif isinstance(a, wx.Bitmap):
-        __wxMemoryFSHandler_AddFile_wxBitmap(filename, a, b)
-    elif type(a) == str:
-        __wxMemoryFSHandler_AddFile_Data(filename, a)
-    else: raise TypeError, 'wx.Image, wx.Bitmap or string expected'
+def MemoryFSHandler_AddFile(filename, dataItem, imgType=-1):
+    """
+    Add 'file' to the memory filesystem.  The dataItem parameter can
+    either be a `wx.Bitmap`, `wx.Image` or a string that can contain
+    arbitrary data.  If a bitmap or image is used then the imgType
+    parameter should specify what kind of image file it should be
+    written as, wx.BITMAP_TYPE_PNG, etc.
+    """
+    if isinstance(dataItem, wx.Image):
+        __wxMemoryFSHandler_AddFile_wxImage(filename, dataItem, imgType)
+    elif isinstance(dataItem, wx.Bitmap):
+        __wxMemoryFSHandler_AddFile_wxBitmap(filename, dataItem, imgType)
+    elif type(dataItem) == str:
+        __wxMemoryFSHandler_AddFile_Data(filename, dataItem)
+    else:
+        raise TypeError, 'wx.Image, wx.Bitmap or string expected'
 
 class MemoryFSHandler(CPPFileSystemHandler):
     def __repr__(self):
@@ -2060,6 +2101,20 @@ class Image(Object):
         """
         return _core_.Image_FindFirstUnusedColour(*args, **kwargs)
 
+    def ConvertAlphaToMask(*args, **kwargs):
+        """
+        ConvertAlphaToMask(self, byte threshold=128) -> bool
+
+        If the image has alpha channel, this method converts it to mask. All pixels
+        with alpha value less than ``threshold`` are replaced with mask colour and the
+        alpha channel is removed. Mask colour is chosen automatically using
+        `FindFirstUnusedColour`.
+
+        If the image image doesn't have alpha channel, ConvertAlphaToMask does
+        nothing.
+        """
+        return _core_.Image_ConvertAlphaToMask(*args, **kwargs)
+
     def SetMaskFromImage(*args, **kwargs):
         """SetMaskFromImage(self, Image mask, byte mr, byte mg, byte mb) -> bool"""
         return _core_.Image_SetMaskFromImage(*args, **kwargs)
@@ -2262,7 +2317,7 @@ class Image(Object):
 
     GetImageExtWildcard = staticmethod(GetImageExtWildcard)
     def ConvertToBitmap(*args, **kwargs):
-        """ConvertToBitmap(self) -> Bitmap"""
+        """ConvertToBitmap(self, int depth=-1) -> Bitmap"""
         return _core_.Image_ConvertToBitmap(*args, **kwargs)
 
     def ConvertToMonoBitmap(*args, **kwargs):
@@ -5356,6 +5411,69 @@ _sys.__wxPythonCleanup = __wxPyCleanup()
 
 #---------------------------------------------------------------------------
 
+class EventLoop(object):
+    def __repr__(self):
+        return "<%s.%s; proxy of C++ wxEventLoop instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
+    def __init__(self, *args, **kwargs):
+        """__init__(self) -> EventLoop"""
+        newobj = _core_.new_EventLoop(*args, **kwargs)
+        self.this = newobj.this
+        self.thisown = 1
+        del newobj.thisown
+    def __del__(self, destroy=_core_.delete_EventLoop):
+        """__del__(self)"""
+        try:
+            if self.thisown: destroy(self)
+        except: pass
+
+    def Run(*args, **kwargs):
+        """Run(self) -> int"""
+        return _core_.EventLoop_Run(*args, **kwargs)
+
+    def Exit(*args, **kwargs):
+        """Exit(self, int rc=0)"""
+        return _core_.EventLoop_Exit(*args, **kwargs)
+
+    def Pending(*args, **kwargs):
+        """Pending(self) -> bool"""
+        return _core_.EventLoop_Pending(*args, **kwargs)
+
+    def Dispatch(*args, **kwargs):
+        """Dispatch(self) -> bool"""
+        return _core_.EventLoop_Dispatch(*args, **kwargs)
+
+    def IsRunning(*args, **kwargs):
+        """IsRunning(self) -> bool"""
+        return _core_.EventLoop_IsRunning(*args, **kwargs)
+
+    def GetActive(*args, **kwargs):
+        """GetActive() -> EventLoop"""
+        return _core_.EventLoop_GetActive(*args, **kwargs)
+
+    GetActive = staticmethod(GetActive)
+    def SetActive(*args, **kwargs):
+        """SetActive(EventLoop loop)"""
+        return _core_.EventLoop_SetActive(*args, **kwargs)
+
+    SetActive = staticmethod(SetActive)
+
+class EventLoopPtr(EventLoop):
+    def __init__(self, this):
+        self.this = this
+        if not hasattr(self,"thisown"): self.thisown = 0
+        self.__class__ = EventLoop
+_core_.EventLoop_swigregister(EventLoopPtr)
+
+def EventLoop_GetActive(*args, **kwargs):
+    """EventLoop_GetActive() -> EventLoop"""
+    return _core_.EventLoop_GetActive(*args, **kwargs)
+
+def EventLoop_SetActive(*args, **kwargs):
+    """EventLoop_SetActive(EventLoop loop)"""
+    return _core_.EventLoop_SetActive(*args, **kwargs)
+
+#---------------------------------------------------------------------------
+
 class AcceleratorEntry(object):
     """
     A class used to define items in an `wx.AcceleratorTable`.  wxPython
@@ -6987,6 +7105,39 @@ class Window(EvtHandler):
         """
         return _core_.Window_GetForegroundColour(*args, **kwargs)
 
+    def SetBackgroundStyle(*args, **kwargs):
+        """
+        SetBackgroundStyle(self, int style) -> bool
+
+        Returns the background style of the window. The background style
+        indicates how the background of the window is drawn.
+
+            ======================  ========================================
+            wx.BG_STYLE_SYSTEM      The background colour or pattern should
+                                    be determined by the system
+            wx.BG_STYLE_COLOUR      The background should be a solid colour
+            wx.BG_STYLE_CUSTOM      The background will be implemented by the
+                                    application.
+            ======================  ========================================
+
+        On GTK+, use of wx.BG_STYLE_CUSTOM allows the flicker-free drawing of
+        a custom background, such as a tiled bitmap. Currently the style has
+        no effect on other platforms.
+
+        :see: `GetBackgroundStyle`, `SetBackgroundColour`
+        """
+        return _core_.Window_SetBackgroundStyle(*args, **kwargs)
+
+    def GetBackgroundStyle(*args, **kwargs):
+        """
+        GetBackgroundStyle(self) -> int
+
+        Returns the background style of the window.
+
+        :see: `SetBackgroundStyle`
+        """
+        return _core_.Window_GetBackgroundStyle(*args, **kwargs)
+
     def SetCursor(*args, **kwargs):
         """
         SetCursor(self, Cursor cursor) -> bool
@@ -7185,6 +7336,22 @@ class Window(EvtHandler):
         """
         return _core_.Window_GetHandle(*args, **kwargs)
 
+    def AssociateHandle(*args, **kwargs):
+        """
+        AssociateHandle(self, long handle)
+
+        Associate the window with a new native handle
+        """
+        return _core_.Window_AssociateHandle(*args, **kwargs)
+
+    def DissociateHandle(*args, **kwargs):
+        """
+        DissociateHandle(self)
+
+        Dissociate the current native handle from the window
+        """
+        return _core_.Window_DissociateHandle(*args, **kwargs)
+
     def OnPaint(*args, **kwargs):
         """OnPaint(self, PaintEvent event)"""
         return _core_.Window_OnPaint(*args, **kwargs)
@@ -7447,7 +7614,7 @@ class Window(EvtHandler):
         layout sizer object is already owned by the window, it will be deleted
         if the deleteOld parameter is true. Note that this function will also
         call SetAutoLayout implicitly with a True parameter if the sizer is
-        non-NoneL and False otherwise.
+        non-None, and False otherwise.
         """
         return _core_.Window_SetSizer(*args, **kwargs)
 
@@ -9302,12 +9469,13 @@ class Sizer(Object):
 
     def Show(*args, **kwargs):
         """
-        Show(self, item, bool show=True)
+        Show(self, item, bool show=True, bool recursive=false) -> bool
 
         Shows or hides an item managed by the sizer.  To make a sizer item
         disappear or reappear, use Show followed by `Layout`.  The *item*
         parameter can be either a window, a sizer, or the zero-based index of
-        the item.
+        the item.  Use the recursive parameter to show or hide an item in a
+        subsizer.  Returns True if the item was found.
         """
         return _core_.Sizer_Show(*args, **kwargs)
 
@@ -9322,11 +9490,11 @@ class Sizer(Object):
         """
         return _core_.Sizer_IsShown(*args, **kwargs)
 
-    def Hide(self, item):
+    def Hide(self, item, recursive=False):
         """
-        A convenience method for Show(item, False).
+        A convenience method for Show(item, False, recursive).
         """
-        self.Show(item, False)
+        return self.Show(item, false, recursive)
 
     def ShowItems(*args, **kwargs):
         """
@@ -10565,16 +10733,16 @@ __wxPyPtrTypeMap['wxStatusBar95']   = 'wxStatusBar'
 
 #----------------------------------------------------------------------------
 # Load version numbers from __version__...  Ensure that major and minor
-# versions are the same for both wxPython and wxWindows.
+# versions are the same for both wxPython and wxWidgets.
 
 from __version__ import *
 __version__ = VERSION_STRING
 
-assert MAJOR_VERSION == _core_.MAJOR_VERSION, "wxPython/wxWindows version mismatch"
-assert MINOR_VERSION == _core_.MINOR_VERSION, "wxPython/wxWindows version mismatch"
+assert MAJOR_VERSION == _core_.MAJOR_VERSION, "wxPython/wxWidgets version mismatch"
+assert MINOR_VERSION == _core_.MINOR_VERSION, "wxPython/wxWidgets version mismatch"
 if RELEASE_VERSION != _core_.RELEASE_VERSION:
     import warnings
-    warnings.warn("wxPython/wxWindows release number mismatch")
+    warnings.warn("wxPython/wxWidgets release number mismatch")
 
 #----------------------------------------------------------------------------