X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b39fe9514578dc76bd595e243e88e412be70bb61..13b955a7556502bf9a66986b8ff62c1cd260e138:/wxPython/src/msw/_core.py diff --git a/wxPython/src/msw/_core.py b/wxPython/src/msw/_core.py index 0c899fb2ec..6b80b9fb50 100644 --- a/wxPython/src/msw/_core.py +++ b/wxPython/src/msw/_core.py @@ -708,6 +708,16 @@ class Object(object): args[0].this.own(False) return _core_.Object_Destroy(*args, **kwargs) + def IsSameAs(*args, **kwargs): + """ + IsSameAs(self, Object p) -> bool + + For wx.Objects that use C++ reference counting internally, this method + can be used to determine if two objects are referencing the same data + object. + """ + return _core_.Object_IsSameAs(*args, **kwargs) + ClassName = property(GetClassName,doc="See `GetClassName`") _core_.Object_swigregister(Object) _wxPySetDictionary = _core_._wxPySetDictionary @@ -734,6 +744,7 @@ BITMAP_TYPE_PICT = _core_.BITMAP_TYPE_PICT BITMAP_TYPE_ICON = _core_.BITMAP_TYPE_ICON BITMAP_TYPE_ANI = _core_.BITMAP_TYPE_ANI BITMAP_TYPE_IFF = _core_.BITMAP_TYPE_IFF +BITMAP_TYPE_TGA = _core_.BITMAP_TYPE_TGA BITMAP_TYPE_MACCURSOR = _core_.BITMAP_TYPE_MACCURSOR BITMAP_TYPE_ANY = _core_.BITMAP_TYPE_ANY CURSOR_NONE = _core_.CURSOR_NONE @@ -1649,6 +1660,260 @@ def Point2DFromPoint(*args, **kwargs): #--------------------------------------------------------------------------- +Inside = _core_.Inside +OutLeft = _core_.OutLeft +OutRight = _core_.OutRight +OutTop = _core_.OutTop +OutBottom = _core_.OutBottom +class Rect2D(object): + """ + wx.Rect2D is a rectangle, with position and size, in a 2D coordinate system + with floating point component values. + """ + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): + """ + __init__(self, wxDouble x=0.0, wxDouble y=0.0, wxDouble w=0.0, wxDouble h=0.0) -> Rect2D + + wx.Rect2D is a rectangle, with position and size, in a 2D coordinate system + with floating point component values. + """ + _core_.Rect2D_swiginit(self,_core_.new_Rect2D(*args, **kwargs)) + __swig_destroy__ = _core_.delete_Rect2D + __del__ = lambda self : None; + def GetPosition(*args, **kwargs): + """GetPosition(self) -> Point2D""" + return _core_.Rect2D_GetPosition(*args, **kwargs) + + def GetSize(*args, **kwargs): + """GetSize(self) -> Size""" + return _core_.Rect2D_GetSize(*args, **kwargs) + + def GetLeft(*args, **kwargs): + """GetLeft(self) -> wxDouble""" + return _core_.Rect2D_GetLeft(*args, **kwargs) + + def SetLeft(*args, **kwargs): + """SetLeft(self, wxDouble n)""" + return _core_.Rect2D_SetLeft(*args, **kwargs) + + def MoveLeftTo(*args, **kwargs): + """MoveLeftTo(self, wxDouble n)""" + return _core_.Rect2D_MoveLeftTo(*args, **kwargs) + + def GetTop(*args, **kwargs): + """GetTop(self) -> wxDouble""" + return _core_.Rect2D_GetTop(*args, **kwargs) + + def SetTop(*args, **kwargs): + """SetTop(self, wxDouble n)""" + return _core_.Rect2D_SetTop(*args, **kwargs) + + def MoveTopTo(*args, **kwargs): + """MoveTopTo(self, wxDouble n)""" + return _core_.Rect2D_MoveTopTo(*args, **kwargs) + + def GetBottom(*args, **kwargs): + """GetBottom(self) -> wxDouble""" + return _core_.Rect2D_GetBottom(*args, **kwargs) + + def SetBottom(*args, **kwargs): + """SetBottom(self, wxDouble n)""" + return _core_.Rect2D_SetBottom(*args, **kwargs) + + def MoveBottomTo(*args, **kwargs): + """MoveBottomTo(self, wxDouble n)""" + return _core_.Rect2D_MoveBottomTo(*args, **kwargs) + + def GetRight(*args, **kwargs): + """GetRight(self) -> wxDouble""" + return _core_.Rect2D_GetRight(*args, **kwargs) + + def SetRight(*args, **kwargs): + """SetRight(self, wxDouble n)""" + return _core_.Rect2D_SetRight(*args, **kwargs) + + def MoveRightTo(*args, **kwargs): + """MoveRightTo(self, wxDouble n)""" + return _core_.Rect2D_MoveRightTo(*args, **kwargs) + + def GetLeftTop(*args, **kwargs): + """GetLeftTop(self) -> Point2D""" + return _core_.Rect2D_GetLeftTop(*args, **kwargs) + + def SetLeftTop(*args, **kwargs): + """SetLeftTop(self, Point2D pt)""" + return _core_.Rect2D_SetLeftTop(*args, **kwargs) + + def MoveLeftTopTo(*args, **kwargs): + """MoveLeftTopTo(self, Point2D pt)""" + return _core_.Rect2D_MoveLeftTopTo(*args, **kwargs) + + def GetLeftBottom(*args, **kwargs): + """GetLeftBottom(self) -> Point2D""" + return _core_.Rect2D_GetLeftBottom(*args, **kwargs) + + def SetLeftBottom(*args, **kwargs): + """SetLeftBottom(self, Point2D pt)""" + return _core_.Rect2D_SetLeftBottom(*args, **kwargs) + + def MoveLeftBottomTo(*args, **kwargs): + """MoveLeftBottomTo(self, Point2D pt)""" + return _core_.Rect2D_MoveLeftBottomTo(*args, **kwargs) + + def GetRightTop(*args, **kwargs): + """GetRightTop(self) -> Point2D""" + return _core_.Rect2D_GetRightTop(*args, **kwargs) + + def SetRightTop(*args, **kwargs): + """SetRightTop(self, Point2D pt)""" + return _core_.Rect2D_SetRightTop(*args, **kwargs) + + def MoveRightTopTo(*args, **kwargs): + """MoveRightTopTo(self, Point2D pt)""" + return _core_.Rect2D_MoveRightTopTo(*args, **kwargs) + + def GetRightBottom(*args, **kwargs): + """GetRightBottom(self) -> Point2D""" + return _core_.Rect2D_GetRightBottom(*args, **kwargs) + + def SetRightBottom(*args, **kwargs): + """SetRightBottom(self, Point2D pt)""" + return _core_.Rect2D_SetRightBottom(*args, **kwargs) + + def MoveRightBottomTo(*args, **kwargs): + """MoveRightBottomTo(self, Point2D pt)""" + return _core_.Rect2D_MoveRightBottomTo(*args, **kwargs) + + def GetCentre(*args, **kwargs): + """GetCentre(self) -> Point2D""" + return _core_.Rect2D_GetCentre(*args, **kwargs) + + def SetCentre(*args, **kwargs): + """SetCentre(self, Point2D pt)""" + return _core_.Rect2D_SetCentre(*args, **kwargs) + + def MoveCentreTo(*args, **kwargs): + """MoveCentreTo(self, Point2D pt)""" + return _core_.Rect2D_MoveCentreTo(*args, **kwargs) + + def GetOutcode(*args, **kwargs): + """GetOutcode(self, Point2D pt) -> int""" + return _core_.Rect2D_GetOutcode(*args, **kwargs) + + def Contains(*args, **kwargs): + """Contains(self, Point2D pt) -> bool""" + return _core_.Rect2D_Contains(*args, **kwargs) + + def ContainsRect(*args, **kwargs): + """ContainsRect(self, Rect2D rect) -> bool""" + return _core_.Rect2D_ContainsRect(*args, **kwargs) + + def IsEmpty(*args, **kwargs): + """IsEmpty(self) -> bool""" + return _core_.Rect2D_IsEmpty(*args, **kwargs) + + def HaveEqualSize(*args, **kwargs): + """HaveEqualSize(self, Rect2D rect) -> bool""" + return _core_.Rect2D_HaveEqualSize(*args, **kwargs) + + def Inset(*args): + """ + Inset(self, wxDouble x, wxDouble y) + Inset(self, wxDouble left, wxDouble top, wxDouble right, wxDouble bottom) + """ + return _core_.Rect2D_Inset(*args) + + def Offset(*args, **kwargs): + """Offset(self, Point2D pt)""" + return _core_.Rect2D_Offset(*args, **kwargs) + + def ConstrainTo(*args, **kwargs): + """ConstrainTo(self, Rect2D rect)""" + return _core_.Rect2D_ConstrainTo(*args, **kwargs) + + def Interpolate(*args, **kwargs): + """Interpolate(self, int widthfactor, int heightfactor) -> Point2D""" + return _core_.Rect2D_Interpolate(*args, **kwargs) + + def Intersect(*args, **kwargs): + """Intersect(self, Rect2D otherRect)""" + return _core_.Rect2D_Intersect(*args, **kwargs) + + def CreateIntersection(*args, **kwargs): + """CreateIntersection(self, Rect2D otherRect) -> Rect2D""" + return _core_.Rect2D_CreateIntersection(*args, **kwargs) + + def Intersects(*args, **kwargs): + """Intersects(self, Rect2D rect) -> bool""" + return _core_.Rect2D_Intersects(*args, **kwargs) + + def Union(*args, **kwargs): + """Union(self, Rect2D otherRect)""" + return _core_.Rect2D_Union(*args, **kwargs) + + def CreateUnion(*args, **kwargs): + """CreateUnion(self, Rect2D otherRect) -> Rect2D""" + return _core_.Rect2D_CreateUnion(*args, **kwargs) + + def Scale(*args): + """ + Scale(self, wxDouble f) + Scale(self, int num, int denum) + """ + return _core_.Rect2D_Scale(*args) + + def __eq__(*args, **kwargs): + """ + __eq__(self, PyObject other) -> bool + + Test for equality of wx.Rect2D objects. + """ + return _core_.Rect2D___eq__(*args, **kwargs) + + def __ne__(*args, **kwargs): + """ + __ne__(self, PyObject other) -> bool + + Test for inequality of wx.Rect2D objects. + """ + return _core_.Rect2D___ne__(*args, **kwargs) + + x = property(_core_.Rect2D_x_get, _core_.Rect2D_x_set) + y = property(_core_.Rect2D_y_get, _core_.Rect2D_y_set) + width = property(_core_.Rect2D_width_get, _core_.Rect2D_width_set) + height = property(_core_.Rect2D_height_get, _core_.Rect2D_height_set) + def Set(*args, **kwargs): + """Set(self, wxDouble x=0, wxDouble y=0, wxDouble width=0, wxDouble height=0)""" + return _core_.Rect2D_Set(*args, **kwargs) + + def Get(*args, **kwargs): + """ + Get() -> (x,y, width, height) + + Return x, y, width and height y properties as a tuple. + """ + return _core_.Rect2D_Get(*args, **kwargs) + + def __str__(self): return str(self.Get()) + def __repr__(self): return 'wx.Rect2D'+str(self.Get()) + def __len__(self): return len(self.Get()) + def __getitem__(self, index): return self.Get()[index] + def __setitem__(self, index, val): + if index == 0: self.x = val + elif index == 1: self.y = val + elif index == 2: self.width = val + elif index == 3: self.height = val + else: raise IndexError + def __nonzero__(self): return self.Get() != (0.0, 0.0, 0.0, 0.0) + __safe_for_unpickling__ = True + def __reduce__(self): return (wx.Rect2D, self.Get()) + +_core_.Rect2D_swigregister(Rect2D) + +#--------------------------------------------------------------------------- + FromStart = _core_.FromStart FromCurrent = _core_.FromCurrent FromEnd = _core_.FromEnd @@ -3044,7 +3309,6 @@ class Image(Object): MaskBlue = property(GetMaskBlue,doc="See `GetMaskBlue`") MaskGreen = property(GetMaskGreen,doc="See `GetMaskGreen`") MaskRed = property(GetMaskRed,doc="See `GetMaskRed`") - Size = property(GetSize,doc="See `GetSize`") Width = property(GetWidth,doc="See `GetWidth`") _core_.Image_swigregister(Image) @@ -3404,6 +3668,19 @@ class TIFFHandler(ImageHandler): _core_.TIFFHandler_swiginit(self,_core_.new_TIFFHandler(*args, **kwargs)) _core_.TIFFHandler_swigregister(TIFFHandler) +class TGAHandler(ImageHandler): + """A `wx.ImageHandler` for TGA image files.""" + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): + """ + __init__(self) -> TGAHandler + + A `wx.ImageHandler` for TGA image files. + """ + _core_.TGAHandler_swiginit(self,_core_.new_TGAHandler(*args, **kwargs)) +_core_.TGAHandler_swigregister(TGAHandler) + QUANTIZE_INCLUDE_WINDOWS_COLOURS = _core_.QUANTIZE_INCLUDE_WINDOWS_COLOURS QUANTIZE_FILL_DESTINATION_IMAGE = _core_.QUANTIZE_FILL_DESTINATION_IMAGE class Quantize(object): @@ -3481,18 +3758,6 @@ class EvtHandler(Object): """ProcessPendingEvents(self)""" return _core_.EvtHandler_ProcessPendingEvents(*args, **kwargs) - def AllowReentrance(*args, **kwargs): - """AllowReentrance(self, bool allow=True)""" - return _core_.EvtHandler_AllowReentrance(*args, **kwargs) - - def IsReentranceAllowed(*args, **kwargs): - """IsReentranceAllowed(self) -> bool""" - return _core_.EvtHandler_IsReentranceAllowed(*args, **kwargs) - - def IsEventHandlingInProgress(*args, **kwargs): - """IsEventHandlingInProgress(self) -> bool""" - return _core_.EvtHandler_IsEventHandlingInProgress(*args, **kwargs) - def Connect(*args, **kwargs): """Connect(self, int id, int lastId, int eventType, PyObject func)""" return _core_.EvtHandler_Connect(*args, **kwargs) @@ -4016,14 +4281,13 @@ class Event(Object): """ Skip(self, bool skip=True) - Called by an event handler, it controls whether additional event - handlers bound to this event will be called after the current event - handler returns. Skip(false) (the default setting) will prevent - additional event handlers from being called and control will be - returned to the sender of the event immediately after the current - handler has finished. Skip(True) will cause the event processing - system to continue searching for a handler function for this event. - + This method can be used inside an event handler to control whether + further event handlers bound to this event will be called after the + current one returns. Without Skip() (or equivalently if Skip(False) is + used), the event will not be processed any more. If Skip(True) is + called, the event processing system continues searching for a further + handler function for this event, even though it has been processed + already in the current handler. """ return _core_.Event_Skip(*args, **kwargs) @@ -7477,6 +7741,9 @@ in on the main display of your Mac.""" # Use Python's install prefix as the default wx.StandardPaths.Get().SetInstallPrefix(_sys.prefix) + # Until the new native control for wxMac is up to par, still use the generic one. + wx.SystemOptions.SetOptionInt("mac.listctrl.always_use_generic", 1) + # This finishes the initialization of wxWindows and then calls # the OnInit that should be present in the derived class self._BootstrapApp() @@ -8115,15 +8382,16 @@ class Window(EvtHandler): """ return _core_.Window_MoveXY(*args, **kwargs) - def SetBestFittingSize(*args, **kwargs): + def SetInitialSize(*args, **kwargs): """ - SetBestFittingSize(self, Size size=DefaultSize) + SetInitialSize(self, Size size=DefaultSize) A 'Smart' SetSize that will fill in default size components with the window's *best size* values. Also set's the minsize for use with sizers. """ - return _core_.Window_SetBestFittingSize(*args, **kwargs) + return _core_.Window_SetInitialSize(*args, **kwargs) + SetBestFittingSize = wx._deprecated(SetInitialSize, 'Use `SetInitialSize`') def Raise(*args, **kwargs): """ Raise(self) @@ -8331,29 +8599,23 @@ class Window(EvtHandler): """ return _core_.Window_CacheBestSize(*args, **kwargs) - def GetBestFittingSize(*args, **kwargs): + def GetEffectiveMinSize(*args, **kwargs): """ - GetBestFittingSize(self) -> Size + GetEffectiveMinSize(self) -> Size This function will merge the window's best size into the window's minimum size, giving priority to the min size components, and returns the results. """ - return _core_.Window_GetBestFittingSize(*args, **kwargs) - - def GetAdjustedBestSize(*args, **kwargs): - """ - GetAdjustedBestSize(self) -> Size + return _core_.Window_GetEffectiveMinSize(*args, **kwargs) - This method is similar to GetBestSize, except in one - thing. GetBestSize should return the minimum untruncated size of the - window, while this method will return the largest of BestSize and any - user specified minimum size. ie. it is the minimum size the window - should currently be drawn at, not the minimal size it can possibly - tolerate. - """ - return _core_.Window_GetAdjustedBestSize(*args, **kwargs) + GetBestFittingSize = wx._deprecated(GetEffectiveMinSize, 'Use `GetEffectiveMinSize` instead.') + def GetAdjustedBestSize(self): + s = self.GetBestSize() + return wx.Size(max(s.width, self.GetMinWidth()), + max(s.height, self.GetMinHeight())) + GetAdjustedBestSize = wx._deprecated(GetAdjustedBestSize, 'Use `GetEffectiveMinSize` instead.') def Center(*args, **kwargs): """ @@ -9189,7 +9451,7 @@ class Window(EvtHandler): window instead of waiting for the EVT_PAINT event to happen, (normally this would usually only happen when the flow of control returns to the event loop.) Notice that this function doesn't refresh the window and - does nothing if the window has been already repainted. Use Refresh + does nothing if the window has been already repainted. Use `Refresh` first if you want to immediately redraw the window (or some portion of it) unconditionally. """ @@ -10084,7 +10346,7 @@ class Window(EvtHandler): AutoLayout = property(GetAutoLayout,SetAutoLayout,doc="See `GetAutoLayout` and `SetAutoLayout`") BackgroundColour = property(GetBackgroundColour,SetBackgroundColour,doc="See `GetBackgroundColour` and `SetBackgroundColour`") BackgroundStyle = property(GetBackgroundStyle,SetBackgroundStyle,doc="See `GetBackgroundStyle` and `SetBackgroundStyle`") - BestFittingSize = property(GetBestFittingSize,SetBestFittingSize,doc="See `GetBestFittingSize` and `SetBestFittingSize`") + EffectiveMinSize = property(GetEffectiveMinSize,doc="See `GetEffectiveMinSize`") BestSize = property(GetBestSize,doc="See `GetBestSize`") BestVirtualSize = property(GetBestVirtualSize,doc="See `GetBestVirtualSize`") Border = property(GetBorder,doc="See `GetBorder`") @@ -13400,6 +13662,24 @@ if RELEASE_VERSION != _core_.RELEASE_VERSION: import warnings warnings.warn("wxPython/wxWidgets release number mismatch") + +def version(): + """Returns a string containing version and port info""" + ctype = wx.USE_UNICODE and 'unicode' or 'ansi' + if wx.Platform == '__WXMSW__': + port = 'msw' + elif wx.Platform == '__WXMAC__': + port = 'mac' + elif wx.Platform == '__WXGTK__': + port = 'gtk' + if 'gtk2' in wx.PlatformInfo: + port = 'gtk2' + else: + port = '?' + + return "%s (%s-%s)" % (wx.VERSION_STRING, port, ctype) + + #---------------------------------------------------------------------------- # Set wxPython's default string<-->unicode conversion encoding from