X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/14afa2cbca535ad8fabc8f7ef6792f2d6dc01741..c15521c67eb8aba1994240262ba973aa11ef0086:/wxPython/src/msw/wx.py diff --git a/wxPython/src/msw/wx.py b/wxPython/src/msw/wx.py index 76d13b852a..55d3282d8e 100644 --- a/wxPython/src/msw/wx.py +++ b/wxPython/src/msw/wx.py @@ -9,6 +9,8 @@ from windows import * from gdi import * +from fonts import * + from clip_dnd import * from events import * @@ -113,10 +115,6 @@ class wxPyAppPtr(wxEvtHandlerPtr): def SetUseBestVisual(self, *_args, **_kwargs): val = apply(wxc.wxPyApp_SetUseBestVisual,(self,) + _args, _kwargs) return val - 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 "" % (self.this,) class wxPyApp(wxPyAppPtr): @@ -216,11 +214,15 @@ wxCLIP_CHILDREN = wxc.wxCLIP_CHILDREN wxCLIP_SIBLINGS = wxc.wxCLIP_SIBLINGS wxRETAINED = wxc.wxRETAINED wxBACKINGSTORE = wxc.wxBACKINGSTORE -wxTB_3DBUTTONS = wxc.wxTB_3DBUTTONS wxTB_HORIZONTAL = wxc.wxTB_HORIZONTAL wxTB_VERTICAL = wxc.wxTB_VERTICAL +wxTB_3DBUTTONS = wxc.wxTB_3DBUTTONS wxTB_FLAT = wxc.wxTB_FLAT wxTB_DOCKABLE = wxc.wxTB_DOCKABLE +wxTB_NOICONS = wxc.wxTB_NOICONS +wxTB_TEXT = wxc.wxTB_TEXT +wxTB_NODIVIDER = wxc.wxTB_NODIVIDER +wxTB_NOALIGN = wxc.wxTB_NOALIGN wxCOLOURED = wxc.wxCOLOURED wxFIXED_LENGTH = wxc.wxFIXED_LENGTH wxALIGN_LEFT = wxc.wxALIGN_LEFT @@ -384,11 +386,18 @@ wxID_APPLY = wxc.wxID_APPLY wxID_YES = wxc.wxID_YES wxID_NO = wxc.wxID_NO wxID_STATIC = wxc.wxID_STATIC -wxID_SEPARATOR = wxc.wxID_SEPARATOR wxID_FORWARD = wxc.wxID_FORWARD wxID_BACKWARD = wxc.wxID_BACKWARD -wxID_SETUP = wxc.wxID_SETUP +wxID_DEFAULT = wxc.wxID_DEFAULT wxID_MORE = wxc.wxID_MORE +wxID_SETUP = wxc.wxID_SETUP +wxID_RESET = wxc.wxID_RESET +wxID_CONTEXT_HELP = wxc.wxID_CONTEXT_HELP +wxID_YESTOALL = wxc.wxID_YESTOALL +wxID_NOTOALL = wxc.wxID_NOTOALL +wxID_ABORT = wxc.wxID_ABORT +wxID_RETRY = wxc.wxID_RETRY +wxID_IGNORE = wxc.wxID_IGNORE wxOPEN = wxc.wxOPEN wxSAVE = wxc.wxSAVE wxHIDE_READONLY = wxc.wxHIDE_READONLY @@ -406,6 +415,7 @@ 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 +wxDD_NEW_DIR_BUTTON = wxc.wxDD_NEW_DIR_BUTTON wxMENU_TEAROFF = wxc.wxMENU_TEAROFF wxMB_DOCKABLE = wxc.wxMB_DOCKABLE wxNO_FULL_REPAINT_ON_RESIZE = wxc.wxNO_FULL_REPAINT_ON_RESIZE @@ -647,6 +657,7 @@ wxBITMAP_TYPE_MACCURSOR_RESOURCE = wxc.wxBITMAP_TYPE_MACCURSOR_RESOURCE wxBITMAP_TYPE_ANY = wxc.wxBITMAP_TYPE_ANY wxCURSOR_NONE = wxc.wxCURSOR_NONE wxCURSOR_ARROW = wxc.wxCURSOR_ARROW +wxCURSOR_RIGHT_ARROW = wxc.wxCURSOR_RIGHT_ARROW wxCURSOR_BULLSEYE = wxc.wxCURSOR_BULLSEYE wxCURSOR_CHAR = wxc.wxCURSOR_CHAR wxCURSOR_CROSS = wxc.wxCURSOR_CROSS @@ -744,6 +755,11 @@ wxPAPER_A3_EXTRA_TRANSVERSE = wxc.wxPAPER_A3_EXTRA_TRANSVERSE wxDUPLEX_SIMPLEX = wxc.wxDUPLEX_SIMPLEX wxDUPLEX_HORIZONTAL = wxc.wxDUPLEX_HORIZONTAL wxDUPLEX_VERTICAL = wxc.wxDUPLEX_VERTICAL +wxITEM_SEPARATOR = wxc.wxITEM_SEPARATOR +wxITEM_NORMAL = wxc.wxITEM_NORMAL +wxITEM_CHECK = wxc.wxITEM_CHECK +wxITEM_RADIO = wxc.wxITEM_RADIO +wxITEM_MAX = wxc.wxITEM_MAX wxHT_NOWHERE = wxc.wxHT_NOWHERE wxHT_SCROLLBAR_FIRST = wxc.wxHT_SCROLLBAR_FIRST wxHT_SCROLLBAR_ARROW_LINE_1 = wxc.wxHT_SCROLLBAR_ARROW_LINE_1 @@ -764,7 +780,6 @@ FALSE = wxc.FALSE false = wxc.false TRUE = wxc.TRUE true = wxc.true -wxVERSION_STRING = wxc.wxVERSION_STRING wxEVT_NULL = wxc.wxEVT_NULL wxEVT_FIRST = wxc.wxEVT_FIRST wxEVT_COMMAND_BUTTON_CLICKED = wxc.wxEVT_COMMAND_BUTTON_CLICKED @@ -804,6 +819,7 @@ wxEVT_LEAVE_WINDOW = wxc.wxEVT_LEAVE_WINDOW wxEVT_LEFT_DCLICK = wxc.wxEVT_LEFT_DCLICK wxEVT_MIDDLE_DCLICK = wxc.wxEVT_MIDDLE_DCLICK wxEVT_RIGHT_DCLICK = wxc.wxEVT_RIGHT_DCLICK +wxEVT_MOUSE_CAPTURE_CHANGED = wxc.wxEVT_MOUSE_CAPTURE_CHANGED wxEVT_NC_LEFT_DOWN = wxc.wxEVT_NC_LEFT_DOWN wxEVT_NC_LEFT_UP = wxc.wxEVT_NC_LEFT_UP wxEVT_NC_MIDDLE_DOWN = wxc.wxEVT_NC_MIDDLE_DOWN @@ -849,15 +865,14 @@ wxEVT_DESTROY = wxc.wxEVT_DESTROY wxEVT_SHOW = wxc.wxEVT_SHOW wxEVT_ICONIZE = wxc.wxEVT_ICONIZE wxEVT_MAXIMIZE = wxc.wxEVT_MAXIMIZE -wxEVT_MOUSE_CAPTURE_CHANGED = wxc.wxEVT_MOUSE_CAPTURE_CHANGED wxEVT_PAINT = wxc.wxEVT_PAINT wxEVT_ERASE_BACKGROUND = wxc.wxEVT_ERASE_BACKGROUND wxEVT_NC_PAINT = wxc.wxEVT_NC_PAINT wxEVT_PAINT_ICON = wxc.wxEVT_PAINT_ICON -wxEVT_MENU_CHAR = wxc.wxEVT_MENU_CHAR -wxEVT_MENU_INIT = wxc.wxEVT_MENU_INIT +wxEVT_MENU_OPEN = wxc.wxEVT_MENU_OPEN +wxEVT_MENU_CLOSE = wxc.wxEVT_MENU_CLOSE wxEVT_MENU_HIGHLIGHT = wxc.wxEVT_MENU_HIGHLIGHT -wxEVT_POPUP_MENU_INIT = wxc.wxEVT_POPUP_MENU_INIT +wxEVT_CONTEXT_MENU = wxc.wxEVT_CONTEXT_MENU wxEVT_SYS_COLOUR_CHANGED = wxc.wxEVT_SYS_COLOUR_CHANGED wxEVT_DISPLAY_CHANGED = wxc.wxEVT_DISPLAY_CHANGED wxEVT_SETTING_CHANGED = wxc.wxEVT_SETTING_CHANGED @@ -955,6 +970,12 @@ def EVT_KEY_DOWN(win, func): def EVT_KEY_UP(win, func): win.Connect(-1, -1, wxEVT_KEY_UP, func) +def EVT_MENU_OPEN(win, func): + win.Connect(-1, -1, wxEVT_MENU_OPEN, func) + +def EVT_MENU_CLOSE(win, func): + win.Connect(-1, -1, wxEVT_MENU_CLOSE, func) + def EVT_MENU_HIGHLIGHT(win, id, func): win.Connect(id, -1, wxEVT_MENU_HIGHLIGHT, func) @@ -1085,6 +1106,9 @@ def EVT_MOUSE_EVENTS(win, func): win.Connect(-1, -1, wxEVT_LEAVE_WINDOW, func) win.Connect(-1, -1, wxEVT_ENTER_WINDOW, func) +def EVT_MOUSE_CAPTURE_CHANGED(win, func): + win.Connect(-1, -1, wxEVT_MOUSE_CAPTURE_CHANGED, func) + # EVT_COMMAND def EVT_COMMAND(win, id, cmd, func): win.Connect(id, -1, cmd, func) @@ -1438,19 +1462,6 @@ def EVT_TOGGLEBUTTON(win, id, func): -# Help events -def EVT_HELP(win, id, func): - win.Connect(id, -1, wxEVT_HELP, func) - -def EVT_HELP_RANGE(win, id, id2, func): - win.Connect(id, id2, wxEVT_HELP, func) - -def EVT_DETAILED_HELP(win, id, func): - win.Connect(id, -1, wxEVT_DETAILED_HELP, func) - -def EVT_DETAILED_HELP_RANGE(win, id, id2, func): - win.Connect(id, id2, wxEVT_DETAILED_HELP, func) - def EVT_CONTEXT_MENU(win, func): win.Connect(-1, -1, wxEVT_CONTEXT_MENU, func) @@ -1547,6 +1558,34 @@ def wxPyTypeCast(obj, typeStr): return theObj +#---------------------------------------------------------------------------- + +class wxPyDeadObjectError(AttributeError): + pass + +class _wxPyDeadObject: + """ + Instances of wx objects that are OOR capable will have their __class__ + changed to this class when the C++ object is deleted. This should help + prevent crashes due to referencing a bogus C++ pointer. + """ + reprStr = "wxPython wrapper for DELETED %s object! (The C++ object no longer exists.)" + attrStr = "The C++ part of the %s object has been deleted, attribute access no longer allowed." + + def __repr__( self ): + if not hasattr(self, "_name"): + self._name = "[unknown]" + return self.reprStr % self._name + + def __getattr__( self, *args ): + if not hasattr(self, "_name"): + self._name = "[unknown]" + raise wxPyDeadObjectError( self.attrStr % self._name ) + + def __nonzero__(self): + return 0 + + #---------------------------------------------------------------------- #---------------------------------------------------------------------- @@ -1663,10 +1702,10 @@ class wxPyWidgetTester(wxApp): self.frame.Show(true) #---------------------------------------------------------------------------- -# DO NOT hold any other references to this object. This is how we know when -# 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. +# DO NOT hold any other references to this object. This is how we +# know when to cleanup system resources that wxWin is holding. When +# the sys module is unloaded, the refcount on sys.__wxPythonCleanup +# goes to zero and it calls the wxApp_CleanUp function. class __wxPyCleanup: def __init__(self):