]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxPython/src/_extras.py
wxLocale now uses wxEncodingConverter (must be explicitly enabled)
[wxWidgets.git] / utils / wxPython / src / _extras.py
index 564f3aa353eeb15255a13155be059e6f18592ec1..686803f320c2c1b47c66a7e73398b098a4a2a8e8 100644 (file)
@@ -146,12 +146,29 @@ def EVT_ICONIZE(win, func):
 def EVT_NAVIGATION_KEY(win, func):
     win.Connect(-1, -1, wxEVT_NAVIGATION_KEY, func)
 
+def EVT_PALETTE_CHANGED(win, func):
+    win.Connect(-1, -1, wxEVT_PALETTE_CHANGED, func)
+
+def EVT_QUERY_NEW_PALETTE(win, func):
+    win.Connect(-1, -1, wxEVT_QUERY_NEW_PALETTE, func)
+
+def EVT_WINDOW_CREATE(win, func):
+    win.Connect(-1, -1, wxEVT_CREATE, func)
+
+def EVT_WINDOW_DESTROY(win, func):
+    win.Connect(-1, -1, wxEVT_DESTROY, func)
+
+
+
 def EVT_IDLE(win, func):
     win.Connect(-1, -1, wxEVT_IDLE, func)
 
 def EVT_UPDATE_UI(win, id, func):
     win.Connect(id, -1, wxEVT_UPDATE_UI, func)
 
+def EVT_UPDATE_UI_RANGE(win, id, id2, func):
+    win.Connect(id, id2, wxEVT_UPDATE_UI, func)
+
 
 # Mouse Events
 def EVT_LEFT_DOWN(win, func):
@@ -387,15 +404,25 @@ def EVT_COMBOBOX(win, id, func):
 def EVT_TOOL(win, id, func):
     win.Connect(id, -1, wxEVT_COMMAND_TOOL_CLICKED, func)
 
+def EVT_TOOL_RANGE(win, id, id2, func):
+    win.Connect(id, id2, wxEVT_COMMAND_TOOL_CLICKED, func)
+
 def EVT_TOOL_RCLICKED(win, id, func):
     win.Connect(id, -1, wxEVT_COMMAND_TOOL_RCLICKED, func)
 
+def EVT_TOOL_RCLICKED_RANGE(win, id, id2, func):
+    win.Connect(id, id2, wxEVT_COMMAND_TOOL_RCLICKED, func)
+
 def EVT_TOOL_ENTER(win, id, func):
     win.Connect(id, -1, wxEVT_COMMAND_TOOL_ENTER, func)
 
 def EVT_CHECKLISTBOX(win, id, func):
     win.Connect(id, -1, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, func)
 
+def EVT_SPINCTRL(win, id, func):
+    win.Connect(id, -1, wxEVT_COMMAND_SPINCTRL_UPDATED, func)
+
+
 
 # Generic command events
 
@@ -472,6 +499,15 @@ def EVT_TREE_KEY_DOWN(win, id, func):
 def EVT_TREE_DELETE_ITEM(win, id, func):
     win.Connect(id, -1, wxEVT_COMMAND_TREE_DELETE_ITEM, func)
 
+def EVT_TREE_ITEM_ACTIVATED(win, id, func):
+    win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_ACTIVATED, func)
+
+def EVT_TREE_ITEM_RIGHT_CLICK(win, id, func):
+    win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, func)
+
+def EVT_TREE_ITEM_MIDDLE_CLICK(win, id, func):
+    win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, func)
+
 
 # wxSpinButton
 def EVT_SPIN_UP(win, id, func):
@@ -654,6 +690,8 @@ wxPyDefaultSize.Set(-1,-1)
 wxDefaultPosition  = wxPyDefaultPosition
 wxDefaultSize      = wxPyDefaultSize
 
+# backwards compatibility
+wxNoRefBitmap      = wxBitmap
 
 #----------------------------------------------------------------------
 # This helper function will take a wxPython object and convert it to
@@ -683,7 +721,8 @@ def wxPyTypeCast(obj, typeStr):
         newPtr = ptrcast(obj, typeStr+"_p")
     theClass = globals()[typeStr+"Ptr"]
     theObj = theClass(newPtr)
-    theObj.thisown = obj.thisown
+    if hasattr(obj, "this"):
+        theObj.thisown = obj.thisown
     return theObj
 
 
@@ -768,11 +807,27 @@ class wxApp(wxPyApp):
         if self.stdioWin != None:
             self.stdioWin.close()
 
+#----------------------------------------------------------------------------
+
+class wxPySimpleApp(wxApp):
+    def __init__(self):
+        wxApp.__init__(self, 0)
+    def OnInit(self):
+        return true
 
 
 #----------------------------------------------------------------------------
 # DO NOT hold any other references to this object.  This is how we know when
-# to cleanup system resources that wxWin is holding...
+# to cleanup system resources that wxWin is holding.  When this module is
+# unloaded, the refcount on __cleanMeUp goes to zero and it calls the
+# wxApp_CleanUp function.
+
+class __wxPyCleanup:
+    def __init__(self):
+        self.cleanup = wxc.wxApp_CleanUp
+    def __del__(self):
+        self.cleanup()
+
 __cleanMeUp = __wxPyCleanup()
 #----------------------------------------------------------------------------