From f09b568121b4dd21f7eb16cd23a8b47d8fb91141 Mon Sep 17 00:00:00 2001 From: Bryan Petty Date: Thu, 17 Apr 2008 07:06:20 +0000 Subject: [PATCH] Fixed wxScrolledWindow references to properly link (and appropriately changed others to wxScrolled). Initial reviews of a few d* interface headers in this commit as well. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53241 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/doxygen/Doxyfile_inc | 4 +- docs/doxygen/mainpages/cat_classes.h | 16 +- docs/doxygen/mainpages/samples.h | 2 +- docs/doxygen/overviews/dialog.h | 2 +- docs/doxygen/overviews/html.h | 4 +- docs/doxygen/overviews/python.h | 2 +- docs/doxygen/overviews/scrolling.h | 4 +- interface/datetime.h | 54 +- interface/datstrm.h | 276 +++---- interface/dc.h | 1021 ++++++++++++++------------ interface/dcbuffer.h | 154 ++-- interface/html/htmlwin.h | 6 +- interface/scrolbar.h | 5 +- interface/scrolwin.h | 48 +- interface/sizer.h | 4 +- interface/toolbar.h | 2 +- interface/vscroll.h | 26 +- interface/window.h | 15 +- 18 files changed, 882 insertions(+), 763 deletions(-) diff --git a/docs/doxygen/Doxyfile_inc b/docs/doxygen/Doxyfile_inc index 9c88595380..0d3fca4234 100644 --- a/docs/doxygen/Doxyfile_inc +++ b/docs/doxygen/Doxyfile_inc @@ -160,9 +160,9 @@ ALIASES += itemdef{10}="\1 \2,\3,\ ALIASES += endDefList="" # See ENABLED_SECTIONS configuration key for more info about these: -ALIASES += beginWxPerlOnly="\if WXPERL_MANUAL \n wxPerl Note:\n\n" +ALIASES += beginWxPerlOnly="\if WXPERL_MANUAL wxPerl Note: " ALIASES += endWxPerlOnly="\endif" -ALIASES += beginWxPythonOnly="\if WXPYTHON_MANUAL \n wxPython Note:\n\n" +ALIASES += beginWxPythonOnly="\if WXPYTHON_MANUAL wxPython Note: " ALIASES += endWxPythonOnly="\endif" # This is to get around a bug in Doxygen that prevents use of '{' or '}' diff --git a/docs/doxygen/mainpages/cat_classes.h b/docs/doxygen/mainpages/cat_classes.h index 1420509a69..7aa81fe9ba 100644 --- a/docs/doxygen/mainpages/cat_classes.h +++ b/docs/doxygen/mainpages/cat_classes.h @@ -71,9 +71,8 @@ The following are the most important window classes @li wxWindow: base class for all windows and controls @li wxControl: base class (mostly) for native controls/widgets @li wxPanel: window which can smartly manage child windows -@li wxScrolledWindow: Window with automatically managed scrollbars (see wxScrolled) -@li wxVScrolledWindow: As wxScrolledWindow but supports lines of variable - height +@li ::wxScrolledWindow: Window with automatically managed scrollbars (see + wxScrolled) @li wxTopLevelWindow: Any top level window, dialog or frame @@ -208,7 +207,14 @@ platform-dependent. The following are a variety of classes that are derived from wxWindow. @li wxPanel: A window whose colour changes according to current user settings -@li wxScrolledWindow: Window with automatically managed scrollbars +@li ::wxScrolledWindow: Window with automatically managed scrollbars (see + wxScrolled) +@li wxHScrolledWindow: As ::wxScrolledWindow but supports columns of variable + widths +@li wxVScrolledWindow: As ::wxScrolledWindow but supports rows of variable + heights +@li wxHVScrolledWindow: As ::wxScrolledWindow but supports scroll units of + variable sizes. @li wxGrid: A grid (table) window @li wxSplitterWindow: Window which can be split vertically or horizontally @li wxStatusBar: Implements the status bar on a frame @@ -220,8 +226,6 @@ The following are a variety of classes that are derived from wxWindow. @li wxSashWindow: Window with four optional sashes that can be dragged @li wxSashLayoutWindow: Window that can be involved in an IDE-like layout arrangement -@li wxVScrolledWindow: As wxScrolledWindow but supports lines of variable - height @li wxWizardPage: A base class for the page in wizard dialog. @li wxWizardPageSimple: A page in wizard dialog. diff --git a/docs/doxygen/mainpages/samples.h b/docs/doxygen/mainpages/samples.h index 8b5615f40e..ae87007e7a 100644 --- a/docs/doxygen/mainpages/samples.h +++ b/docs/doxygen/mainpages/samples.h @@ -462,7 +462,7 @@ renderer and also how to write a shared library @section page_samples_scrollsub Scroll subwindow sample -This sample demonstrates use of the wxScrolledWindow +This sample demonstrates use of the ::wxScrolledWindow class including placing subwindows into it and drawing simple graphics. It uses the SetTargetWindow method and thus the effect of scrolling does not show in the scrolled window itself, but in one of its subwindows. diff --git a/docs/doxygen/overviews/dialog.h b/docs/doxygen/overviews/dialog.h index eda0e55e0f..31806e243a 100644 --- a/docs/doxygen/overviews/dialog.h +++ b/docs/doxygen/overviews/dialog.h @@ -67,7 +67,7 @@ within wxDialog::Show or wxDialog::ShowModal: @li If that search failed too, wxWidgets finds 'loose' standard buttons (in any kind of sizer) and adds them to a wxStdDialogButtonSizer. If no standard buttons were found, the whole dialog content will scroll. -@li All the children apart from standard buttons are reparented onto a new wxScrolledWindow +@li All the children apart from standard buttons are reparented onto a new ::wxScrolledWindow object, using the old top-level sizer for the scrolled window and creating a new top-level sizer to lay out the scrolled window and standard button sizer. diff --git a/docs/doxygen/overviews/html.h b/docs/doxygen/overviews/html.h index 4d8485e9c6..1d9803674e 100644 --- a/docs/doxygen/overviews/html.h +++ b/docs/doxygen/overviews/html.h @@ -45,7 +45,7 @@ There is a generic wxHtmlParser class, independent of wxHtmlWindow. First of all, you must include @c wx/wxhtml.h. -Class wxHtmlWindow (derived from wxScrolledWindow) is used to display HTML documents. +Class wxHtmlWindow (derived from ::wxScrolledWindow) is used to display HTML documents. It has two important methods: wxHtmlWindow::LoadPage and wxHtmlWindow::SetPage. LoadPage loads and displays HTML file while SetPage displays directly the @@ -65,7 +65,7 @@ See wxHtmlHelpController. @subsection overview_html_quickstart_settingup Setting up wxHtmlWindow -Because wxHtmlWindow is derived from wxScrolledWindow and not from +Because wxHtmlWindow is derived from ::wxScrolledWindow and not from wxFrame, it doesn't have visible frame. But the user usually wants to see the title of HTML page displayed somewhere and the frame's titlebar is the ideal place for it. diff --git a/docs/doxygen/overviews/python.h b/docs/doxygen/overviews/python.h index d49b3ca3c7..b269a69188 100644 --- a/docs/doxygen/overviews/python.h +++ b/docs/doxygen/overviews/python.h @@ -415,7 +415,7 @@ spec over time. @li wxScreenDC @li wxScrollBar @li wxScrollEvent -@li wxScrolledWindow +@li ::wxScrolledWindow @li wxScrollWinEvent @li wxShowEvent @li wxSingleChoiceDialog diff --git a/docs/doxygen/overviews/scrolling.h b/docs/doxygen/overviews/scrolling.h index c4a1a86c2f..b0cb8a30f8 100644 --- a/docs/doxygen/overviews/scrolling.h +++ b/docs/doxygen/overviews/scrolling.h @@ -12,7 +12,7 @@ Classes: @li wxWindow -@li wxScrolledWindow +@li ::wxScrolledWindow @li wxScrollBar @li @ref overview_scrolling_model @@ -35,7 +35,7 @@ events. If you created a wxWindow object with scrollbars, and then clicked on the scrollbars, nothing at all would happen. This is deliberate, because the @e interpretation of scroll events varies from one window class to another. -wxScrolledWindow (formerly wxCanvas) is an example of a window that adds +::wxScrolledWindow (formerly wxCanvas) is an example of a window that adds functionality to make scrolling really work. It assumes that scrolling happens in consistent units, not different-sized jumps, and that page size is represented by the visible portion of the window. It is suited to drawing diff --git a/interface/datetime.h b/interface/datetime.h index 84e3836bf4..770f981cbb 100644 --- a/interface/datetime.h +++ b/interface/datetime.h @@ -49,40 +49,40 @@ // some symbolic names for TZ // Europe - WET = GMT0, // Western Europe Time - WEST = GMT1, // Western Europe Summer Time - CET = GMT1, // Central Europe Time - CEST = GMT2, // Central Europe Summer Time - EET = GMT2, // Eastern Europe Time - EEST = GMT3, // Eastern Europe Summer Time - MSK = GMT3, // Moscow Time - MSD = GMT4, // Moscow Summer Time + WET = GMT0, // Western Europe Time + WEST = GMT1, // Western Europe Summer Time + CET = GMT1, // Central Europe Time + CEST = GMT2, // Central Europe Summer Time + EET = GMT2, // Eastern Europe Time + EEST = GMT3, // Eastern Europe Summer Time + MSK = GMT3, // Moscow Time + MSD = GMT4, // Moscow Summer Time // US and Canada - AST = GMT_4, // Atlantic Standard Time - ADT = GMT_3, // Atlantic Daylight Time - EST = GMT_5, // Eastern Standard Time - EDT = GMT_4, // Eastern Daylight Saving Time - CST = GMT_6, // Central Standard Time - CDT = GMT_5, // Central Daylight Saving Time - MST = GMT_7, // Mountain Standard Time - MDT = GMT_6, // Mountain Daylight Saving Time - PST = GMT_8, // Pacific Standard Time - PDT = GMT_7, // Pacific Daylight Saving Time - HST = GMT_10, // Hawaiian Standard Time - AKST = GMT_9, // Alaska Standard Time - AKDT = GMT_8, // Alaska Daylight Saving Time + AST = GMT_4, // Atlantic Standard Time + ADT = GMT_3, // Atlantic Daylight Time + EST = GMT_5, // Eastern Standard Time + EDT = GMT_4, // Eastern Daylight Saving Time + CST = GMT_6, // Central Standard Time + CDT = GMT_5, // Central Daylight Saving Time + MST = GMT_7, // Mountain Standard Time + MDT = GMT_6, // Mountain Daylight Saving Time + PST = GMT_8, // Pacific Standard Time + PDT = GMT_7, // Pacific Daylight Saving Time + HST = GMT_10, // Hawaiian Standard Time + AKST = GMT_9, // Alaska Standard Time + AKDT = GMT_8, // Alaska Daylight Saving Time // Australia - A_WST = GMT8, // Western Standard Time - A_CST = GMT13 + 1, // Central Standard Time (+9.5) - A_EST = GMT10, // Eastern Standard Time - A_ESST = GMT11, // Eastern Summer Time + A_WST = GMT8, // Western Standard Time + A_CST = GMT13 + 1, // Central Standard Time (+9.5) + A_EST = GMT10, // Eastern Standard Time + A_ESST = GMT11, // Eastern Summer Time // New Zealand - NZST = GMT12, // Standard Time - NZDT = GMT13, // Daylight Saving Time + NZST = GMT12, // Standard Time + NZDT = GMT13, // Daylight Saving Time // Universal Coordinated Time = the new and politically correct name // for GMT diff --git a/interface/datstrm.h b/interface/datstrm.h index ccf85e7cfb..3a0629dba9 100644 --- a/interface/datstrm.h +++ b/interface/datstrm.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: datstrm.h -// Purpose: interface of wxDataOutputStream +// Purpose: interface of wxDataInputStream and wxDataOutputStream // Author: wxWidgets team // RCS-ID: $Id$ // Licence: wxWindows license @@ -10,44 +10,48 @@ @class wxDataOutputStream @wxheader{datstrm.h} - This class provides functions that write binary data types in a - portable way. Data can be written in either big-endian or little-endian - format, little-endian being the default on all architectures. + This class provides functions that write binary data types in a portable + way. Data can be written in either big-endian or little-endian format, + little-endian being the default on all architectures. - If you want to write data to text files (or streams) use - wxTextOutputStream instead. + If you want to write data to text files (or streams) use wxTextOutputStream + instead. - The operator is overloaded and you can use this class like a standard - C++ iostream. See wxDataInputStream for its - usage and caveats. - - See also wxDataInputStream. + The "<<" operator is overloaded and you can use this class like a standard + C++ iostream. See wxDataInputStream for its usage and caveats. @library{wxbase} @category{streams} + + @see wxDataInputStream */ class wxDataOutputStream { public: - //@{ /** - ) - Constructs a datastream object from an output stream. Only write methods will - be available. The second form is only available in Unicode build of wxWidgets. + Constructs a datastream object from an output stream. Only write + methods will be available. @param stream The output stream. - @param conv - Charset conversion object object used to encoding Unicode - strings before writing them to the stream - in Unicode mode (see WriteString() - documentation for detailed description). Note that you must not destroy - conv before you destroy this wxDataOutputStream instance! It is - recommended to use default value (UTF-8). */ wxDataOutputStream(wxOutputStream& stream); - wxDataOutputStream(wxOutputStream& stream); - //@} + /** + Constructs a datastream object from an output stream. Only write + methods will be available. This constructor is only available in + Unicode builds of wxWidgets. + + @param stream + The output stream. + @param conv + Charset conversion object object used to encoding Unicode strings + before writing them to the stream in Unicode mode (see + WriteString() for a detailed description). Note that you must not + destroy @a conv before you destroy this wxDataOutputStream + instance! It is recommended to use the default value (UTF-8). + */ + wxDataOutputStream(wxOutputStream& stream, + const wxMBConv& conv = wxConvAuto()); /** Destroys the wxDataOutputStream object. @@ -55,67 +59,74 @@ public: ~wxDataOutputStream(); /** - If @a be_order is @true, all data will be written in big-endian - order, e.g. for reading on a Sparc or from Java-Streams (which - always use big-endian order), otherwise data will be written in - little-endian order. + If @a be_order is @true, all data will be written in big-endian order, + e.g. for reading on a Sparc or from Java-Streams (which always use + big-endian order), otherwise data will be written in little-endian + order. */ void BigEndianOrdered(bool be_order); - //@{ + /** + Writes the single byte @a i8 to the stream. + */ + void Write8(wxUint8 i8); + /** + Writes an array of bytes to the stream. The amount of bytes to write is + specified with the @a size variable. + */ + void Write8(const wxUint8* buffer, size_t size); + + /** + Writes the 16 bit unsigned integer @a i16 to the stream. + */ + void Write16(wxUint16 i16); /** Writes an array of 16 bit unsigned integer to the stream. The amount of 16 bit unsigned integer to write is specified with the @a size variable. */ - void Write16(wxUint16 i16); void Write16(const wxUint16* buffer, size_t size); - //@} - //@{ + /** + Writes the 32 bit unsigned integer @a i32 to the stream. + */ + void Write32(wxUint32 i32); /** Writes an array of 32 bit unsigned integer to the stream. The amount of 32 bit unsigned integer to write is specified with the @a size variable. */ - void Write32(wxUint32 i32); void Write32(const wxUint32* buffer, size_t size); - //@} - //@{ + /** + Writes the 64 bit unsigned integer @a i64 to the stream. + */ + void Write64(wxUint64 i64); /** Writes an array of 64 bit unsigned integer to the stream. The amount of 64 bit unsigned integer to write is specified with the @a size variable. */ - void Write64(wxUint64 i64); void Write64(const wxUint64* buffer, size_t size); - //@} - //@{ /** - Writes an array of bytes to the stream. The amount of bytes to write is - specified with the @a size variable. + Writes the double @a f to the stream using the IEEE format. */ - void Write8(wxUint8 i8); - void Write8(const wxUint8* buffer, size_t size); - //@} - - //@{ + void WriteDouble(double f); /** Writes an array of double to the stream. The amount of double to write is specified with the @a size variable. */ - void WriteDouble(double f); void WriteDouble(const double* buffer, size_t size); - //@} /** - Writes @a string to the stream. Actually, this method writes the size of - the string before writing @a string itself. - In ANSI build of wxWidgets, the string is written to the stream in exactly - same way it is represented in memory. In Unicode build, however, the string - is first converted to multibyte representation with @e conv object passed - to stream's constructor (consequently, ANSI application can read data - written by Unicode application, as long as they agree on encoding) and this - representation is written to the stream. UTF-8 is used by default. + Writes @a string to the stream. Actually, this method writes the size + of the string before writing @a string itself. + + In ANSI build of wxWidgets, the string is written to the stream in + exactly same way it is represented in memory. In Unicode build, + however, the string is first converted to multibyte representation with + @e conv object passed to stream's constructor (consequently, ANSI + applications can read data written by Unicode application, as long as + they agree on encoding) and this representation is written to the + stream. UTF-8 is used by default. */ void WriteString(const wxString& string); }; @@ -126,61 +137,65 @@ public: @class wxDataInputStream @wxheader{datstrm.h} - This class provides functions that read binary data types in a - portable way. Data can be read in either big-endian or little-endian - format, little-endian being the default on all architectures. + This class provides functions that read binary data types in a portable + way. Data can be read in either big-endian or little-endian format, + little-endian being the default on all architectures. - If you want to read data from text files (or streams) use - wxTextInputStream instead. + If you want to read data from text files (or streams) use wxTextInputStream + instead. - The operator is overloaded and you can use this class like a standard C++ - iostream. - Note, however, that the arguments are the fixed size types wxUint32, wxInt32 etc - and on a typical 32-bit computer, none of these match to the "long" type - (wxInt32 - is defined as signed int on 32-bit architectures) so that you cannot use long. - To avoid - problems (here and elsewhere), make use of the wxInt32, wxUint32, etc types. + The ">>" operator is overloaded and you can use this class like a standard + C++ iostream. Note, however, that the arguments are the fixed size types + wxUint32, wxInt32 etc and on a typical 32-bit computer, none of these match + to the "long" type (wxInt32 is defined as signed int on 32-bit + architectures) so that you cannot use long. To avoid problems (here and + elsewhere), make use of the wxInt32, wxUint32, etc types. For example: @code wxFileInputStream input( "mytext.dat" ); - wxDataInputStream store( input ); - wxUint8 i1; - float f2; - wxString line; - - store i1; // read a 8 bit integer. - store i1 f2; // read a 8 bit integer followed by float. - store line; // read a text line + wxDataInputStream store( input ); + wxUint8 i1; + float f2; + wxString line; + + store >> i1; // read a 8 bit integer. + store >> i1 >> f2; // read a 8 bit integer followed by float. + store >> line; // read a text line @endcode - See also wxDataOutputStream. - @library{wxbase} @category{streams} + + @see wxDataOutputStream */ class wxDataInputStream { public: - //@{ /** - ) - Constructs a datastream object from an input stream. Only read methods will - be available. The second form is only available in Unicode build of wxWidgets. + Constructs a datastream object from an input stream. Only read methods + will be available. + + @param stream + The input stream. + */ + wxDataInputStream(wxInputStream& stream); + /** + Constructs a datastream object from an input stream. Only read methods + will be available. This constructor is only available in Unicode builds + of wxWidgets. @param stream The input stream. @param conv Charset conversion object object used to decode strings in Unicode - mode (see ReadString() - documentation for detailed description). Note that you must not destroy - conv before you destroy this wxDataInputStream instance! + mode (see ReadString() for a detailed description). Note that you + must not destroy @a conv before you destroy this wxDataInputStream + instance! */ - wxDataInputStream(wxInputStream& stream); - wxDataInputStream(wxInputStream& stream); - //@} + wxDataInputStream(wxInputStream& stream, + const wxMBConv& conv = wxConvAuto()); /** Destroys the wxDataInputStream object. @@ -188,70 +203,77 @@ public: ~wxDataInputStream(); /** - If @a be_order is @true, all data will be read in big-endian - order, such as written by programs on a big endian architecture - (e.g. Sparc) or written by Java-Streams (which always use - big-endian order). + If @a be_order is @true, all data will be read in big-endian order, + such as written by programs on a big endian architecture (e.g. Sparc) + or written by Java-Streams (which always use big-endian order). */ void BigEndianOrdered(bool be_order); - //@{ /** - Reads 16 bit unsigned integers from the stream in a specified buffer. the - amount of 16 bit unsigned integer to read is specified by the @a size variable. + Reads a single byte from the stream. + */ + wxUint8 Read8(); + /** + Reads bytes from the stream in a specified buffer. The amount of bytes + to read is specified by the @a size variable. + */ + void Read8(wxUint8* buffer, size_t size); + + /** + Reads a 16 bit unsigned integer from the stream. */ wxUint16 Read16(); + /** + Reads 16 bit unsigned integers from the stream in a specified buffer. + The amount of 16 bit unsigned integers to read is specified by the + @a size variable. + */ void Read16(wxUint16* buffer, size_t size); - //@} - //@{ /** - Reads 32 bit unsigned integers from the stream in a specified buffer. the - amount of - 32 bit unsigned integer to read is specified by the @a size variable. + Reads a 32 bit unsigned integer from the stream. */ wxUint32 Read32(); + /** + Reads 32 bit unsigned integers from the stream in a specified buffer. + The amount of 32 bit unsigned integers to read is specified by the + @a size variable. + */ void Read32(wxUint32* buffer, size_t size); - //@} - //@{ /** - Reads 64 bit unsigned integers from the stream in a specified buffer. the - amount of - 64 bit unsigned integer to read is specified by the @a size variable. + Reads a 64 bit unsigned integer from the stream. */ wxUint64 Read64(); - void Read64(wxUint64* buffer, size_t size); - //@} - - //@{ /** - Reads bytes from the stream in a specified buffer. The amount of - bytes to read is specified by the @a size variable. + Reads 64 bit unsigned integers from the stream in a specified buffer. + The amount of 64 bit unsigned integers to read is specified by the + @a size variable. */ - wxUint8 Read8(); - void Read8(wxUint8* buffer, size_t size); - //@} + void Read64(wxUint64* buffer, size_t size); - //@{ /** - Reads double data (IEEE encoded) from the stream in a specified buffer. the - amount of - double to read is specified by the @a size variable. + Reads a double (IEEE encoded) from the stream. */ double ReadDouble(); + /** + Reads double data (IEEE encoded) from the stream in a specified buffer. + The amount of doubles to read is specified by the @a size variable. + */ void ReadDouble(double* buffer, size_t size); - //@} /** - Reads a string from a stream. Actually, this function first reads a long - integer specifying the length of the string (without the last null character) - and then reads the string. - In Unicode build of wxWidgets, the fuction first reads multibyte (char*) - string from the stream and then converts it to Unicode using the @e conv - object passed to constructor and returns the result as wxString. You are - responsible for using the same convertor as when writing the stream. - See also wxDataOutputStream::WriteString. + Reads a string from a stream. Actually, this function first reads a + long integer specifying the length of the string (without the last null + character) and then reads the string. + + In Unicode build of wxWidgets, the fuction first reads multibyte + (char*) string from the stream and then converts it to Unicode using + the @e conv object passed to constructor and returns the result as + wxString. You are responsible for using the same convertor as when + writing the stream. + + @see wxDataOutputStream::WriteString() */ wxString ReadString(); }; diff --git a/interface/dc.h b/interface/dc.h index e37d334fbc..9b43844acd 100644 --- a/interface/dc.h +++ b/interface/dc.h @@ -10,36 +10,43 @@ @class wxDC @wxheader{dc.h} - A wxDC is a @e device context onto which graphics and text can be drawn. - It is intended to represent a number of output devices in a generic way, - so a window can have a device context associated with it, and a printer also - has a device context. - In this way, the same piece of code may write to a number of different devices, - if the device context is used as a parameter. + A wxDC is a @e "device context" onto which graphics and text can be drawn. + It is intended to represent a number of output devices in a generic way, so + a window can have a device context associated with it, and a printer also + has a device context. In this way, the same piece of code may write to a + number of different devices, if the device context is used as a parameter. Notice that wxDC is an abstract base class and can't be created directly, - please use wxPaintDC, wxClientDC, - wxWindowDC, wxScreenDC, - wxMemoryDC or wxPrinterDC. - - Please note that in addition to the versions of the methods documented here, - there are also versions which accept single @c wxPoint parameter instead of - two @c wxCoord ones or @c wxPoint and @c wxSize instead of four of - them. - - @todo Precise definition of default/initial state. - - @todo Pixelwise definition of operations (e.g. last point of a line not drawn). - - @todo Coordinates: state clearly which type of coordinates are returned by the - various Get*Point() or similar functions - often they are client coordinates - but not always - + please use wxPaintDC, wxClientDC, wxWindowDC, wxScreenDC, wxMemoryDC or + wxPrinterDC. + + Please note that in addition to the versions of the methods documented + here, there are also versions which accept single wxPoint parameter instead + of two wxCoord ones or wxPoint and wxSize instead of four of them. + + @note Beginning with wxWidgets 2.9.0 the entire wxDC code has been + reorganized. All platform dependent code (actual all drawing code) + has been moved into backend classes which derive from a common + wxDCImpl class. The user-visible classes such as wxClientDC and + wxPaintDC merely forward all calls to the backend implementation. + + @section dc_alpha Support for Transparency / Alpha Channel + + On Mac OS X, when using Core Graphics (wxMAC_USE_CORE_GRAPHICS set to 1), + colors with alpha are supported. Instances wxPen or wxBrush that are built + from wxColour use the color's alpha values when stroking or filling. @library{wxcore} @category{dc,gdi} - @see Overview() + @see @ref overview_dc + + @todo Precise definition of default/initial state. + @todo Pixelwise definition of operations (e.g. last point of a line not + drawn). + @todo Coordinates: state clearly which type of coordinates are returned by + the various Get*Point() or similar functions - often they are client + coordinates but not always. */ class wxDC : public wxObject { @@ -47,7 +54,8 @@ public: /** Copy from a source DC to this DC, specifying the destination coordinates, size of area to copy, source DC, source coordinates, - logical function, whether to use a bitmap mask, and mask source position. + logical function, whether to use a bitmap mask, and mask source + position. @param xdest Destination device context x position. @@ -64,65 +72,55 @@ public: @param ysrc Source device context y position. @param logicalFunc - Logical function to use: see SetLogicalFunction(). + Logical function to use, see SetLogicalFunction(). @param useMask - If @true, Blit does a transparent blit using the mask that is associated - with the bitmap - selected into the source device context. The Windows implementation does - the following if MaskBlt cannot be used: - - - Creates a temporary bitmap and copies the destination area into it. - Copies the source area into the temporary bitmap using the specified - logical function. - Sets the masked area in the temporary bitmap to BLACK by ANDing the - mask bitmap with the temp bitmap with the foreground colour set to WHITE - and the bg colour set to BLACK. - Sets the unmasked area in the destination area to BLACK by ANDing the - mask bitmap with the destination area with the foreground colour set to - BLACK - and the background colour set to WHITE. - ORs the temporary bitmap with the destination area. - Deletes the temporary bitmap. - - - This sequence of operations ensures that the source's transparent area need - not be black, - and logical functions are supported. - Note: on Windows, blitting with masks can be speeded up considerably by - compiling - wxWidgets with the wxUSE_DC_CACHE option enabled. You can also influence - whether MaskBlt - or the explicit mask blitting code above is used, by using wxSystemOptions - and - setting the no-maskblt option to 1. + If @true, Blit does a transparent blit using the mask that is + associated with the bitmap selected into the source device context. + The Windows implementation does the following if MaskBlt cannot be + used: +
    +
  1. Creates a temporary bitmap and copies the destination area into + it.
  2. +
  3. Copies the source area into the temporary bitmap using the + specified logical function.
  4. +
  5. Sets the masked area in the temporary bitmap to BLACK by ANDing + the mask bitmap with the temp bitmap with the foreground colour + set to WHITE and the bg colour set to BLACK.
  6. +
  7. Sets the unmasked area in the destination area to BLACK by + ANDing the mask bitmap with the destination area with the + foreground colour set to BLACK and the background colour set to + WHITE.
  8. +
  9. ORs the temporary bitmap with the destination area.
  10. +
  11. Deletes the temporary bitmap.
  12. +
