X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0eae5d09992c634488c5be14d5a378d6e1dedb71..5f2502393e042e6e2c871ff94b7ccaf7a78b264d:/wxPython/src/_dc.i diff --git a/wxPython/src/_dc.i b/wxPython/src/_dc.i index ae2a5ad49e..c589d0d282 100644 --- a/wxPython/src/_dc.i +++ b/wxPython/src/_dc.i @@ -586,7 +586,7 @@ current or specified font. Only works for single line strings.", "", wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxFont *font = NULL), "GetMultiLineTextExtent(wxString string, Font font=None) ->\n (width, height, lineHeight)", - "Get the width, height, decent and leading of the text using the + "Get the width, height, and line height of the text using the current or specified font. Works for single as well as multi-line strings.", ""); @@ -707,8 +707,9 @@ converting a height, for example.", ""); DocDeclStr( - virtual bool , Ok() const, + virtual bool , IsOk() const, "Returns true if the DC is ok to use.", ""); + %pythoncode { Ok = IsOk } @@ -971,8 +972,26 @@ box doesn't contain anything.", ""); // See below for implementation } - %pythoncode { def __nonzero__(self): return self.Ok() }; + %pythoncode { def __nonzero__(self): return self.IsOk() }; + + + // RTL related functions + // --------------------- + DocDeclStr( + virtual wxLayoutDirection , GetLayoutDirection() const, + "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.", ""); + + DocDeclStr( + virtual void , SetLayoutDirection(wxLayoutDirection dir), + "Change the layout direction for this dc.", ""); + + + #ifdef __WXMSW__ long GetHDC(); @@ -1200,6 +1219,8 @@ box doesn't contain anything.", ""); %property(TextExtent, GetTextExtent, doc="See `GetTextExtent`"); %property(TextForeground, GetTextForeground, SetTextForeground, doc="See `GetTextForeground` and `SetTextForeground`"); %property(UserScale, GetUserScale, SetUserScale, doc="See `GetUserScale` and `SetUserScale`"); + + %property(LayoutDirection, GetLayoutDirection, SetLayoutDirection); }; @@ -1226,7 +1247,7 @@ be used for anything. Typical usage is as follows:: 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 @@ -1237,12 +1258,13 @@ of it) before a bitmap can be reselected into another memory DC. class wxMemoryDC : public wxDC { public: DocCtorStr( - wxMemoryDC(), + wxMemoryDC(const wxBitmap& bitmap = wxNullBitmap), "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.", " :see: `MemoryDCFromDC`"); @@ -1287,10 +1309,14 @@ on it, everything is in fact first drawn on an in-memory buffer (a `wx.Bitmap`) and then copied to the screen only once, when this object is destroyed. -It can be used in the same way as any other device -context. wx.BufferedDC itself typically replaces `wx.ClientDC`, if you -want to use it in your EVT_PAINT handler, you should look at +It can be used in the same way as any other device context. +wx.BufferedDC itself typically replaces `wx.ClientDC`, if you want to +use it in your EVT_PAINT handler, you should look at `wx.BufferedPaintDC`. + +Please note that GTK+ 2.0 and OS X provide double buffering themselves +natively. wxBufferedDC is aware of this however, and will bypass the buffering +unless an explicit buffer bitmap is given. ", ""); class wxBufferedDC : public wxMemoryDC @@ -1333,6 +1359,11 @@ public: wxBufferedDC( wxDC* dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA ); +// wxBufferedDC(wxWindow* win, +// wxDC *dc, +// const wxSize &area, +// int style = wxBUFFER_CLIENT_AREA); + DocCtorStr( ~wxBufferedDC(), @@ -1371,8 +1402,6 @@ automatically when it is destroyed. For example:: dc = wx.BufferedPaintDC(self, self.buffer) - - ", ""); class wxBufferedPaintDC : public wxBufferedDC @@ -1386,13 +1415,10 @@ public: "Create a buffered paint DC. As with `wx.BufferedDC`, you may either 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). - -", ""); +window is automatically used).", ""); }; - //--------------------------------------------------------------------------- %newgroup @@ -1444,6 +1470,23 @@ to some applications.", ""); //--------------------------------------------------------------------------- %newgroup +MustHaveApp(wxWindowDC); + +DocStr(wxWindowDC, + "A wx.WindowDC must be constructed if an application wishes to paint on +the whole area of a window (client and decorations). This should +normally be constructed as a temporary stack object; don't store a +wx.WindowDC object.",""); +class wxWindowDC : public wxDC { +public: + DocCtorStr( + wxWindowDC(wxWindow* win), + "Constructor. Pass the window on which you wish to paint.",""); +}; + +//--------------------------------------------------------------------------- +%newgroup + MustHaveApp(wxClientDC); DocStr(wxClientDC, @@ -1458,7 +1501,7 @@ To draw on a window from within an EVT_PAINT handler, construct a To draw on the whole window including decorations, construct a `wx.WindowDC` object (Windows only). ", ""); -class wxClientDC : public wxDC { +class wxClientDC : public wxWindowDC { public: DocCtorStr( wxClientDC(wxWindow* win), @@ -1485,29 +1528,46 @@ window. Attempts to draw outside this area do not appear. To draw on a window from outside EVT_PAINT handlers, construct a `wx.ClientDC` object. ",""); -class wxPaintDC : public wxDC { +class wxPaintDC : public wxClientDC { public: DocCtorStr( wxPaintDC(wxWindow* win), "Constructor. Pass the window on which you wish to paint.", ""); }; + + //--------------------------------------------------------------------------- %newgroup -MustHaveApp(wxWindowDC); +%pythoncode { + 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) +} + + +%newobject wxAutoBufferedPaintDCFactory; +DocDeclStr( + wxDC* , wxAutoBufferedPaintDCFactory(wxWindow* window), + "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.", ""); + -DocStr(wxWindowDC, - "A wx.WindowDC must be constructed if an application wishes to paint on -the whole area of a window (client and decorations). This should -normally be constructed as a temporary stack object; don't store a -wx.WindowDC object.",""); -class wxWindowDC : public wxDC { -public: - DocCtorStr( - wxWindowDC(wxWindow* win), - "Constructor. Pass the window on which you wish to paint.",""); -}; //--------------------------------------------------------------------------- %newgroup @@ -1561,6 +1621,8 @@ output. Default is 720ppi.", ""); DocDeclStr( static int , GetResolution(), "Return resolution used in PostScript output.", ""); + + %property(PrintData, GetPrintData, SetPrintData, doc="See `GetPrintData` and `SetPrintData`"); }; //--------------------------------------------------------------------------- @@ -1582,7 +1644,8 @@ public: wxMetaFile(const wxString& filename = wxPyEmptyString); ~wxMetaFile(); - bool Ok(); + bool IsOk(); + %pythoncode { Ok = IsOk } bool SetClipboard(int width = 0, int height = 0); wxSize GetSize(); @@ -1593,7 +1656,7 @@ public: const wxString& GetFileName() const; #endif - %pythoncode { def __nonzero__(self): return self.Ok() } + %pythoncode { def __nonzero__(self): return self.IsOk() } }; // bool wxMakeMetaFilePlaceable(const wxString& filename,