from misc import *
+from misc2 import *
+
from windows import *
from gdi import *
from windows3 import *
from image import *
+
+from printfw import *
class wxPyAppPtr(wxEvtHandlerPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
- def GetAppName(self):
- val = wxc.wxPyApp_GetAppName(self.this)
+ def __del__(self,wxc=wxc):
+ if self.thisown == 1 :
+ wxc.delete_wxPyApp(self)
+ def GetAppName(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_GetAppName,(self,) + _args, _kwargs)
+ return val
+ def GetClassName(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_GetClassName,(self,) + _args, _kwargs)
return val
- def GetClassName(self):
- val = wxc.wxPyApp_GetClassName(self.this)
+ def GetExitOnFrameDelete(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_GetExitOnFrameDelete,(self,) + _args, _kwargs)
return val
- def GetExitOnFrameDelete(self):
- val = wxc.wxPyApp_GetExitOnFrameDelete(self.this)
+ def GetPrintMode(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_GetPrintMode,(self,) + _args, _kwargs)
return val
- def GetPrintMode(self):
- val = wxc.wxPyApp_GetPrintMode(self.this)
+ def GetTopWindow(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_GetTopWindow,(self,) + _args, _kwargs)
+ if val: val = wxWindowPtr(val)
return val
- def GetTopWindow(self):
- val = wxc.wxPyApp_GetTopWindow(self.this)
- val = wxWindowPtr(val)
+ def GetVendorName(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_GetVendorName,(self,) + _args, _kwargs)
return val
- def GetVendorName(self):
- val = wxc.wxPyApp_GetVendorName(self.this)
+ def Dispatch(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_Dispatch,(self,) + _args, _kwargs)
return val
- def Dispatch(self):
- val = wxc.wxPyApp_Dispatch(self.this)
+ def ExitMainLoop(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_ExitMainLoop,(self,) + _args, _kwargs)
return val
- def ExitMainLoop(self):
- val = wxc.wxPyApp_ExitMainLoop(self.this)
+ def Initialized(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_Initialized,(self,) + _args, _kwargs)
return val
- def Initialized(self):
- val = wxc.wxPyApp_Initialized(self.this)
+ def MainLoop(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_MainLoop,(self,) + _args, _kwargs)
return val
- def MainLoop(self):
- val = wxc.wxPyApp_MainLoop(self.this)
+ def Pending(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_Pending,(self,) + _args, _kwargs)
return val
- def Pending(self):
- val = wxc.wxPyApp_Pending(self.this)
+ def ProcessIdle(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_ProcessIdle,(self,) + _args, _kwargs)
return val
- def SetAppName(self,arg0):
- val = wxc.wxPyApp_SetAppName(self.this,arg0)
+ def SetAppName(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_SetAppName,(self,) + _args, _kwargs)
return val
- def SetClassName(self,arg0):
- val = wxc.wxPyApp_SetClassName(self.this,arg0)
+ def SetClassName(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_SetClassName,(self,) + _args, _kwargs)
return val
- def SetExitOnFrameDelete(self,arg0):
- val = wxc.wxPyApp_SetExitOnFrameDelete(self.this,arg0)
+ def SetExitOnFrameDelete(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_SetExitOnFrameDelete,(self,) + _args, _kwargs)
return val
- def SetPrintMode(self,arg0):
- val = wxc.wxPyApp_SetPrintMode(self.this,arg0)
+ def SetPrintMode(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_SetPrintMode,(self,) + _args, _kwargs)
return val
- def SetTopWindow(self,arg0):
- val = wxc.wxPyApp_SetTopWindow(self.this,arg0.this)
+ def SetTopWindow(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_SetTopWindow,(self,) + _args, _kwargs)
return val
- def SetVendorName(self,arg0):
- val = wxc.wxPyApp_SetVendorName(self.this,arg0)
+ def SetVendorName(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_SetVendorName,(self,) + _args, _kwargs)
return val
- def AfterMainLoop(self):
- val = wxc.wxPyApp_AfterMainLoop(self.this)
+ def GetStdIcon(self, *_args, **_kwargs):
+ val = apply(wxc.wxPyApp_GetStdIcon,(self,) + _args, _kwargs)
+ if val: val = wxIconPtr(val) ; val.thisown = 1
return val
def __repr__(self):
- return "<C wxPyApp instance>"
+ return "<C wxPyApp instance at %s>" % (self.this,)
class wxPyApp(wxPyAppPtr):
- def __init__(self) :
- self.this = wxc.new_wxPyApp()
+ def __init__(self,*_args,**_kwargs):
+ self.this = apply(wxc.new_wxPyApp,_args,_kwargs)
+ self.thisown = 1
+
+
+
+
+class __wxPyCleanupPtr :
+ def __init__(self,this):
+ self.this = this
+ self.thisown = 0
+ def __del__(self,wxc=wxc):
+ if self.thisown == 1 :
+ wxc.delete___wxPyCleanup(self)
+ def __repr__(self):
+ return "<C __wxPyCleanup instance at %s>" % (self.this,)
+class __wxPyCleanup(__wxPyCleanupPtr):
+ def __init__(self,*_args,**_kwargs):
+ self.this = apply(wxc.new___wxPyCleanup,_args,_kwargs)
self.thisown = 1
#-------------- FUNCTION WRAPPERS ------------------
+ptrcast = wxc.ptrcast
+
+ptrvalue = wxc.ptrvalue
+
+ptrset = wxc.ptrset
+
+ptrcreate = wxc.ptrcreate
+
+ptrfree = wxc.ptrfree
+
+ptradd = wxc.ptradd
+
+ptrmap = wxc.ptrmap
+
_wxStart = wxc._wxStart
_wxSetDictionary = wxc._wxSetDictionary
wxDEFAULT_FRAME_STYLE = wxc.wxDEFAULT_FRAME_STYLE
wxDEFAULT_DIALOG_STYLE = wxc.wxDEFAULT_DIALOG_STYLE
wxFRAME_TOOL_WINDOW = wxc.wxFRAME_TOOL_WINDOW
+wxFRAME_FLOAT_ON_PARENT = wxc.wxFRAME_FLOAT_ON_PARENT
wxCLIP_CHILDREN = wxc.wxCLIP_CHILDREN
wxRETAINED = wxc.wxRETAINED
wxBACKINGSTORE = wxc.wxBACKINGSTORE
wxTE_PROCESS_ENTER = wxc.wxTE_PROCESS_ENTER
wxTE_PASSWORD = wxc.wxTE_PASSWORD
wxTE_READONLY = wxc.wxTE_READONLY
+wxTE_RICH = wxc.wxTE_RICH
wxTE_MULTILINE = wxc.wxTE_MULTILINE
wxCB_SIMPLE = wxc.wxCB_SIMPLE
wxCB_DROPDOWN = wxc.wxCB_DROPDOWN
wxGA_PROGRESSBAR = wxc.wxGA_PROGRESSBAR
wxGA_HORIZONTAL = wxc.wxGA_HORIZONTAL
wxGA_VERTICAL = wxc.wxGA_VERTICAL
+wxGA_SMOOTH = wxc.wxGA_SMOOTH
wxSL_HORIZONTAL = wxc.wxSL_HORIZONTAL
wxSL_VERTICAL = wxc.wxSL_VERTICAL
wxSL_AUTOTICKS = wxc.wxSL_AUTOTICKS
wxTR_HAS_BUTTONS = wxc.wxTR_HAS_BUTTONS
wxTR_EDIT_LABELS = wxc.wxTR_EDIT_LABELS
wxTR_LINES_AT_ROOT = wxc.wxTR_LINES_AT_ROOT
+wxTR_MULTIPLE = wxc.wxTR_MULTIPLE
+wxTR_HAS_VARIABLE_ROW_HEIGHT = wxc.wxTR_HAS_VARIABLE_ROW_HEIGHT
wxLC_ICON = wxc.wxLC_ICON
wxLC_SMALL_ICON = wxc.wxLC_SMALL_ICON
wxLC_LIST = wxc.wxLC_LIST
wxSIZE_ALLOW_MINUS_ONE = wxc.wxSIZE_ALLOW_MINUS_ONE
wxPORTRAIT = wxc.wxPORTRAIT
wxLANDSCAPE = wxc.wxLANDSCAPE
+wxPRINT_QUALITY_HIGH = wxc.wxPRINT_QUALITY_HIGH
+wxPRINT_QUALITY_MEDIUM = wxc.wxPRINT_QUALITY_MEDIUM
+wxPRINT_QUALITY_LOW = wxc.wxPRINT_QUALITY_LOW
+wxPRINT_QUALITY_DRAFT = wxc.wxPRINT_QUALITY_DRAFT
wxID_OPEN = wxc.wxID_OPEN
wxID_CLOSE = wxc.wxID_CLOSE
wxID_NEW = wxc.wxID_NEW
wxACCEL_ALT = wxc.wxACCEL_ALT
wxACCEL_CTRL = wxc.wxACCEL_CTRL
wxACCEL_SHIFT = wxc.wxACCEL_SHIFT
+wxPD_AUTO_HIDE = wxc.wxPD_AUTO_HIDE
+wxPD_APP_MODAL = wxc.wxPD_APP_MODAL
+wxPD_CAN_ABORT = wxc.wxPD_CAN_ABORT
+wxPD_ELAPSED_TIME = wxc.wxPD_ELAPSED_TIME
+wxPD_ESTIMATED_TIME = wxc.wxPD_ESTIMATED_TIME
+wxPD_REMAINING_TIME = wxc.wxPD_REMAINING_TIME
+wxNO_DEFAULT = wxc.wxNO_DEFAULT
+wxMENU_TEAROFF = wxc.wxMENU_TEAROFF
+wxNO_FULL_REPAINT_ON_RESIZE = wxc.wxNO_FULL_REPAINT_ON_RESIZE
wxDEFAULT = wxc.wxDEFAULT
wxDECORATIVE = wxc.wxDECORATIVE
wxROMAN = wxc.wxROMAN
wxPAPER_A2 = wxc.wxPAPER_A2
wxPAPER_A3_TRANSVERSE = wxc.wxPAPER_A3_TRANSVERSE
wxPAPER_A3_EXTRA_TRANSVERSE = wxc.wxPAPER_A3_EXTRA_TRANSVERSE
+wxDUPLEX_SIMPLEX = wxc.wxDUPLEX_SIMPLEX
+wxDUPLEX_HORIZONTAL = wxc.wxDUPLEX_HORIZONTAL
+wxDUPLEX_VERTICAL = wxc.wxDUPLEX_VERTICAL
FALSE = wxc.FALSE
false = wxc.false
TRUE = wxc.TRUE
wxEVT_NC_MIDDLE_DCLICK = wxc.wxEVT_NC_MIDDLE_DCLICK
wxEVT_NC_RIGHT_DCLICK = wxc.wxEVT_NC_RIGHT_DCLICK
wxEVT_CHAR = wxc.wxEVT_CHAR
+wxEVT_KEY_DOWN = wxc.wxEVT_KEY_DOWN
+wxEVT_KEY_UP = wxc.wxEVT_KEY_UP
+wxEVT_CHAR_HOOK = wxc.wxEVT_CHAR_HOOK
wxEVT_SCROLL_TOP = wxc.wxEVT_SCROLL_TOP
wxEVT_SCROLL_BOTTOM = wxc.wxEVT_SCROLL_BOTTOM
wxEVT_SCROLL_LINEUP = wxc.wxEVT_SCROLL_LINEUP
wxEVT_SCROLL_PAGEUP = wxc.wxEVT_SCROLL_PAGEUP
wxEVT_SCROLL_PAGEDOWN = wxc.wxEVT_SCROLL_PAGEDOWN
wxEVT_SCROLL_THUMBTRACK = wxc.wxEVT_SCROLL_THUMBTRACK
+wxEVT_SCROLLWIN_TOP = wxc.wxEVT_SCROLLWIN_TOP
+wxEVT_SCROLLWIN_BOTTOM = wxc.wxEVT_SCROLLWIN_BOTTOM
+wxEVT_SCROLLWIN_LINEUP = wxc.wxEVT_SCROLLWIN_LINEUP
+wxEVT_SCROLLWIN_LINEDOWN = wxc.wxEVT_SCROLLWIN_LINEDOWN
+wxEVT_SCROLLWIN_PAGEUP = wxc.wxEVT_SCROLLWIN_PAGEUP
+wxEVT_SCROLLWIN_PAGEDOWN = wxc.wxEVT_SCROLLWIN_PAGEDOWN
+wxEVT_SCROLLWIN_THUMBTRACK = wxc.wxEVT_SCROLLWIN_THUMBTRACK
wxEVT_SIZE = wxc.wxEVT_SIZE
wxEVT_MOVE = wxc.wxEVT_MOVE
wxEVT_CLOSE_WINDOW = wxc.wxEVT_CLOSE_WINDOW
wxEVT_QUERY_END_SESSION = wxc.wxEVT_QUERY_END_SESSION
wxEVT_ACTIVATE_APP = wxc.wxEVT_ACTIVATE_APP
wxEVT_POWER = wxc.wxEVT_POWER
-wxEVT_CHAR_HOOK = wxc.wxEVT_CHAR_HOOK
-wxEVT_KEY_UP = wxc.wxEVT_KEY_UP
wxEVT_ACTIVATE = wxc.wxEVT_ACTIVATE
wxEVT_CREATE = wxc.wxEVT_CREATE
wxEVT_DESTROY = wxc.wxEVT_DESTROY
wxEVT_COMMAND_LIST_KEY_DOWN = wxc.wxEVT_COMMAND_LIST_KEY_DOWN
wxEVT_COMMAND_LIST_INSERT_ITEM = wxc.wxEVT_COMMAND_LIST_INSERT_ITEM
wxEVT_COMMAND_LIST_COL_CLICK = wxc.wxEVT_COMMAND_LIST_COL_CLICK
+wxEVT_COMMAND_LIST_ITEM_ACTIVATED = wxc.wxEVT_COMMAND_LIST_ITEM_ACTIVATED
wxEVT_COMMAND_TAB_SEL_CHANGED = wxc.wxEVT_COMMAND_TAB_SEL_CHANGED
wxEVT_COMMAND_TAB_SEL_CHANGING = wxc.wxEVT_COMMAND_TAB_SEL_CHANGING
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED = wxc.wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING = wxc.wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
+wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING = wxc.wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING
+wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED = wxc.wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED
+wxEVT_COMMAND_SPLITTER_UNSPLIT = wxc.wxEVT_COMMAND_SPLITTER_UNSPLIT
+wxEVT_COMMAND_SPLITTER_DOUBLECLICKED = wxc.wxEVT_COMMAND_SPLITTER_DOUBLECLICKED
__version__ = wxc.__version__
cvar = wxc.cvar
wxPyDefaultPosition = wxPointPtr(wxc.cvar.wxPyDefaultPosition)
except: pass
else: obj.Connect(theID, -1, event, cb)
+## def _checkClassCallback(obj, name):
+## try: cb = getattr(obj, name)
+## except: pass
+## else: obj._addCallback(name, cb)
+
+
def _StdWindowCallbacks(win):
_checkForCallback(win, "OnChar", wxEVT_CHAR)
_checkForCallback(win, "OnSize", wxEVT_SIZE)
def EVT_CHAR_HOOK(win, func):
win.Connect(-1, -1, wxEVT_CHAR_HOOK, func)
+def EVT_KEY_DOWN(win, func):
+ win.Connect(-1, -1, wxEVT_KEY_DOWN, func)
+
+def EVT_KEY_UP(win, func):
+ win.Connect(-1, -1, wxEVT_KEY_UP, func)
+
def EVT_MENU_HIGHLIGHT(win, id, func):
win.Connect(id, -1, wxEVT_MENU_HIGHLIGHT, 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)
+
# Mouse Events
def EVT_LEFT_DOWN(win, func):
def EVT_LIST_ITEM_SELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED, func)
+def EVT_LIST_ITEM_ACTIVATED(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED, func)
+
def EVT_LIST_ITEM_DESELECTED(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED, func)
def EVT_LIST_COL_CLICK(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK, func)
+#wxSplitterWindow
+def EVT_SPLITTER_SASH_POS_CHANGING(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, func)
+
+def EVT_SPLITTER_SASH_POS_CHANGED(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, func)
+
+def EVT_SPLITTER_UNSPLIT(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_SPLITTER_UNSPLIT, func)
+
+def EVT_SPLITTER_DOUBLECLICKED(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, func)
+
#----------------------------------------------------------------------
self.this = miscc.new_wxAcceleratorTable(arg0)
self.thisown = 1
+#----------------------------------------------------------------------
+# This helper function will take a wxPython object and convert it to
+# another wxPython object type. This will not be able to create objects
+# that are derived from wxPython classes by the user, only those that are
+# actually part of wxPython and directly corespond to C++ objects.
+#
+# This is useful in situations where some method returns a generic
+# type such as wxWindow, but you know that it is actually some
+# derived type such as a wxTextCtrl. You can't call wxTextCtrl specific
+# methods on a wxWindow object, but you can use this function to
+# create a wxTextCtrl object that will pass the same pointer to
+# the C++ code. You use it like this:
+#
+# textCtrl = wxPyTypeCast(window, "wxTextCtrl")
+#
+#
+# WARNING: Using this function to type cast objects into types that
+# they are not is not recommended and is likely to cause your
+# program to crash... Hard.
+#
+
+def wxPyTypeCast(obj, typeStr):
+ if hasattr(obj, "this"):
+ newPtr = ptrcast(obj.this, typeStr+"_p")
+ else:
+ newPtr = ptrcast(obj, typeStr+"_p")
+ theClass = globals()[typeStr+"Ptr"]
+ theObj = theClass(newPtr)
+ theObj.thisown = obj.thisown
+ return theObj
+
+
#----------------------------------------------------------------------
## class wxPyStdOutWindow:
if filename:
sys.stdout = sys.stderr = open(filename, 'a')
else:
- #raise self.error, 'wxPyStdOutWindow not yet implemented.'
- self.stdioWin = sys.stdout = sys.stderr = wxPyStdOutWindow()
+ raise self.error, 'wxPyStdOutWindow not yet implemented.'
+ #self.stdioWin = sys.stdout = sys.stderr = wxPyStdOutWindow()
def RestoreStdio(self):
sys.stdout, sys.stderr = self.saveStdio
#----------------------------------------------------------------------------
-#
-# $Log$
-# Revision 1.9 1999/05/01 04:41:08 RD
-# wxPython 2.0b9, second phase (gtk)
-# Added gobs of stuff, see wxPython/README.txt for details
-#
-# Revision 1.12 1999/04/30 03:29:18 RD
-#
-# wxPython 2.0b9, first phase (win32)
-# Added gobs of stuff, see wxPython/README.txt for details
-#
-# Revision 1.11.4.2 1999/03/28 06:35:01 RD
-#
-# wxPython 2.0b8
-# Python thread support
-# various minor additions
-# various minor fixes
-#
-# Revision 1.11.4.1 1999/03/27 23:29:13 RD
-#
-# wxPython 2.0b8
-# Python thread support
-# various minor additions
-# various minor fixes
-#
-# Revision 1.11 1999/02/20 09:02:55 RD
-# Added wxWindow_FromHWND(hWnd) for wxMSW to construct a wxWindow from a
-# window handle. If you can get the window handle into the python code,
-# it should just work... More news on this later.
-#
-# Added wxImageList, wxToolTip.
-#
-# Re-enabled wxConfig.DeleteAll() since it is reportedly fixed for the
-# wxRegConfig class.
-#
-# As usual, some bug fixes, tweaks, etc.
-#
-# Revision 1.10 1999/02/01 00:10:39 RD
-#
-# Added the missing EVT_LIST_ITEM_SELECTED and friends.
-#
-# Revision 1.9 1999/01/30 07:30:09 RD
-#
-# Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc.
-#
-# Various cleanup, tweaks, minor additions, etc. to maintain
-# compatibility with the current wxWindows.
-#
-# Revision 1.8 1999/01/29 21:13:42 HH
-# Added aliases for wxDefaultPosition and wxDefaultSize (from wxPy..) in _extras,
-# so that C++ documentation applies.
-#
-# Revision 1.7 1998/11/25 08:45:21 RD
-#
-# Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
-# Added events for wxGrid
-# Other various fixes and additions
-#
-# Revision 1.6 1998/11/16 00:00:52 RD
-# Generic treectrl for wxPython/GTK compiles...
-#
-# Revision 1.5 1998/10/20 07:38:02 RD
-# bug fix
-#
-# Revision 1.4 1998/10/20 06:43:54 RD
-# New wxTreeCtrl wrappers (untested)
-# some changes in helpers
-# etc.
-#
-# Revision 1.3 1998/10/02 06:40:33 RD
-#
-# Version 0.4 of wxPython for MSW.
-#
-# Revision 1.2 1998/08/18 19:48:12 RD
-# more wxGTK compatibility things.
-#
-# It builds now but there are serious runtime problems...
-#
-# Revision 1.1 1998/08/09 08:25:49 RD
-# Initial version
-#
-#
+# DO NOT hold any other references to this object. This is how we know when
+# to cleanup system resources that wxWin is holding...
+__cleanMeUp = __wxPyCleanup()
+#----------------------------------------------------------------------------
+
+