+ This sequence of operations ensures that the source's transparent + area need not be black, and logical functions are supported. + @n @b Note: on Windows, blitting with masks can be speeded up + considerably by compiling wxWidgets with the wxUSE_DC_CACHE option + enabled. You can also influence whether MaskBlt or the explicit + mask blitting code above is used, by using wxSystemOptions and + setting the @c no-maskblt option to 1. @param xsrcMask - Source x position on the mask. If both xsrcMask and ysrcMask are -1, xsrc - and ysrc - will be assumed for the mask source position. Currently only implemented on - Windows. + Source x position on the mask. If both xsrcMask and ysrcMask are + -1, xsrc and ysrc will be assumed for the mask source position. + Currently only implemented on Windows. @param ysrcMask - Source y position on the mask. If both xsrcMask and ysrcMask are -1, xsrc - and ysrc - will be assumed for the mask source position. Currently only implemented on - Windows. + Source y position on the mask. If both xsrcMask and ysrcMask are + -1, xsrc and ysrc will be assumed for the mask source position. + Currently only implemented on Windows. - @remarks There is partial support for Blit in wxPostScriptDC, under X. + @remarks There is partial support for Blit() in wxPostScriptDC, under X. @see StretchBlit(), wxMemoryDC, wxBitmap, wxMask */ bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, - wxCoord height, wxDC* source, - wxCoord xsrc, wxCoord ysrc, - int logicalFunc = wxCOPY, - bool useMask = false, - wxCoord xsrcMask = -1, - wxCoord ysrcMask = -1); + wxCoord height, wxDC* source, wxCoord xsrc, wxCoord ysrc, + int logicalFunc = wxCOPY, bool useMask = false, + wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); /** - Adds the specified point to the bounding box which can be retrieved with - MinX(), MaxX() and - MinY(), MaxY() functions. + Adds the specified point to the bounding box which can be retrieved + with MinX(), MaxX() and MinY(), MaxY() functions. @see ResetBoundingBox() */ @@ -135,21 +133,22 @@ public: /** Performs all necessary computations for given platform and context type - after each change of scale and origin parameters. Usually called automatically - internally after such changes. + after each change of scale and origin parameters. Usually called + automatically internally after such changes. */ virtual void ComputeScaleAndOrigin(); /** - Displays a cross hair using the current pen. This is a vertical - and horizontal line the height and width of the window, centred - on the given point. + Displays a cross hair using the current pen. This is a vertical and + horizontal line the height and width of the window, centred on the + given point. */ void CrossHair(wxCoord x, wxCoord y); /** Destroys the current clipping region so that none of the DC is clipped. - See also SetClippingRegion(). + + @see SetClippingRegion() */ void DestroyClippingRegion(); @@ -160,9 +159,9 @@ public: virtual wxCoord DeviceToLogicalX(wxCoord x); /** - Convert device X coordinate to relative logical coordinate, using the current - mapping mode but ignoring the x axis orientation. - Use this function for converting a width, for example. + Convert device X coordinate to relative logical coordinate, using the + current mapping mode but ignoring the x axis orientation. Use this + function for converting a width, for example. */ virtual wxCoord DeviceToLogicalXRel(wxCoord x); @@ -173,43 +172,43 @@ public: virtual wxCoord DeviceToLogicalY(wxCoord y); /** - Convert device Y coordinate to relative logical coordinate, using the current - mapping mode but ignoring the y axis orientation. - Use this function for converting a height, for example. + Convert device Y coordinate to relative logical coordinate, using the + current mapping mode but ignoring the y axis orientation. Use this + function for converting a height, for example. */ virtual wxCoord DeviceToLogicalYRel(wxCoord y); /** - Draws an arc of a circle, centred on (@e xc, yc), with starting point (@e x1, - y1) - and ending at (@e x2, y2). The current pen is used for the outline - and the current brush for filling the shape. - The arc is drawn in an anticlockwise direction from the start point to the end - point. + Draws an arc of a circle, centred on (@a xc, @a yc), with starting + point (@a x1, @a y1) and ending at (@a x2, @a y2). The current pen is + used for the outline and the current brush for filling the shape. + + The arc is drawn in a counter-clockwise direction from the start point + to the end point. */ void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc); + wxCoord xc, wxCoord yc); /** - Draw a bitmap on the device context at the specified point. If @a transparent - is @true and the bitmap has - a transparency mask, the bitmap will be drawn transparently. - When drawing a mono-bitmap, the current text foreground colour will be used to - draw the foreground - of the bitmap (all bits set to 1), and the current text background colour to - draw the background - (all bits set to 0). See also SetTextForeground(), - SetTextBackground() and wxMemoryDC. + Draw a bitmap on the device context at the specified point. If + @a transparent is @true and the bitmap has a transparency mask, the + bitmap will be drawn transparently. + + When drawing a mono-bitmap, the current text foreground colour will be + used to draw the foreground of the bitmap (all bits set to 1), and the + current text background colour to draw the background (all bits set to + 0). + + @see SetTextForeground(), SetTextBackground(), wxMemoryDC */ void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, - bool transparent); + bool transparent); //@{ /** Draws a check mark inside the given rectangle. */ - void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, - wxCoord height); + void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DrawCheckMark(const wxRect& rect); //@} @@ -225,148 +224,177 @@ public: //@{ /** - Draws an ellipse contained in the rectangle specified either with the given top - left corner and the given size or directly. The current pen is used for the - outline and the current brush for filling the shape. + Draws an ellipse contained in the rectangle specified either with the + given top left corner and the given size or directly. The current pen + is used for the outline and the current brush for filling the shape. @see DrawCircle() */ - void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, - wxCoord height); + void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); void DrawEllipse(const wxPoint& pt, const wxSize& size); void DrawEllipse(const wxRect& rect); //@} /** - Draws an arc of an ellipse. The current pen is used for drawing the arc and - the current brush is used for drawing the pie. - @a x and @a y specify the x and y coordinates of the upper-left corner of the - rectangle that contains - the ellipse. - @a width and @a height specify the width and height of the rectangle that - contains - the ellipse. - @a start and @a end specify the start and end of the arc relative to the - three-o'clock - position from the center of the rectangle. Angles are specified - in degrees (360 is a complete circle). Positive values mean - counter-clockwise motion. If @a start is equal to @e end, a - complete ellipse will be drawn. + Draws an arc of an ellipse. The current pen is used for drawing the arc + and the current brush is used for drawing the pie. + + @a x and @a y specify the x and y coordinates of the upper-left corner + of the rectangle that contains the ellipse. + + @a width and @a height specify the width and height of the rectangle + that contains the ellipse. + + @a start and @a end specify the start and end of the arc relative to + the three-o'clock position from the center of the rectangle. Angles are + specified in degrees (360 is a complete circle). Positive values mean + counter-clockwise motion. If @a start is equal to @e end, a complete + ellipse will be drawn. */ - void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord width, - wxCoord height, - double start, - double end); + void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord width, wxCoord height, + double start, double end); /** - Draw an icon on the display (does nothing if the device context is PostScript). - This can be the simplest way of drawing bitmaps on a window. + Draw an icon on the display (does nothing if the device context is + PostScript). This can be the simplest way of drawing bitmaps on a + window. */ void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); //@{ /** - Draw optional bitmap and the text into the given rectangle and aligns it as - specified - by alignment parameter; it also will emphasize the character with the given - index if - it is != -1 and return the bounding rectangle if required. + Draw optional bitmap and the text into the given rectangle and aligns + it as specified by alignment parameter; it also will emphasize the + character with the given index if it is != -1 and return the bounding + rectangle if required. */ - virtual void DrawLabel(const wxString& text, - const wxBitmap& image, + virtual void DrawLabel(const wxString& text, const wxBitmap& image, const wxRect& rect, int alignment = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1, - wxRect* rectBounding = NULL); + int indexAccel = -1, wxRect* rectBounding = NULL); void DrawLabel(const wxString& text, const wxRect& rect, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1); //@} /** - Draws a line from the first point to the second. The current pen is used - for drawing the line. Note that the point (x2, y2) is not part of the - line and is not drawn by this function (this is consistent with the behaviour - of many other toolkits). + Draws a line from the first point to the second. The current pen is + used for drawing the line. Note that the point (@a x2, @a y2) is not + part of the line and is not drawn by this function (this is consistent + with the behaviour of many other toolkits). */ void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - //@{ /** - This method uses a list of wxPoints, adding the optional offset - coordinate. The programmer is responsible for deleting the list - of points. + Draws lines using an array of points of size @a n adding the optional + offset coordinate. The current pen is used for drawing the lines. + + @beginWxPythonOnly + The wxPython version of this method accepts a Python list of wxPoint + objects. + @endWxPythonOnly */ void DrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0); + /** + This method uses a list of wxPoints, adding the optional offset + coordinate. The programmer is responsible for deleting the list of + points. + + @beginWxPythonOnly + The wxPython version of this method accepts a Python list of wxPoint + objects. + @endWxPythonOnly + */ void DrawLines(const wxPointList* points, - wxCoord xoffset = 0, - wxCoord yoffset = 0); - //@} + wxCoord xoffset = 0, wxCoord yoffset = 0); /** Draws a point using the color of the current pen. Note that the other - properties of the pen are not used, such as width etc.. + properties of the pen are not used, such as width. */ void DrawPoint(wxCoord x, wxCoord y); /** - Draws two or more filled polygons using an array of @e points, adding the - optional offset coordinates. - Notice that for the platforms providing a native implementation - of this function (Windows and PostScript-based wxDC currently), this is more - efficient than using DrawPolygon() in a loop. - @a n specifies the number of polygons to draw, the array @e count of size - @a n specifies the number of points in each of the polygons in the - @e points array. - The last argument specifies the fill rule: @b wxODDEVEN_RULE (the default) - or @b wxWINDING_RULE. - The current pen is used for drawing the outline, and the current brush for - filling the shape. Using a transparent brush suppresses filling. - The polygons maybe disjoint or overlapping. Each polygon specified in a call to - @b DrawPolyPolygon must be closed. Unlike polygons created by the - DrawPolygon() member function, the polygons created by - @b DrawPolyPolygon are not closed automatically. - */ - void DrawPolyPolygon(int n, int count[], wxPoint points[], - wxCoord xoffset = 0, - wxCoord yoffset = 0, - int fill_style = wxODDEVEN_RULE); + Draws a filled polygon using an array of points of size @a n, adding + the optional offset coordinate. The first and last points are + automatically closed. - //@{ + The last argument specifies the fill rule: @b wxODDEVEN_RULE (the + default) or @b wxWINDING_RULE. + + The current pen is used for drawing the outline, and the current brush + for filling the shape. Using a transparent brush suppresses filling. + */ + void DrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, + wxCoord yoffset = 0, int fill_style = wxODDEVEN_RULE); /** - This method draws a filled polygon using a list of wxPoints, - adding the optional offset coordinate. + This method draws a filled polygon using a list of wxPoints, adding the + optional offset coordinate. The first and last points are automatically + closed. + The last argument specifies the fill rule: @b wxODDEVEN_RULE (the default) or @b wxWINDING_RULE. + The current pen is used for drawing the outline, and the current brush - for filling the shape. Using a transparent brush suppresses filling. + for filling the shape. Using a transparent brush suppresses filling. + The programmer is responsible for deleting the list of points. - Note that wxWidgets automatically closes the first and last points. + + @beginWxPythonOnly + The wxPython version of this method accepts a Python list of wxPoint + objects. + @endWxPythonOnly */ - void DrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, - wxCoord yoffset = 0, - int fill_style = wxODDEVEN_RULE); void DrawPolygon(const wxPointList* points, - wxCoord xoffset = 0, - wxCoord yoffset = 0, + wxCoord xoffset = 0, wxCoord yoffset = 0, int fill_style = wxODDEVEN_RULE); - //@} + + /** + Draws two or more filled polygons using an array of @a points, adding + the optional offset coordinates. + + Notice that for the platforms providing a native implementation of this + function (Windows and PostScript-based wxDC currently), this is more + efficient than using DrawPolygon() in a loop. + + @a n specifies the number of polygons to draw, the array @e count of + size @a n specifies the number of points in each of the polygons in the + @a points array. + + The last argument specifies the fill rule: @b wxODDEVEN_RULE (the + default) or @b wxWINDING_RULE. + + The current pen is used for drawing the outline, and the current brush + for filling the shape. Using a transparent brush suppresses filling. + + The polygons maybe disjoint or overlapping. Each polygon specified in a + call to DrawPolyPolygon() must be closed. Unlike polygons created by + the DrawPolygon() member function, the polygons created by this + method are not closed automatically. + + @beginWxPythonOnly + Not implemented yet. + @endWxPythonOnly + */ + void DrawPolyPolygon(int n, int count[], wxPoint points[], + wxCoord xoffset = 0, wxCoord yoffset = 0, + int fill_style = wxODDEVEN_RULE); /** Draws a rectangle with the given top left corner, and with the given size. The current pen is used for the outline and the current brush for filling the shape. */ - void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, - wxCoord height); + void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); /** Draws the text rotated by @a angle degrees. + @note Under Win9x only TrueType fonts can be drawn by this function. In - particular, a font different from @c wxNORMAL_FONT should be used as the - latter is not a TrueType font. @c wxSWISS_FONT is an example of a font - which is. + particular, a font different from @c wxNORMAL_FONT should be used + as the latter is not a TrueType font. @c wxSWISS_FONT is an + example of a font which is. @see DrawText() */ @@ -375,44 +403,47 @@ public: /** Draws a rectangle with the given top left corner, and with the given - size. The corners are quarter-circles using the given radius. The + size. The corners are quarter-circles using the given radius. The current pen is used for the outline and the current brush for filling the shape. - If @a radius is positive, the value is assumed to be the - radius of the rounded corner. If @a radius is negative, - the absolute value is assumed to be the @e proportion of the smallest - dimension of the rectangle. This means that the corner can be - a sensible size relative to the size of the rectangle, and also avoids - the strange effects X produces when the corners are too big for - the rectangle. + + If @a radius is positive, the value is assumed to be the radius of the + rounded corner. If @a radius is negative, the absolute value is assumed + to be the @e proportion of the smallest dimension of the rectangle. + This means that the corner can be a sensible size relative to the size + of the rectangle, and also avoids the strange effects X produces when + the corners are too big for the rectangle. */ void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, - wxCoord height, - double radius); + wxCoord height, double radius); //@{ /** - Draws a three-point spline using the current pen. + Draws a spline between all given points using the current pen. + + @beginWxPythonOnly + The wxPython version of this method accepts a Python list of wxPoint + objects. + @endWxPythonOnly */ void DrawSpline(int n, wxPoint points[]); void DrawSpline(const wxPointList* points); - void DrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, - wxCoord y2, - wxCoord x3, - wxCoord y3); + void DrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, + wxCoord x3, wxCoord y3); //@} /** - Draws a text string at the specified point, using the current text font, - and the current text foreground and background colours. + Draws a text string at the specified point, using the current text + font, and the current text foreground and background colours. + The coordinates refer to the top-left corner of the rectangle bounding - the string. See GetTextExtent() for how - to get the dimensions of a text string, which can be used to position the - text more precisely. - @note under wxGTK the current - @ref getlogicalfunction() "logical function" is used by this function - but it is ignored by wxMSW. Thus, you should avoid using logical functions - with this function in portable programs. + the string. See GetTextExtent() for how to get the dimensions of a text + string, which can be used to position the text more precisely. + + @note Under wxGTK, the current + @ref GetLogicalFunction() "logical function" is used by this + function but it is ignored by wxMSW. Thus, you should avoid using + logical functions with this function in portable programs. */ void DrawText(const wxString& text, wxCoord x, wxCoord y); @@ -428,20 +459,26 @@ public: /** Flood fills the device context starting from the given point, using - the @e current brush colour, and using a style: - wxFLOOD_SURFACE: the flooding occurs until a colour other than the given - colour is encountered. - wxFLOOD_BORDER: the area to be flooded is bounded by the given colour. - Returns @false if the operation failed. - @e Note: The present implementation for non-Windows platforms may fail to find - colour borders if the pixels do not match the colour exactly. However the - function will still return @true. + the current brush colour, and using a style: + + - wxFLOOD_SURFACE: The flooding occurs until a colour other than the + given colour is encountered. + - wxFLOOD_BORDER: The area to be flooded is bounded by the given + colour. + + @returns @false if the operation failed. + + @note The present implementation for non-Windows platforms may fail to + find colour borders if the pixels do not match the colour + exactly. However the function will still return @true. */ bool FloodFill(wxCoord x, wxCoord y, const wxColour& colour, int style = wxFLOOD_SURFACE); /** - Gets the brush used for painting the background (see wxDC::SetBackground). + Gets the brush used for painting the background. + + @see wxDC::SetBackground() */ const wxBrush GetBackground() const; @@ -453,7 +490,9 @@ public: int GetBackgroundMode() const; /** - Gets the current brush (see wxDC::SetBrush). + Gets the current brush. + + @see wxDC::SetBrush() */ const wxBrush GetBrush() const; @@ -469,9 +508,13 @@ public: /** Gets the rectangle surrounding the current clipping region. + + @beginWxPythonOnly + No arguments are required and the four values defining the rectangle + are returned as a tuple. + @endWxPythonOnly */ - void GetClippingBox(wxCoord x, wxCoord y, wxCoord width, - wxCoord height); + void GetClippingBox(wxCoord x, wxCoord y, wxCoord width, wxCoord height); /** Returns the depth (number of bits/pixel) of this DC. @@ -481,44 +524,49 @@ public: int GetDepth() const; /** - Gets the current font. Notice that even although each device context object has - some default font after creation, this method would return a @c wxNullFont - initially and only after calling SetFont() a valid - font is returned. + Gets the current font. Notice that even although each device context + object has some default font after creation, this method would return a + wxNullFont initially and only after calling SetFont() a valid font is + returned. */ const wxFont GetFont() const; /** - Gets the current layout direction of the device context. On platforms where RTL - layout - is supported, the return value will either be @c wxLayout_LeftToRight or - @c wxLayout_RightToLeft. If RTL layout is not supported, the return value will - be @c wxLayout_Default. + Gets the current layout direction of the device context. On platforms + where RTL layout is supported, the return value will either be + @c wxLayout_LeftToRight or @c wxLayout_RightToLeft. If RTL layout is + not supported, the return value will be @c wxLayout_Default. @see SetLayoutDirection() */ wxLayoutDirection GetLayoutDirection() const; /** - Gets the current logical function (see wxDC::SetLogicalFunction). + Gets the current logical function. + + @see SetLogicalFunction() */ int GetLogicalFunction(); /** - Gets the @e mapping mode for the device context (see wxDC::SetMapMode). + Gets the mapping mode for the device context. + + @see SetMapMode() */ int GetMapMode(); - //@{ /** Gets the dimensions of the string using the currently selected font. @a string is the text string to measure, @e heightLine, if non @NULL, is where to store the height of a single line. - The text extent is returned in @a w and @a h pointers (first form) or as - a wxSize object (second form). - If the optional parameter @a font is specified and valid, then it is used - for the text extent calculation. Otherwise the currently selected font is. - Note that this function works both with single-line and multi-line strings. + + The text extent is set in the given @a w and @a h pointers. + + If the optional parameter @a font is specified and valid, then it is + used for the text extent calculation, otherwise the currently selected + font is used. + + @note This function works with both single-line and multi-line strings. @see wxFont, SetFont(), GetPartialTextExtents(), GetTextExtent() */ @@ -526,22 +574,31 @@ public: wxCoord* h, wxCoord* heightLine = NULL, wxFont* font = NULL) const; - const wxSize GetMultiLineTextExtent(const wxString& string) const; - //@} - /** - Returns the resolution of the device in pixels per inch. + Gets the dimensions of the string using the currently selected font. + @a string is the text string to measure, @e heightLine, if non @NULL, + is where to store the height of a single line. + + @returns The text extent as a wxSize object. + + @note This function works with both single-line and multi-line strings. + + @see wxFont, SetFont(), GetPartialTextExtents(), GetTextExtent() */ - wxSize GetPPI() const; + const wxSize GetMultiLineTextExtent(const wxString& string) const; /** - Fills the @a widths array with the widths from the beginning of - @a text to the corresponding character of @e text. The generic - version simply builds a running total of the widths of each character - using GetTextExtent(), however if the - various platforms have a native API function that is faster or more - accurate than the generic implementation then it should be used - instead. + Fills the @a widths array with the widths from the beginning of @a text + to the corresponding character of @a text. The generic version simply + builds a running total of the widths of each character using + GetTextExtent(), however if the various platforms have a native API + function that is faster or more accurate than the generic + implementation then it should be used instead. + + @beginWxPythonOnly + This method only takes the @a text parameter and returns a Python list + of integers. + @endWxPythonOnly @see GetMultiLineTextExtent(), GetTextExtent() */ @@ -549,38 +606,55 @@ public: wxArrayInt& widths) const; /** - Gets the current pen (see wxDC::SetPen). + Gets the current pen. + + @see SetPen() */ const wxPen GetPen() const; /** - Gets in @a colour the colour at the specified location. - Not available for wxPostScriptDC or wxMetafileDC. - Note that setting a pixel can be done using DrawPoint(). + Gets in @a colour the colour at the specified location. Not available + for wxPostScriptDC or wxMetafileDC. + + @note Setting a pixel can be done using DrawPoint(). + + @beginWxPythonOnly + The wxColour value is returned and is not required as a parameter. + @endWxPythonOnly */ bool GetPixel(wxCoord x, wxCoord y, wxColour* colour); - //@{ /** - This gets the horizontal and vertical resolution in device units. It can be - used to scale graphics to fit the page. - For example, if @e maxX and @e maxY - represent the maximum horizontal and vertical 'pixel' values used in your - application, the following code will scale the graphic to fit on the - printer page: - + Returns the resolution of the device in pixels per inch. + */ + wxSize GetPPI() const; - @b GetSize() + //@{ + /** + This gets the horizontal and vertical resolution in device units. It + can be used to scale graphics to fit the page. - Returns a Wx::Size + For example, if @e maxX and @e maxY represent the maximum horizontal + and vertical 'pixel' values used in your application, the following + code will scale the graphic to fit on the printer page: - @b GetSizeWH() + @code + wxCoord w, h; + dc.GetSize(&w, &h); + double scaleX = (double)(maxX / w); + double scaleY = (double)(maxY / h); + dc.SetUserScale(min(scaleX, scaleY),min(scaleX, scaleY)); + @endcode - Returns a 2-element list - @c ( width, height ) + @beginWxPythonOnly + In place of a single overloaded method name, wxPython implements the + following methods: + - GetSize() - Returns a wxSize. + - GetSizeWH() - Returns a 2-tuple (width, height). + @endWxPythonOnly */ void GetSize(wxCoord* width, wxCoord* height) const; - const wxSize GetSize() const; + const wxSize GetSize() const; //@} //@{ @@ -588,32 +662,44 @@ public: Returns the horizontal and vertical resolution in millimetres. */ void GetSizeMM(wxCoord* width, wxCoord* height) const; - const wxSize GetSizeMM() const; + const wxSize GetSizeMM() const; //@} /** - Gets the current text background colour (see wxDC::SetTextBackground). + Gets the current text background colour. + + @see SetTextBackground() */ const wxColour GetTextBackground() const; //@{ /** Gets the dimensions of the string using the currently selected font. - @a string is the text string to measure, @a descent is the - dimension from the baseline of the font to the bottom of the - descender, and @a externalLeading is any extra vertical space added - to the font by the font designer (usually is zero). - The text extent is returned in @a w and @a h pointers (first form) or as - a wxSize object (second form). - If the optional parameter @a font is specified and valid, then it is used - for the text extent calculation. Otherwise the currently selected font is. - Note that this function only works with single-line strings. + @a string is the text string to measure, @a descent is the dimension + from the baseline of the font to the bottom of the descender, and + @a externalLeading is any extra vertical space added to the font by the + font designer (usually is zero). + + The text extent is returned in @a w and @a h pointers or as a wxSize + object depending on which version of this function is used. + + If the optional parameter @a font is specified and valid, then it is + used for the text extent calculation. Otherwise the currently selected + font is. + + @note This function only works with single-line strings. + + @beginWxPythonOnly + The following methods are implemented in wxPython: + - GetTextExtent(string) - Returns a 2-tuple, (width, height). + - GetFullTextExtent(string, font=NULL) - + Returns a 4-tuple, (width, height, descent, externalLeading). + @endWxPythonOnly @see wxFont, SetFont(), GetPartialTextExtents(), GetMultiLineTextExtent() */ - void GetTextExtent(const wxString& string, wxCoord* w, - wxCoord* h, + void GetTextExtent(const wxString& string, wxCoord* w, wxCoord* h, wxCoord* descent = NULL, wxCoord* externalLeading = NULL, const wxFont* font = NULL) const; @@ -621,25 +707,31 @@ public: //@} /** - Gets the current text foreground colour (see wxDC::SetTextForeground). + Gets the current text foreground colour. + + @see SetTextForeground() */ const wxColour GetTextForeground() const; /** - Gets the current user scale factor (set by wxDC::SetUserScale). + Gets the current user scale factor. + + @see SetUserScale() */ void GetUserScale(double x, double y); //@{ /** Fill the area specified by rect with a radial gradient, starting from - @a initialColour at the centre of the circle and fading to @a destColour - on the circle outside. + @a initialColour at the centre of the circle and fading to + @a destColour on the circle outside. + @a circleCenter are the relative coordinates of centre of the circle in - the specified @e rect. If not specified, the cercle is placed at the + the specified @e rect. If not specified, the circle is placed at the centre of rect. - @note Currently this function is very slow, don't use it for - real-time drawing. + + @note Currently this function is very slow, don't use it for real-time + drawing. */ void GradientFillConcentric(const wxRect& rect, const wxColour& initialColour, @@ -651,10 +743,10 @@ public: //@} /** - Fill the area specified by @a rect with a linear gradient, starting from - @a initialColour and eventually fading to @e destColour. The - @a nDirection specifies the direction of the colour change, default is to - use @a initialColour on the left part of the rectangle and + Fill the area specified by @a rect with a linear gradient, starting + from @a initialColour and eventually fading to @e destColour. The + @a nDirection specifies the direction of the colour change, default is + to use @a initialColour on the left part of the rectangle and @a destColour on the right one. */ void GradientFillLinear(const wxRect& rect, @@ -674,9 +766,9 @@ public: virtual wxCoord LogicalToDeviceX(wxCoord x); /** - Converts logical X coordinate to relative device coordinate, using the current - mapping mode but ignoring the x axis orientation. - Use this for converting a width, for example. + Converts logical X coordinate to relative device coordinate, using the + current mapping mode but ignoring the x axis orientation. Use this for + converting a width, for example. */ virtual wxCoord LogicalToDeviceXRel(wxCoord x); @@ -687,9 +779,9 @@ public: virtual wxCoord LogicalToDeviceY(wxCoord y); /** - Converts logical Y coordinate to relative device coordinate, using the current - mapping mode but ignoring the y axis orientation. - Use this for converting a height, for example. + Converts logical Y coordinate to relative device coordinate, using the + current mapping mode but ignoring the y axis orientation. Use this for + converting a height, for example. */ virtual wxCoord LogicalToDeviceYRel(wxCoord y); @@ -714,8 +806,8 @@ public: wxCoord MinY(); /** - Resets the bounding box: after a call to this function, the bounding box - doesn't contain anything. + Resets the bounding box: after a call to this function, the bounding + box doesn't contain anything. @see CalcBoundingBox() */ @@ -723,15 +815,15 @@ public: /** Sets the x and y axis orientation (i.e., the direction from lowest to - highest values on the axis). The default orientation is - x axis from left to right and y axis from top down. + highest values on the axis). The default orientation is x axis from + left to right and y axis from top down. @param xLeftRight - True to set the x axis orientation to the natural - left to right orientation, @false to invert it. + True to set the x axis orientation to the natural left to right + orientation, @false to invert it. @param yBottomUp - True to set the y axis orientation to the natural - bottom up orientation, @false to invert it. + True to set the y axis orientation to the natural bottom up + orientation, @false to invert it. */ void SetAxisOrientation(bool xLeftRight, bool yBottomUp); @@ -741,32 +833,33 @@ public: void SetBackground(const wxBrush& brush); /** - @a mode may be one of wxSOLID and wxTRANSPARENT. This setting determines - whether text will be drawn with a background colour or not. + @a mode may be one of wxSOLID and wxTRANSPARENT. This setting + determines whether text will be drawn with a background colour or not. */ void SetBackgroundMode(int mode); /** Sets the current brush for the DC. - If the argument is wxNullBrush, the current brush is selected out of the device - context (leaving wxDC without any valid brush), allowing the current brush to - be destroyed safely. - See also wxBrush. - See also wxMemoryDC for the interpretation of colours - when drawing into a monochrome bitmap. + + If the argument is wxNullBrush, the current brush is selected out of + the device context (leaving wxDC without any valid brush), allowing the + current brush to be destroyed safely. + + @see wxBrush, wxMemoryDC (for the interpretation of colours when + drawing into a monochrome bitmap) */ void SetBrush(const wxBrush& brush); //@{ /** - Sets the clipping region for this device context to the intersection of the - given region described by the parameters of this method and the previously set - clipping region. You should call - DestroyClippingRegion() if you want to set - the clipping region exactly to the region specified. - The clipping region is an area to which drawing is restricted. Possible uses - for the clipping region are for clipping text or for speeding up window redraws - when only a known area of the screen is damaged. + Sets the clipping region for this device context to the intersection of + the given region described by the parameters of this method and the + previously set clipping region. You should call DestroyClippingRegion() + if you want to set the clipping region exactly to the region specified. + + The clipping region is an area to which drawing is restricted. Possible + uses for the clipping region are for clipping text or for speeding up + window redraws when only a known area of the screen is damaged. @see DestroyClippingRegion(), wxRegion */ @@ -778,96 +871,105 @@ public: //@} /** - Sets the device origin (i.e., the origin in pixels after scaling has been - applied). - This function may be useful in Windows printing + Sets the device origin (i.e., the origin in pixels after scaling has + been applied). This function may be useful in Windows printing operations for placing a graphic on a page. */ void SetDeviceOrigin(wxCoord x, wxCoord y); /** - Sets the current font for the DC. It must be a valid font, in particular you - should not pass @c wxNullFont to this method. - See also wxFont. + Sets the current font for the DC. It must be a valid font, in + particular you should not pass wxNullFont to this method. + + @see wxFont */ void SetFont(const wxFont& font); /** - Sets the current layout direction for the device context. @a dir may be either - @c wxLayout_Default, @c wxLayout_LeftToRight or @c wxLayout_RightToLeft. + Sets the current layout direction for the device context. @a dir may be + either @c wxLayout_Default, @c wxLayout_LeftToRight or + @c wxLayout_RightToLeft. @see GetLayoutDirection() */ void SetLayoutDirection(wxLayoutDirection dir); /** - Sets the current logical function for the device context. This determines how - a source pixel (from a pen or brush colour, or source device context if - using wxDC::Blit) combines with a destination pixel in the - current device context. - The possible values - and their meaning in terms of source and destination pixel values are - as follows: - - The default is wxCOPY, which simply draws with the current colour. - The others combine the current colour and the background using a - logical operation. wxINVERT is commonly used for drawing rubber bands or - moving outlines, since drawing twice reverts to the original colour. + Sets the current logical function for the device context. This + determines how a source pixel (from a pen or brush colour, or source + device context if using Blit()) combines with a destination pixel in + the current device context. + + The possible values and their meaning in terms of source and + destination pixel values are as follows: + + @verbatim + wxAND src AND dst + wxAND_INVERT (NOT src) AND dst + wxAND_REVERSE src AND (NOT dst) + wxCLEAR 0 + wxCOPY src + wxEQUIV (NOT src) XOR dst + wxINVERT NOT dst + wxNAND (NOT src) OR (NOT dst) + wxNOR (NOT src) AND (NOT dst) + wxNO_OP dst + wxOR src OR dst + wxOR_INVERT (NOT src) OR dst + wxOR_REVERSE src OR (NOT dst) + wxSET 1 + wxSRC_INVERT NOT src + wxXOR src XOR dst + @endverbatim + + The default is wxCOPY, which simply draws with the current colour. The + others combine the current colour and the background using a logical + operation. wxINVERT is commonly used for drawing rubber bands or moving + outlines, since drawing twice reverts to the original colour. */ void SetLogicalFunction(int function); /** - The @e mapping mode of the device context defines the unit of - measurement used to convert logical units to device units. Note that - in X, text drawing isn't handled consistently with the mapping mode; a - font is always specified in point size. However, setting the @e user scale (see - wxDC::SetUserScale) scales the text appropriately. In - Windows, scalable TrueType fonts are always used; in X, results depend - on availability of fonts, but usually a reasonable match is found. - The coordinate origin is always at the top left of the screen/printer. - Drawing to a Windows printer device context uses the current mapping mode, - but mapping mode is currently ignored for PostScript output. - The mapping mode can be one of the following: - - wxMM_TWIPS - - Each logical unit is 1/20 of a point, or 1/1440 of - an inch. - - wxMM_POINTS + The mapping mode of the device context defines the unit of measurement + used to convert logical units to device units. Note that in X, text + drawing isn't handled consistently with the mapping mode; a font is + always specified in point size. However, setting the user scale (see + SetUserScale()) scales the text appropriately. In Windows, scalable + TrueType fonts are always used; in X, results depend on availability of + fonts, but usually a reasonable match is found. - Each logical unit is a point, or 1/72 of an inch. - - wxMM_METRIC - - Each logical unit is 1 mm. - - wxMM_LOMETRIC - - Each logical unit is 1/10 of a mm. + The coordinate origin is always at the top left of the screen/printer. - wxMM_TEXT + Drawing to a Windows printer device context uses the current mapping + mode, but mapping mode is currently ignored for PostScript output. - Each logical unit is 1 device pixel. + The mapping mode can be one of the following: + - wxMM_TWIPS: Each logical unit is 1/20 of a point, or 1/1440 of an + inch. + - wxMM_POINTS: Each logical unit is a point, or 1/72 of an inch. + - wxMM_METRIC: Each logical unit is 1 mm. + - wxMM_LOMETRIC: Each logical unit is 1/10 of a mm. + - wxMM_TEXT: Each logical unit is 1 device pixel. */ - void SetMapMode(int int); + void SetMapMode(int mode); /** - If this is a window DC or memory DC, assigns the given palette to the window - or bitmap associated with the DC. If the argument is wxNullPalette, the current - palette is selected out of the device context, and the original palette - restored. - See wxPalette for further details. + If this is a window DC or memory DC, assigns the given palette to the + window or bitmap associated with the DC. If the argument is + wxNullPalette, the current palette is selected out of the device + context, and the original palette restored. + + @see wxPalette */ void SetPalette(const wxPalette& palette); /** - Sets the current pen for the DC. - If the argument is wxNullPen, the current pen is selected out of the device - context (leaving wxDC without any valid pen), allowing the current brush to - be destroyed safely. - See also wxMemoryDC for the interpretation of colours - when drawing into a monochrome bitmap. + Sets the current pen for the DC. If the argument is wxNullPen, the + current pen is selected out of the device context (leaving wxDC without + any valid pen), allowing the current brush to be destroyed safely. + + @see wxMemoryDC for the interpretation of colours when drawing into a + monochrome bitmap. */ void SetPen(const wxPen& pen); @@ -878,8 +980,9 @@ public: /** Sets the current text foreground colour for the DC. - See also wxMemoryDC for the interpretation of colours - when drawing into a monochrome bitmap. + + @see wxMemoryDC for the interpretation of colours when drawing into a + monochrome bitmap. */ void SetTextForeground(const wxColour& colour); @@ -891,7 +994,7 @@ public: /** Starts a document (only relevant when outputting to a printer). - Message is a message to show while printing. + @a message is a message to show while printing. */ bool StartDoc(const wxString& message); @@ -902,8 +1005,8 @@ public: /** Copy from a source DC to this DC, specifying the destination - coordinates, destination size, source DC, source coordinates, - size of source area to copy, logical function, whether to use a bitmap mask, + coordinates, destination size, source DC, source coordinates, size of + source area to copy, logical function, whether to use a bitmap mask, and mask source position. @param xdest @@ -925,61 +1028,60 @@ public: @param srcHeight Height of source area to be copied. @param logicalFunc - Logical function to use: see SetLogicalFunction(). + Logical function to use, see SetLogicalFunction(). @param useMask - If @true, Blit does a transparent blit using the mask that is associated - with the bitmap - selected into the source device context. The Windows implementation does - the following if MaskBlt cannot be used: - - - Creates a temporary bitmap and copies the destination area into it. - Copies the source area into the temporary bitmap using the specified - logical function. - Sets the masked area in the temporary bitmap to BLACK by ANDing the - mask bitmap with the temp bitmap with the foreground colour set to WHITE - and the background colour set to BLACK. - Sets the unmasked area in the destination area to BLACK by ANDing the - mask bitmap with the destination area with the foreground colour set to - BLACK - and the background colour set to WHITE. - ORs the temporary bitmap with the destination area. - Deletes the temporary bitmap. - - - This sequence of operations ensures that the source's transparent area need - not be black, - and logical functions are supported. - Note: on Windows, blitting with masks can be speeded up considerably by - compiling - wxWidgets with the wxUSE_DC_CACHE option enabled. You can also influence - whether MaskBlt - or the explicit mask blitting code above is used, by using wxSystemOptions - and - setting the no-maskblt option to 1. + If @true, Blit does a transparent blit using the mask that is + associated with the bitmap selected into the source device context. + The Windows implementation does the following if MaskBlt cannot be + used: +
    +
  1. Creates a temporary bitmap and copies the destination area into + it.
  2. +
  3. Copies the source area into the temporary bitmap using the + specified logical function.
  4. +
  5. Sets the masked area in the temporary bitmap to BLACK by ANDing + the mask bitmap with the temp bitmap with the foreground colour + set to WHITE and the bg colour set to BLACK.
  6. +
  7. Sets the unmasked area in the destination area to BLACK by + ANDing the mask bitmap with the destination area with the + foreground colour set to BLACK and the background colour set to + WHITE.
  8. +
  9. ORs the temporary bitmap with the destination area.
  10. +
  11. Deletes the temporary bitmap.
  12. +
