X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/72ef6efb1f1819e0b1187cedfd8989d4a37bf457..61b3549028093e724f118dfccdd266f6dcb04dc5:/wxPython/src/gtk/_gdi.py diff --git a/wxPython/src/gtk/_gdi.py b/wxPython/src/gtk/_gdi.py index 9c0c8b648c..b2dcd21f6b 100644 --- a/wxPython/src/gtk/_gdi.py +++ b/wxPython/src/gtk/_gdi.py @@ -146,15 +146,16 @@ class Colour(_core.Object): """ return _gdi_.Colour_Alpha(*args, **kwargs) - def Ok(*args, **kwargs): + def IsOk(*args, **kwargs): """ - Ok(self) -> bool + IsOk(self) -> bool Returns True if the colour object is valid (the colour has been initialised with RGB values). """ - return _gdi_.Colour_Ok(*args, **kwargs) + return _gdi_.Colour_IsOk(*args, **kwargs) + Ok = IsOk def Set(*args, **kwargs): """ Set(self, byte red, byte green, byte blue, byte alpha=ALPHA_OPAQUE) @@ -239,7 +240,9 @@ class Colour(_core.Object): asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead") def __str__(self): return str(self.Get(True)) def __repr__(self): return 'wx.Colour' + str(self.Get(True)) - def __nonzero__(self): return self.Ok() + def __len__(self): return len(self.Get()) + def __getitem__(self, index): return self.Get()[index] + def __nonzero__(self): return self.IsOk() __safe_for_unpickling__ = True def __reduce__(self): return (Colour, self.Get(True)) @@ -291,11 +294,12 @@ class Palette(GDIObject): """GetColoursCount(self) -> int""" return _gdi_.Palette_GetColoursCount(*args, **kwargs) - def Ok(*args, **kwargs): - """Ok(self) -> bool""" - return _gdi_.Palette_Ok(*args, **kwargs) + def IsOk(*args, **kwargs): + """IsOk(self) -> bool""" + return _gdi_.Palette_IsOk(*args, **kwargs) - def __nonzero__(self): return self.Ok() + Ok = IsOk + def __nonzero__(self): return self.IsOk() ColoursCount = property(GetColoursCount,doc="See `GetColoursCount`") _gdi_.Palette_swigregister(Palette) @@ -330,10 +334,11 @@ class Pen(GDIObject): """GetWidth(self) -> int""" return _gdi_.Pen_GetWidth(*args, **kwargs) - def Ok(*args, **kwargs): - """Ok(self) -> bool""" - return _gdi_.Pen_Ok(*args, **kwargs) + def IsOk(*args, **kwargs): + """IsOk(self) -> bool""" + return _gdi_.Pen_IsOk(*args, **kwargs) + Ok = IsOk def SetCap(*args, **kwargs): """SetCap(self, int cap_style)""" return _gdi_.Pen_SetCap(*args, **kwargs) @@ -385,7 +390,7 @@ class Pen(GDIObject): """__ne__(self, Pen other) -> bool""" return _gdi_.Pen___ne__(*args, **kwargs) - def __nonzero__(self): return self.Ok() + def __nonzero__(self): return self.IsOk() Cap = property(GetCap,SetCap,doc="See `GetCap` and `SetCap`") Colour = property(GetColour,SetColour,doc="See `GetColour` and `SetColour`") Dashes = property(GetDashes,SetDashes,doc="See `GetDashes` and `SetDashes`") @@ -472,15 +477,16 @@ class Brush(GDIObject): """ return _gdi_.Brush_IsHatch(*args, **kwargs) - def Ok(*args, **kwargs): + def IsOk(*args, **kwargs): """ - Ok(self) -> bool + IsOk(self) -> bool Returns True if the brush is initialised and valid. """ - return _gdi_.Brush_Ok(*args, **kwargs) + return _gdi_.Brush_IsOk(*args, **kwargs) - def __nonzero__(self): return self.Ok() + Ok = IsOk + def __nonzero__(self): return self.IsOk() Colour = property(GetColour,SetColour,doc="See `GetColour` and `SetColour`") Stipple = property(GetStipple,SetStipple,doc="See `GetStipple` and `SetStipple`") Style = property(GetStyle,SetStyle,doc="See `GetStyle` and `SetStyle`") @@ -515,10 +521,11 @@ class Bitmap(GDIObject): _gdi_.Bitmap_swiginit(self,_gdi_.new_Bitmap(*args, **kwargs)) __swig_destroy__ = _gdi_.delete_Bitmap __del__ = lambda self : None; - def Ok(*args, **kwargs): - """Ok(self) -> bool""" - return _gdi_.Bitmap_Ok(*args, **kwargs) + def IsOk(*args, **kwargs): + """IsOk(self) -> bool""" + return _gdi_.Bitmap_IsOk(*args, **kwargs) + Ok = IsOk def GetWidth(*args, **kwargs): """ GetWidth(self) -> int @@ -661,7 +668,7 @@ class Bitmap(GDIObject): """ return _gdi_.Bitmap_SetSize(*args, **kwargs) - def __nonzero__(self): return self.Ok() + def __nonzero__(self): return self.IsOk() def __eq__(*args, **kwargs): """__eq__(self, Bitmap other) -> bool""" return _gdi_.Bitmap___eq__(*args, **kwargs) @@ -1103,10 +1110,11 @@ class Icon(GDIObject): """LoadFile(self, String name, int type) -> bool""" return _gdi_.Icon_LoadFile(*args, **kwargs) - def Ok(*args, **kwargs): - """Ok(self) -> bool""" - return _gdi_.Icon_Ok(*args, **kwargs) + def IsOk(*args, **kwargs): + """IsOk(self) -> bool""" + return _gdi_.Icon_IsOk(*args, **kwargs) + Ok = IsOk def GetWidth(*args, **kwargs): """GetWidth(self) -> int""" return _gdi_.Icon_GetWidth(*args, **kwargs) @@ -1135,7 +1143,7 @@ class Icon(GDIObject): """CopyFromBitmap(self, Bitmap bmp)""" return _gdi_.Icon_CopyFromBitmap(*args, **kwargs) - def __nonzero__(self): return self.Ok() + def __nonzero__(self): return self.IsOk() Depth = property(GetDepth,SetDepth,doc="See `GetDepth` and `SetDepth`") Height = property(GetHeight,SetHeight,doc="See `GetHeight` and `SetHeight`") Width = property(GetWidth,SetWidth,doc="See `GetWidth` and `SetWidth`") @@ -1174,7 +1182,7 @@ class IconLocation(object): """IsOk(self) -> bool""" return _gdi_.IconLocation_IsOk(*args, **kwargs) - def __nonzero__(self): return self.Ok() + def __nonzero__(self): return self.IsOk() def SetFileName(*args, **kwargs): """SetFileName(self, String filename)""" return _gdi_.IconLocation_SetFileName(*args, **kwargs) @@ -1254,11 +1262,12 @@ class Cursor(GDIObject): _gdi_.Cursor_swiginit(self,_gdi_.new_Cursor(*args, **kwargs)) __swig_destroy__ = _gdi_.delete_Cursor __del__ = lambda self : None; - def Ok(*args, **kwargs): - """Ok(self) -> bool""" - return _gdi_.Cursor_Ok(*args, **kwargs) + def IsOk(*args, **kwargs): + """IsOk(self) -> bool""" + return _gdi_.Cursor_IsOk(*args, **kwargs) - def __nonzero__(self): return self.Ok() + Ok = IsOk + def __nonzero__(self): return self.IsOk() _gdi_.Cursor_swigregister(Cursor) def StockCursor(*args, **kwargs): @@ -1891,15 +1900,16 @@ class Font(GDIObject): _gdi_.Font_swiginit(self,_gdi_.new_Font(*args, **kwargs)) __swig_destroy__ = _gdi_.delete_Font __del__ = lambda self : None; - def Ok(*args, **kwargs): + def IsOk(*args, **kwargs): """ - Ok(self) -> bool + IsOk(self) -> bool Returns ``True`` if this font was successfully created. """ - return _gdi_.Font_Ok(*args, **kwargs) + return _gdi_.Font_IsOk(*args, **kwargs) - def __nonzero__(self): return self.Ok() + Ok = IsOk + def __nonzero__(self): return self.IsOk() def __eq__(*args, **kwargs): """__eq__(self, Font other) -> bool""" return _gdi_.Font___eq__(*args, **kwargs) @@ -3822,14 +3832,15 @@ class DC(_core.Object): """ return _gdi_.DC_GetPPI(*args, **kwargs) - def Ok(*args, **kwargs): + def IsOk(*args, **kwargs): """ - Ok(self) -> bool + IsOk(self) -> bool Returns true if the DC is ok to use. """ - return _gdi_.DC_Ok(*args, **kwargs) + return _gdi_.DC_IsOk(*args, **kwargs) + Ok = IsOk def GetBackgroundMode(*args, **kwargs): """ GetBackgroundMode(self) -> int @@ -4132,7 +4143,27 @@ class DC(_core.Object): """ return _gdi_.DC_GetBoundingBox(*args, **kwargs) - def __nonzero__(self): return self.Ok() + def __nonzero__(self): return self.IsOk() + def GetLayoutDirection(*args, **kwargs): + """ + GetLayoutDirection(self) -> int + + Get the layout direction (LTR or RTL)_ for this dc. On platforms + where RTL layout is supported, the return value will either be + ``wx.Layout_LeftToRight`` or ``wx.Layout_RightToLeft``. + ``wx.Layout_Default`` is returned if layout direction is not + supported. + """ + return _gdi_.DC_GetLayoutDirection(*args, **kwargs) + + def SetLayoutDirection(*args, **kwargs): + """ + SetLayoutDirection(self, int dir) + + Change the layout direction for this dc. + """ + return _gdi_.DC_SetLayoutDirection(*args, **kwargs) + def _DrawPointList(*args, **kwargs): """_DrawPointList(self, PyObject pyCoords, PyObject pyPens, PyObject pyBrushes) -> PyObject""" return _gdi_.DC__DrawPointList(*args, **kwargs) @@ -4347,6 +4378,7 @@ class DC(_core.Object): TextExtent = property(GetTextExtent,doc="See `GetTextExtent`") TextForeground = property(GetTextForeground,SetTextForeground,doc="See `GetTextForeground` and `SetTextForeground`") UserScale = property(GetUserScale,SetUserScale,doc="See `GetUserScale` and `SetUserScale`") + LayoutDirection = property(GetLayoutDirection,SetLayoutDirection) _gdi_.DC_swigregister(DC) #--------------------------------------------------------------------------- @@ -4359,7 +4391,7 @@ class MemoryDC(DC): dc = wx.MemoryDC() dc.SelectObject(bitmap) - # draw on the dc usign any of the Draw methods + # draw on the dc using any of the Draw methods dc.SelectObject(wx.NullBitmap) # the bitmap now contains wahtever was drawn upon it @@ -4371,13 +4403,14 @@ class MemoryDC(DC): __repr__ = _swig_repr def __init__(self, *args, **kwargs): """ - __init__(self) -> MemoryDC + __init__(self, Bitmap bitmap=NullBitmap) -> MemoryDC Constructs a new memory device context. Use the Ok member to test whether the constructor was successful in - creating a usable device context. Don't forget to select a bitmap into - the DC before drawing on it. + creating a usable device context. If a bitmap is not given to this + constructor then don't forget to select a bitmap into the DC before + drawing on it. """ _gdi_.MemoryDC_swiginit(self,_gdi_.new_MemoryDC(*args, **kwargs)) def SelectObject(*args, **kwargs): @@ -4424,8 +4457,8 @@ class BufferedDC(MemoryDC): `wx.BufferedPaintDC`. Please note that GTK+ 2.0 and OS X provide double buffering themselves - natively so using this class on those platforms will normally result - in an unneeded level of buffering. + natively. wxBufferedDC is aware of this however, and will bypass the buffering + unless an explicit buffer bitmap is given. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') @@ -4474,8 +4507,6 @@ class BufferedPaintDC(BufferedDC): - - """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr @@ -4487,8 +4518,6 @@ class BufferedPaintDC(BufferedDC): provide the bitmap to be used for buffering or let this object create one internally (in the latter case, the size of the client part of the window is automatically used). - - """ _gdi_.BufferedPaintDC_swiginit(self,_gdi_.new_BufferedPaintDC(*args, **kwargs)) _gdi_.BufferedPaintDC_swigregister(BufferedPaintDC) @@ -4636,6 +4665,35 @@ _gdi_.PaintDC_swigregister(PaintDC) #--------------------------------------------------------------------------- +if 'wxMac' in wx.PlatformInfo or 'gtk2' in wx.PlatformInfo: + _AutoBufferedPaintDCBase = PaintDC +else: + _AutoBufferedPaintDCBase = BufferedPaintDC + +class AutoBufferedPaintDC(_AutoBufferedPaintDCBase): + """ + If the current platform double buffers by default then this DC is the + same as a plain `wx.PaintDC`, otherwise it is a `wx.BufferedPaintDC`. + + :see: `wx.AutoBufferedPaintDCFactory` + """ + def __init__(self, window): + _AutoBufferedPaintDCBase.__init__(self, window) + + +def AutoBufferedPaintDCFactory(*args, **kwargs): + """ + AutoBufferedPaintDCFactory(Window window) -> DC + + Checks if the window is natively double buffered and will return a + `wx.PaintDC` if it is, a `wx.BufferedPaintDC` otherwise. The + advantage of this function over `wx.AutoBufferedPaintDC` is that this + function will check if the the specified window supports has + double-buffering enabled rather than just going by platform defaults. + """ + return _gdi_.AutoBufferedPaintDCFactory(*args, **kwargs) +#--------------------------------------------------------------------------- + class MirrorDC(DC): """ wx.MirrorDC is a simple wrapper class which is always associated with a @@ -4833,7 +4891,7 @@ class GraphicsPath(object): """ AddCircle(self, Double x, Double y, Double r) - Appends an ellipsis as a new closed subpath fitting the passed rectangle + Appends a circle as a new closed subpath with the given radius. """ return _gdi_.GraphicsPath_AddCircle(*args, **kwargs) @@ -4932,22 +4990,20 @@ class GraphicsContext(object): """DrawPath(self, GraphicsPath path, int fillStyle=WINDING_RULE)""" return _gdi_.GraphicsContext_DrawPath(*args, **kwargs) - def DrawText(*args): - """ - DrawText(self, String str, Double x, Double y) - DrawText(self, String str, Double x, Double y, Double angle) - """ - return _gdi_.GraphicsContext_DrawText(*args) + def DrawText(*args, **kwargs): + """DrawText(self, String str, Double x, Double y)""" + return _gdi_.GraphicsContext_DrawText(*args, **kwargs) + + def DrawRotatedText(*args, **kwargs): + """DrawRotatedText(self, String str, Double x, Double y, Double angle)""" + return _gdi_.GraphicsContext_DrawRotatedText(*args, **kwargs) def GetTextExtent(*args, **kwargs): - """ - GetTextExtent(self, String text, Double OUTPUT, Double OUTPUT, Double OUTPUT, - Double OUTPUT) - """ + """GetTextExtend(self, text) --> (width, height, descent, externalLeading)""" return _gdi_.GraphicsContext_GetTextExtent(*args, **kwargs) def GetPartialTextExtents(*args, **kwargs): - """GetPartialTextExtents(self, String text, wxArrayDouble widths)""" + """GetPartialTextExtents(self, text) -> [widths]""" return _gdi_.GraphicsContext_GetPartialTextExtents(*args, **kwargs) def DrawBitmap(*args, **kwargs): @@ -4962,15 +5018,16 @@ class GraphicsContext(object): """StrokeLine(self, Double x1, Double y1, Double x2, Double y2)""" return _gdi_.GraphicsContext_StrokeLine(*args, **kwargs) - def StrokeLines(*args): - """ - StrokeLines(self, size_t n, Point2D points) - StrokeLines(self, size_t n, Point2D beginPoints, Point2D endPoints) - """ - return _gdi_.GraphicsContext_StrokeLines(*args) + def StrokeLines(*args, **kwargs): + """StrokeLines(self, List points)""" + return _gdi_.GraphicsContext_StrokeLines(*args, **kwargs) + + def StrokeLineSegements(*args, **kwargs): + """StrokeLineSegements(self, PyObject beginPoints, PyObject endPoints)""" + return _gdi_.GraphicsContext_StrokeLineSegements(*args, **kwargs) def DrawLines(*args, **kwargs): - """DrawLines(self, size_t n, Point2D points, int fillStyle=WINDING_RULE)""" + """DrawLines(self, size_t points, int fillStyle=WINDING_RULE)""" return _gdi_.GraphicsContext_DrawLines(*args, **kwargs) def DrawRectangle(*args, **kwargs): @@ -5010,6 +5067,40 @@ class GCDC(DC): _gdi_.GCDC_swigregister(GCDC) +class Overlay(object): + """Proxy of C++ Overlay class""" + 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) -> Overlay""" + _gdi_.Overlay_swiginit(self,_gdi_.new_Overlay(*args, **kwargs)) + __swig_destroy__ = _gdi_.delete_Overlay + __del__ = lambda self : None; + def Reset(*args, **kwargs): + """Reset(self)""" + return _gdi_.Overlay_Reset(*args, **kwargs) + +_gdi_.Overlay_swigregister(Overlay) + +class DCOverlay(object): + """Proxy of C++ DCOverlay class""" + 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): + """ + __init__(self, Overlay overlay, WindowDC dc, int x, int y, int width, + int height) -> DCOverlay + __init__(self, Overlay overlay, WindowDC dc) -> DCOverlay + """ + _gdi_.DCOverlay_swiginit(self,_gdi_.new_DCOverlay(*args)) + __swig_destroy__ = _gdi_.delete_DCOverlay + __del__ = lambda self : None; + def Clear(*args, **kwargs): + """Clear(self)""" + return _gdi_.DCOverlay_Clear(*args, **kwargs) + +_gdi_.DCOverlay_swigregister(DCOverlay) + #--------------------------------------------------------------------------- IMAGELIST_DRAW_NORMAL = _gdi_.IMAGELIST_DRAW_NORMAL