+ This sequence of operations ensures that the source's transparent + area need not be black, and logical functions are supported. + @n @b Note: on Windows, blitting with masks can be speeded up + considerably by compiling wxWidgets with the wxUSE_DC_CACHE option + enabled. You can also influence whether MaskBlt or the explicit + mask blitting code above is used, by using wxSystemOptions and + setting the @c no-maskblt option to 1. @param xsrcMask - Source x position on the mask. If both xsrcMask and ysrcMask are -1, xsrc - and ysrc - will be assumed for the mask source position. Currently only implemented on - Windows. + Source x position on the mask. If both xsrcMask and ysrcMask are + -1, xsrc and ysrc will be assumed for the mask source position. + Currently only implemented on Windows. @param ysrcMask - Source y position on the mask. If both xsrcMask and ysrcMask are -1, xsrc - and ysrc - will be assumed for the mask source position. Currently only implemented on - Windows. - - @remarks There is partial support for Blit in wxPostScriptDC, under X. - */ - bool StretchBlit(wxCoord xdest, wxCoord ydest, wxCoord dstWidth, - wxCoord dstHeight, - wxDC* source, wxCoord xsrc, - wxCoord ysrc, - wxCoord srcWidth, - wxCoord srcHeight, + Source y position on the mask. If both xsrcMask and ysrcMask are + -1, xsrc and ysrc will be assumed for the mask source position. + Currently only implemented on Windows. + + There is partial support for Blit() in wxPostScriptDC, under X. + + StretchBlit() is only implemented under wxMAC and wxMSW. + + See wxMemoryDC for typical usage. + + @wxsince{2.9.0} + + @see Blit(), wxMemoryDC, wxBitmap, wxMask + */ + bool StretchBlit(wxCoord xdest, wxCoord ydest, + wxCoord dstWidth, wxCoord dstHeight, + wxDC* source, wxCoord xsrc, wxCoord ysrc, + wxCoord srcWidth, wxCoord srcHeight, int logicalFunc = wxCOPY, bool useMask = false, - wxCoord xsrcMask = -1, - wxCoord ysrcMask = -1); + wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); }; @@ -988,39 +1090,38 @@ public: @class wxDCClipper @wxheader{dc.h} - wxDCClipper is a small helper class for setting a clipping region on a - wxDC and unsetting it automatically. An object of wxDCClipper - class is typically created on the stack so that it is automatically destroyed - when the object goes out of scope. A typical usage example: + wxDCClipper is a small helper class for setting a clipping region on a wxDC + and unsetting it automatically. An object of wxDCClipper class is typically + created on the stack so that it is automatically destroyed when the object + goes out of scope. A typical usage example: @code void MyFunction(wxDC& dc) - { - wxDCClipper clip(rect); - ... drawing functions here are affected by clipping rect ... - } - - void OtherFunction() - { - wxDC dc; - MyFunction(dc); - ... drawing functions here are not affected by clipping rect ... - } + { + wxDCClipper clip(dc, rect); + // ... drawing functions here are affected by clipping rect ... + } + + void OtherFunction() + { + wxDC dc; + MyFunction(dc); + // ... drawing functions here are not affected by clipping rect ... + } @endcode @library{wxcore} @category{gdi} - @see wxDC::SetClippingRegion + @see wxDC::SetClippingRegion() */ class wxDCClipper { public: //@{ /** - Sets the clipping region to the specified region @a r or rectangle specified - by either a single @a rect parameter or its position (@a x and @e y) - and size (@a w ad @e h). + Sets the clipping region to the specified region/coordinates. + The clipping region is automatically unset when this object is destroyed. */ wxDCClipper(wxDC& dc, const wxRegion& r); diff --git a/interface/dcbuffer.h b/interface/dcbuffer.h index 5d1dcf5956..569ccdba03 100644 --- a/interface/dcbuffer.h +++ b/interface/dcbuffer.h @@ -11,29 +11,29 @@ @wxheader{dcbuffer.h} This class provides a simple way to avoid flicker: when drawing on it, - everything is in fact first drawn on an in-memory buffer (a - wxBitmap) and then copied to the screen, using the - associated wxDC, only once, when this object is destroyed. wxBufferedDC itself - is typically associated with wxClientDC, if you want to - use it in your @c EVT_PAINT handler, you should look at - wxBufferedPaintDC instead. - - When used like this, a valid @e dc must be specified in the constructor + everything is in fact first drawn on an in-memory buffer (a wxBitmap) and + then copied to the screen, using the associated wxDC, only once, when this + object is destroyed. wxBufferedDC itself is typically associated with + wxClientDC, if you want to use it in your @c EVT_PAINT handler, you should + look at wxBufferedPaintDC instead. + + When used like this, a valid @e DC must be specified in the constructor while the @e buffer bitmap doesn't have to be explicitly provided, by - default this class will allocate the bitmap of required size itself. However - using a dedicated bitmap can speed up the redrawing process by eliminating the - repeated creation and destruction of a possibly big bitmap. Otherwise, - wxBufferedDC can be used in the same way as any other device context. + default this class will allocate the bitmap of required size itself. + However using a dedicated bitmap can speed up the redrawing process by + eliminating the repeated creation and destruction of a possibly big bitmap. + Otherwise, wxBufferedDC can be used in the same way as any other device + context. There is another possible use for wxBufferedDC is to use it to maintain a - backing store for the window contents. In this case, the associated @e dc + backing store for the window contents. In this case, the associated @e DC may be @NULL but a valid backing store bitmap should be specified. Finally, please note that GTK+ 2.0 as well as OS X provide double buffering - themselves natively. You can either use wxWindow::IsDoubleBuffered - to determine whether you need to use buffering or not, or use - wxAutoBufferedPaintDC to avoid needless double - buffering on the systems which already do it automatically. + themselves natively. You can either use wxWindow::IsDoubleBuffered() to + determine whether you need to use buffering or not, or use + wxAutoBufferedPaintDC to avoid needless double buffering on the systems + which already do it automatically. @library{wxcore} @category{dc} @@ -43,36 +43,35 @@ class wxBufferedDC : public wxMemoryDC { public: + /** + Default constructor. You must call one of the Init() methods later in + order to use the device context. + */ + wxBufferedDC(); + //@{ /** - If you use the first, default, constructor, you must call one of the - Init() methods later in order to use the object. - The other constructors initialize the object immediately and @c Init() - must not be called after using them. + Creates a buffer for the provided @dc. Init() must not be called when + using this constructor. @param dc - The underlying DC: everything drawn to this object will be - flushed to this DC when this object is destroyed. You may pass @NULL - in order to just initialize the buffer, and not flush it. + The underlying DC: everything drawn to this object will be flushed + to this DC when this object is destroyed. You may pass @NULL in + order to just initialize the buffer, and not flush it. @param area The size of the bitmap to be used for buffering (this bitmap is created internally when it is not given explicitly). @param buffer - Explicitly provided bitmap to be used for buffering: this is - the most efficient solution as the bitmap doesn't have to be recreated each - time but it also requires more memory as the bitmap is never freed. The - bitmap - should have appropriate size, anything drawn outside of its bounds is - clipped. + Explicitly provided bitmap to be used for buffering: this is the + most efficient solution as the bitmap doesn't have to be recreated + each time but it also requires more memory as the bitmap is never + freed. The bitmap should have appropriate size, anything drawn + outside of its bounds is clipped. @param style - wxBUFFER_CLIENT_AREA to indicate that just the client area of - the window is buffered, or wxBUFFER_VIRTUAL_AREA to indicate that the - buffer bitmap - covers the virtual area (in which case PrepareDC is automatically called - for the actual window - device context). + wxBUFFER_CLIENT_AREA to indicate that just the client area of the + window is buffered, or wxBUFFER_VIRTUAL_AREA to indicate that the + buffer bitmap covers the virtual area. */ - wxBufferedDC(); wxBufferedDC(wxDC* dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA); wxBufferedDC(wxDC* dc, wxBitmap& buffer, @@ -80,15 +79,15 @@ public: //@} /** - Copies everything drawn on the DC so far to the underlying DC associated with - this object, if any. + Copies everything drawn on the DC so far to the underlying DC + associated with this object, if any. */ - + ~wxBufferedDC(); //@{ /** - These functions initialize the object created using the default constructor. - Please see @ref ctor() "constructors documentation" for details. + Initializes the object created using the default constructor. Please + see the constructors for parameter details. */ void Init(wxDC* dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA); @@ -103,24 +102,24 @@ public: @class wxAutoBufferedPaintDC @wxheader{dcbuffer.h} - This wxDC derivative can be used inside of an @c OnPaint() event handler to - achieve - double-buffered drawing. Just create an object of this class instead of - wxPaintDC - and make sure wxWindow::SetBackgroundStyle is called - with wxBG_STYLE_CUSTOM somewhere in the class initialization code, and that's - all you have - to do to (mostly) avoid flicker. + This wxDC derivative can be used inside of an @c EVT_PAINT() event handler + to achieve double-buffered drawing. Just use this class instead of + wxPaintDC and make sure wxWindow::SetBackgroundStyle() is called with + wxBG_STYLE_CUSTOM somewhere in the class initialization code, and that's + all you have to do to (mostly) avoid flicker. + + The difference between wxBufferedPaintDC and this class is that this class + won't double-buffer on platforms which have native double-buffering + already, avoiding any unneccessary buffering to avoid flicker. - The difference between wxBufferedPaintDC and this class, - is the lightweigthness - on platforms which have native double-buffering, - wxAutoBufferedPaintDC is simply - a typedef of wxPaintDC. Otherwise, it is a typedef of wxBufferedPaintDC. + wxAutoBufferedPaintDC is simply a typedef of wxPaintDC on platforms that + have native double-buffering, otherwise, it is a typedef of + wxBufferedPaintDC. @library{wxbase} @category{dc} - @see wxDC, wxBufferedPaintDC + @see wxDC, wxBufferedPaintDC, wxPaintDC */ class wxAutoBufferedPaintDC : public wxBufferedPaintDC { @@ -137,38 +136,34 @@ public: @class wxBufferedPaintDC @wxheader{dcbuffer.h} - This is a subclass of wxBufferedDC which can be used - inside of an @c OnPaint() event handler. Just create an object of this class - instead - of wxPaintDC and make sure wxWindow::SetBackgroundStyle - is called with wxBG_STYLE_CUSTOM somewhere in the class initialization code, - and that's all - you have to do to (mostly) avoid flicker. The only thing to watch out for is - that if you are - using this class together with wxScrolledWindow, you probably - do @b not want to call wxScrolledWindow::PrepareDC on it as it - already does this internally for the real underlying wxPaintDC. + This is a subclass of wxBufferedDC which can be used inside of an + @c EVT_PAINT() event handler to achieve double-buffered drawing. Just use + this class instead of wxPaintDC and make sure + wxWindow::SetBackgroundStyle() is called with wxBG_STYLE_CUSTOM somewhere + in the class initialization code, and that's all you have to do to (mostly) + avoid flicker. The only thing to watch out for is that if you are using + this class together with wxScrolled, you probably do @b not want to call + wxScrolled::PrepareDC() on it as it already does this internally for the + real underlying wxPaintDC. @library{wxcore} @category{dc} - @see wxDC, wxBufferedDC, wxAutoBufferedPaintDC + @see wxDC, wxBufferedDC, wxAutoBufferedPaintDC, wxPaintDC */ class wxBufferedPaintDC : public wxBufferedDC { public: //@{ /** - As with @ref wxBufferedDC::ctor wxBufferedDC, 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 used). - Pass wxBUFFER_CLIENT_AREA for the @a style parameter to indicate that just the - client area of - the window is buffered, or wxBUFFER_VIRTUAL_AREA to indicate that the buffer - bitmap - covers the virtual area (in which case PrepareDC is automatically called for - the actual window - device context). + As with wxBufferedDC, 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 used). + + Pass wxBUFFER_CLIENT_AREA for the @a style parameter to indicate that + just the client area of the window is buffered, or + wxBUFFER_VIRTUAL_AREA to indicate that the buffer bitmap covers the + virtual area. */ wxBufferedPaintDC(wxWindow* window, wxBitmap& buffer, int style = wxBUFFER_CLIENT_AREA); @@ -177,8 +172,9 @@ public: //@} /** - Copies everything drawn on the DC so far to the window associated with this - object, using a wxPaintDC. + Copies everything drawn on the DC so far to the window associated with + this object, using a wxPaintDC. */ + ~wxBufferedPaintDC(); }; diff --git a/interface/html/htmlwin.h b/interface/html/htmlwin.h index fd3e514d70..4a4703f681 100644 --- a/interface/html/htmlwin.h +++ b/interface/html/htmlwin.h @@ -43,7 +43,7 @@ class wxHtmlWindow : public wxScrolledWindow public: //@{ /** - Constructor. The parameters are the same as for the wxScrolledWindow + Constructor. The parameters are the same as wxScrolled::wxScrolled() constructor. @param style @@ -289,7 +289,7 @@ public: /** Selects the line of text that @a pos points at. Note that @e pos is relative to the top of displayed page, not to window's origin, use - wxScrolledWindow::CalcUnscrolledPosition + wxScrolled::CalcUnscrolledPosition() to convert physical coordinate. @see SelectAll(), SelectWord() @@ -299,7 +299,7 @@ public: /** Selects the word at position @e pos. Note that @e pos is relative to the top of displayed page, not to window's origin, use - wxScrolledWindow::CalcUnscrolledPosition + wxScrolled::CalcUnscrolledPosition() to convert physical coordinate. @see SelectAll(), SelectLine() diff --git a/interface/scrolbar.h b/interface/scrolbar.h index be1aa3105c..6f097a8a98 100644 --- a/interface/scrolbar.h +++ b/interface/scrolbar.h @@ -24,10 +24,9 @@ @library{wxcore} @category{ctrl} - @appearance{scrollbar.png} + - @see @ref overview_scrollingoverview "Scrolling overview", @ref - overview_eventhandlingoverview, wxScrolledWindow + @see @ref overview_scrolling, @ref overview_eventhandling, wxScrolled */ class wxScrollBar : public wxControl { diff --git a/interface/scrolwin.h b/interface/scrolwin.h index a2df90181b..d8b65f75a6 100644 --- a/interface/scrolwin.h +++ b/interface/scrolwin.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: scrolwin.h -// Purpose: interface of wxScrolledWindow +// Purpose: interface of wxScrolled template // Author: wxWidgets team // RCS-ID: $Id$ // Licence: wxWindows license @@ -9,7 +9,7 @@ /** @wxheader{scrolwin.h} - The wxScrolled class manages scrolling for its client area, transforming + The wxScrolled class manages scrolling for its client area, transforming the coordinates according to the scrollbar positions, and setting the scroll positions, thumb sizes and ranges according to the area in view. @@ -26,8 +26,8 @@ implementating scrollable controls such as tree or list controls. Starting from version 2.4 of wxWidgets, there are several ways to use a - wxScrolled. In particular, there are now three ways to set the - size of the scrolling area: + wxScrolled. In particular, there are now three ways to set the size of the + scrolling area: One way is to set the scrollbars directly using a call to SetScrollbars(). This is the way it used to be in any previous version of wxWidgets and it @@ -42,7 +42,7 @@ The most automatic and newest way is to simply let sizers determine the scrolling area. This is now the default when you set an interior sizer into - a wxScrolled with wxWindow::SetSizer(). The scrolling area will be + a wxScrolled with wxWindow::SetSizer(). The scrolling area will be set to the size requested by the sizer and the scrollbars will be assigned for each orientation according to the need for them and the scrolling increment set by SetScrollRate(). As above, scrolling is only enabled in @@ -59,18 +59,18 @@ wxWindow::SetVirtualSizeHints() with wxWindow::SetMinVirtualSize() or similar and remove it entirely in future. - As with all windows, an application can draw onto a wxScrolled using - a @ref overview_dcoverview "device context". + As with all windows, an application can draw onto a wxScrolled using a + @ref overview_dc "device context". You have the option of handling the OnPaint handler or overriding the - wxScrolled::OnDraw() function, which is passed a pre-scrolled device - context (prepared by wxScrolled::DoPrepareDC()). + wxScrolled::OnDraw() function, which is passed a pre-scrolled device + context (prepared by wxScrolled::DoPrepareDC()). If you don't wish to calculate your own scrolling, you must call DoPrepareDC() when not drawing from within OnDraw(), to set the device origin for the device context according to the current scroll position. - A wxScrolled will normally scroll itself and therefore its child windows + A wxScrolled will normally scroll itself and therefore its child windows as well. It might however be desired to scroll a different window than itself: e.g. when designing a spreadsheet, you will normally only have to scroll the (usually white) cell area, whereas the (usually grey) label area @@ -92,15 +92,15 @@ @endStyleTable @remarks - Use wxScrolled for applications where the user scrolls by a fixed - amount, and where a 'page' can be interpreted to be the current visible - portion of the window. For more sophisticated applications, use the - wxScrolled implementation as a guide to build your own scroll - behaviour or use wxVScrolledWindow or its variants. + Use wxScrolled for applications where the user scrolls by a fixed amount, + and where a 'page' can be interpreted to be the current visible portion of + the window. For more sophisticated applications, use the wxScrolled + implementation as a guide to build your own scroll behaviour or use + wxVScrolledWindow or its variants. - @since wxScrolled template exists since version 2.9.0. In older - versions, only ::wxScrolledWindow (equivalent of wxScrolled) - was available. + @since wxScrolled template exists since version 2.9.0. In older versions, + only ::wxScrolledWindow (equivalent of wxScrolled) was + available. @library{wxcore} @category{miscwnd} @@ -129,7 +129,7 @@ public: Window size. If a size of @c wxDefaultSize is specified then the window is sized appropriately. @param style - Window style. See wxScrolled. + Window style. See wxScrolled. @param name Window name. @@ -168,7 +168,7 @@ public: /** Creates the window for two-step construction. Derived classes - should call or replace this function. See wxScrolled constructor + should call or replace this function. See wxScrolled::wxScrolled() for details. */ bool Create(wxWindow* parent, wxWindowID id = -1, @@ -347,7 +347,7 @@ public: window->SetScrollbars(20, 20, 50, 50); @endcode - wxScrolled manages the page size itself, using the current client + wxScrolled manages the page size itself, using the current client window size as the page size. Note that for more sophisticated scrolling applications, for example @@ -392,20 +392,20 @@ public: /** Scrolled window derived from wxPanel. - See wxScrolled for detailed description. + See wxScrolled for detailed description. @note Note that because this class derives from wxPanel, it shares its behavior with regard to TAB traversal and focus handling (in particular, it forwards focus to its children). If you don't want this behaviour, use ::wxScrolledCanvas instead. - @note wxScrolledWindow is an alias for wxScrolled since version + @note ::wxScrolledWindow is an alias for wxScrolled since version 2.9.0. In older versions, it was a standalone class. @library{wxcore} @category{miscwnd} - @see wxScrolled, wxScrolledCanvas + @see wxScrolled, ::wxScrolledCanvas */ typedef wxScrolled wxScrolledWindow; diff --git a/interface/sizer.h b/interface/sizer.h index 8d130f852e..4b0bc74f90 100644 --- a/interface/sizer.h +++ b/interface/sizer.h @@ -1016,7 +1016,7 @@ public: in windows which manage it. - @see wxScrolledWindow::SetScrollbars, SetVirtualSizeHints() + @see wxScrolled::SetScrollbars(), SetVirtualSizeHints() */ void FitInside(wxWindow* window); @@ -1347,7 +1347,7 @@ public: minimal size. For windows with managed scrollbars this will set them appropriately. - @see wxScrolledWindow::SetScrollbars + @see wxScrolled::SetScrollbars() */ void SetVirtualSizeHints(wxWindow* window); diff --git a/interface/toolbar.h b/interface/toolbar.h index ca54757a53..821c32025e 100644 --- a/interface/toolbar.h +++ b/interface/toolbar.h @@ -55,7 +55,7 @@ @library{wxbase} @category{miscwnd} - @see @ref overview_wxtoolbaroverview "Toolbar overview", wxScrolledWindow + @see @ref overview_toolbar */ class wxToolBar : public wxControl { diff --git a/interface/vscroll.h b/interface/vscroll.h index c96063016c..33f866bd08 100644 --- a/interface/vscroll.h +++ b/interface/vscroll.h @@ -589,11 +589,10 @@ public: are shown on the screen need to be measured; or even "vertical", because this class only supports scrolling vertically. - In any case, this is a generalization of the - wxScrolledWindow class which can be only used when - all rows have the same heights. It lacks some other wxScrolledWindow features - however, notably it can't scroll only a rectangle of the window and not its - entire client area. + In any case, this is a generalization of wxScrolled which can be only used + when all rows have the same heights. It lacks some other wxScrolled + features however, notably it can't scroll only a rectangle of the window + and not its entire client area. To use this class, you need to derive from it and implement the wxVarVScrollHelper::OnGetRowHeight pure virtual @@ -702,11 +701,10 @@ public: the widths of all columns in advance -- only those which are shown on the screen need to be measured. - In any case, this is a generalization of the - wxScrolledWindow class which can be only used when - all columns have the same widths. It lacks some other wxScrolledWindow features - however, notably it can't scroll only a rectangle of the window and not its - entire client area. + In any case, this is a generalization of wxScrolled which can be only used + when all columns have the same widths. It lacks some other wxScrolled + features however, notably it can't scroll only a rectangle of the window + and not its entire client area. To use this class, you need to derive from it and implement the wxVarHScrollHelper::OnGetColumnWidth pure virtual @@ -782,10 +780,10 @@ public: scroll both axis simultaneously with both variable row heights and variable column widths. - This is a generalization of the wxScrolledWindow - class which can be only used when all rows and columns are the same size. It - lacks some other wxScrolledWindow features however, notably it can't scroll - only a rectangle of the window and not its entire client area. + In any case, this is a generalization of wxScrolled which can be only used + when all rows and columns are the same size. It lacks some other wxScrolled + features however, notably it can't scroll only a rectangle of the window + and not its entire client area. To use this class, you must derive from it and implement both the wxVarVScrollHelper::OnGetRowHeight and diff --git a/interface/window.h b/interface/window.h index a954e1c579..0ecce78b88 100644 --- a/interface/window.h +++ b/interface/window.h @@ -1740,8 +1740,8 @@ public: on top/bottom and nothing was done. @remarks This function is currently only implemented under MSW and - wxTextCtrl under wxGTK (it also works for - wxScrolledWindow derived classes under all platforms). + wxTextCtrl under wxGTK (it also works for wxScrolled classes + under all platforms). @see ScrollPages() */ @@ -1772,8 +1772,8 @@ public: scrolled (this is always the case under wxGTK which doesn't support this parameter) - @remarks Note that you can often use wxScrolledWindow instead of using - this function directly. + @remarks Note that you can often use wxScrolled instead of using this + function directly. */ virtual void ScrollWindow(int dx, int dy, const wxRect* rect = NULL); @@ -2194,8 +2194,8 @@ public: window: it is up to the application to take note of scrollbar attributes and redraw contents accordingly. - @see SetScrollbar(), GetScrollPos(), GetScrollThumb(), - wxScrollBar, wxScrolledWindow + @see SetScrollbar(), GetScrollPos(), GetScrollThumb(), wxScrollBar, + wxScrolled */ virtual void SetScrollPos(int orientation, int pos, bool refresh = true); @@ -2219,8 +2219,7 @@ public: font. The window is sized so that you can only see 16 lines at a time. - @see @ref overview_scrollingoverview "Scrolling overview", wxScrollBar, - wxScrolledWindow, wxScrollWinEvent + @see @ref overview_scrolling, wxScrollBar, wxScrolled, wxScrollWinEvent */ virtual void SetScrollbar(int orientation, int position, int thumbSize, -- 2.45.2