X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e54c96f187f46c06bd36be8cd52b35c19884aa2b..3dac8f8a995ca4faea65932f2657acca0c33ce37:/interface/gdicmn.h?ds=sidebyside diff --git a/interface/gdicmn.h b/interface/gdicmn.h index 8256fa8a27..f415ecf9d8 100644 --- a/interface/gdicmn.h +++ b/interface/gdicmn.h @@ -6,13 +6,100 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// + +/** + Bitmap type flags. See wxBitmap and wxImage classes. +*/ +enum wxBitmapType +{ + wxBITMAP_TYPE_INVALID, + wxBITMAP_TYPE_BMP, + wxBITMAP_TYPE_BMP_RESOURCE, + wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE, + wxBITMAP_TYPE_ICO, + wxBITMAP_TYPE_ICO_RESOURCE, + wxBITMAP_TYPE_CUR, + wxBITMAP_TYPE_CUR_RESOURCE, + wxBITMAP_TYPE_XBM, + wxBITMAP_TYPE_XBM_DATA, + wxBITMAP_TYPE_XPM, + wxBITMAP_TYPE_XPM_DATA, + wxBITMAP_TYPE_TIF, + wxBITMAP_TYPE_TIF_RESOURCE, + wxBITMAP_TYPE_GIF, + wxBITMAP_TYPE_GIF_RESOURCE, + wxBITMAP_TYPE_PNG, + wxBITMAP_TYPE_PNG_RESOURCE, + wxBITMAP_TYPE_JPEG, + wxBITMAP_TYPE_JPEG_RESOURCE, + wxBITMAP_TYPE_PNM, + wxBITMAP_TYPE_PNM_RESOURCE, + wxBITMAP_TYPE_PCX, + wxBITMAP_TYPE_PCX_RESOURCE, + wxBITMAP_TYPE_PICT, + wxBITMAP_TYPE_PICT_RESOURCE, + wxBITMAP_TYPE_ICON, + wxBITMAP_TYPE_ICON_RESOURCE, + wxBITMAP_TYPE_ANI, + wxBITMAP_TYPE_IFF, + wxBITMAP_TYPE_TGA, + wxBITMAP_TYPE_MACCURSOR, + wxBITMAP_TYPE_MACCURSOR_RESOURCE, + wxBITMAP_TYPE_ANY = 50 +}; + +/** + Standard cursors. See wxCursor. +*/ +enum wxStockCursor +{ + wxCURSOR_NONE, + wxCURSOR_ARROW, ///< A standard arrow cursor. + wxCURSOR_RIGHT_ARROW, ///< A standard arrow cursor pointing to the right. + wxCURSOR_BULLSEYE, ///< Bullseye cursor. + wxCURSOR_CHAR, ///< Rectangular character cursor. + wxCURSOR_CROSS, ///< A cross cursor. + wxCURSOR_HAND, ///< A hand cursor. + wxCURSOR_IBEAM, ///< An I-beam cursor (vertical line). + wxCURSOR_LEFT_BUTTON, ///< Represents a mouse with the left button depressed. + wxCURSOR_MAGNIFIER, ///< A magnifier icon. + wxCURSOR_MIDDLE_BUTTON, ///< Represents a mouse with the middle button depressed. + wxCURSOR_NO_ENTRY, ///< A no-entry sign cursor. + wxCURSOR_PAINT_BRUSH, ///< A paintbrush cursor. + wxCURSOR_PENCIL, ///< A pencil cursor. + wxCURSOR_POINT_LEFT, ///< A cursor that points left. + wxCURSOR_POINT_RIGHT, ///< A cursor that points right. + wxCURSOR_QUESTION_ARROW, ///< An arrow and question mark. + wxCURSOR_RIGHT_BUTTON, ///< Represents a mouse with the right button depressed. + wxCURSOR_SIZENESW, ///< A sizing cursor pointing NE-SW. + wxCURSOR_SIZENS, ///< A sizing cursor pointing N-S. + wxCURSOR_SIZENWSE, ///< A sizing cursor pointing NW-SE. + wxCURSOR_SIZEWE, ///< A sizing cursor pointing W-E. + wxCURSOR_SIZING, ///< A general sizing cursor. + wxCURSOR_SPRAYCAN, ///< A spraycan cursor. + wxCURSOR_WAIT, ///< A wait cursor. + wxCURSOR_WATCH, ///< A watch cursor. + wxCURSOR_BLANK, ///< Transparent cursor. + wxCURSOR_DEFAULT, ///< Standard X11 cursor (only in wxGTK). + wxCURSOR_COPY_ARROW , ///< MacOS Theme Plus arrow (only in wxMac). + wxCURSOR_CROSS_REVERSE, ///< Only available on wxX11. + wxCURSOR_DOUBLE_ARROW, ///< Only available on wxX11. + wxCURSOR_BASED_ARROW_UP, ///< Only available on wxX11. + wxCURSOR_BASED_ARROW_DOWN, ///< Only available on wxX11. + wxCURSOR_ARROWWAIT, ///< A wait cursor with a standard arrow. + wxCURSOR_MAX +}; + + + /** @class wxRealPoint @wxheader{gdicmn.h} - A @b wxRealPoint is a useful data structure for graphics operations. - It contains floating point @e x and @e y members. - See also wxPoint for an integer version. + A wxRealPoint is a useful data structure for graphics operations. + + It contains floating point @e x and @e y members. See wxPoint for an + integer version. @library{wxcore} @category{data} @@ -22,16 +109,22 @@ class wxRealPoint { public: - //@{ + wxRealPoint(); + /** - Create a point. - double x - double y - Members of the @b wxRealPoint object. + Initializes the point with the given coordinates. */ - wxRealPoint(); wxRealPoint(double x, double y); - //@} + + /** + X coordinate of this point. + */ + double x; + + /** + Y coordinate of this point. + */ + double y; }; @@ -50,51 +143,65 @@ public: class wxRect { public: - //@{ /** - Creates a wxRect object from size values at the origin. + Default constructor. */ wxRect(); + /** + Creates a wxRect object from @a x, @a y, @a width and @a height values. + */ wxRect(int x, int y, int width, int height); + /** + Creates a wxRect object from top-left and bottom-right points. + */ wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); + /** + Creates a wxRect object from position and @a size values. + */ wxRect(const wxPoint& pos, const wxSize& size); + /** + Creates a wxRect object from @a size values at the origin. + */ wxRect(const wxSize& size); - //@} //@{ /** - Returns the rectangle having the same size as this one but centered relatively - to the given rectangle @e r. By default, rectangle is centred in both - directions but if @a dir includes only @c wxVERTICAL or only - @c wxHORIZONTAL flag, then it is only centered in this direction while + Returns the rectangle having the same size as this one but centered + relatively to the given rectangle @a r. By default, rectangle is + centred in both directions but if @a dir includes only @c wxVERTICAL or + only @c wxHORIZONTAL, then it is only centered in this direction while the other component of its position remains unchanged. */ wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const; - const wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const; + wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const; //@} - //@{ /** - Returns @true if the given rectangle is completely inside this rectangle - (or touches its boundary) and @false otherwise. + Returns @true if the given point is inside the rectangle (or on its + boundary) and @false otherwise. */ bool Contains(int x, int y) const; - const bool Contains(const wxPoint& pt) const; - const bool Contains(const wxRect& rect) const; - //@} + /** + Returns @true if the given point is inside the rectangle (or on its + boundary) and @false otherwise. + */ + bool Contains(const wxPoint& pt) const; + /** + Returns @true if the given rectangle is completely inside this + rectangle (or touches its boundary) and @false otherwise. + */ + bool Contains(const wxRect& rect) const; //@{ /** Decrease the rectangle size. - This method is the opposite from Inflate(): - Deflate(a, b) is equivalent to Inflate(-a, -b). - Please refer to Inflate() for full description. - - @see Inflate() - */ - void Deflate(wxCoord dx, wxCoord dy) const; - void Deflate(const wxSize& diff) const; - void Deflate(wxCoord diff) const; + + This method is the opposite from Inflate(): Deflate(a, b) is equivalent + to Inflate(-a, -b). Please refer to Inflate() for full description. + */ + void Deflate(wxCoord dx, wxCoord dy); + void Deflate(const wxSize& diff); + void Deflate(wxCoord diff); wxRect Deflate(wxCoord dx, wxCoord dy) const; //@} @@ -119,7 +226,7 @@ public: int GetHeight() const; /** - Gets the left point of the rectangle (the same as wxRect::GetX). + Gets the left point of the rectangle (the same as GetX()). */ int GetLeft() const; @@ -135,13 +242,13 @@ public: /** Gets the size. - + @see SetSize() */ wxSize GetSize() const; /** - Gets the top point of the rectangle (the same as wxRect::GetY). + Gets the top point of the rectangle (the same as GetY()). */ int GetTop() const; @@ -174,47 +281,45 @@ public: //@{ /** Increases the size of the rectangle. - The second form uses the same @a diff for both @a dx and @e dy. - The first two versions modify the rectangle in place, the last one returns a - new rectangle leaving this one unchanged. - The left border is moved farther left and the right border is moved farther - right by @e dx. The upper border is moved farther up and the bottom border - is moved farther down by @e dy. (Note the the width and height of the - rectangle thus change by 2*@a dx and 2*@e dy, respectively.) If one or - both of @a dx and @a dy are negative, the opposite happens: the rectangle - size decreases in the respective direction. - Inflating and deflating behaves "naturally''. Defined more precisely, that - means: - "Real'' inflates (that is, @a dx and/or @a dy = 0) are not - constrained. Thus inflating a rectangle can cause its upper left corner - to move into the negative numbers. (the versions prior to 2.5.4 forced - the top left coordinate to not fall below (0, 0), which implied a - forced move of the rectangle.) - Deflates are clamped to not reduce the width or height of the - rectangle below zero. In such cases, the top-left corner is nonetheless - handled properly. For example, a rectangle at (10, 10) with size (20, - 40) that is inflated by (-15, -15) will become located at (20, 25) at - size (0, 10). Finally, observe that the width and height are treated - independently. In the above example, the width is reduced by 20, - whereas the height is reduced by the full 30 (rather than also stopping - at 20, when the width reached zero). - + + The left border is moved farther left and the right border is moved + farther right by @a dx. The upper border is moved farther up and the + bottom border is moved farther down by @a dy. (Note the the width and + height of the rectangle thus change by 2*dx and 2*dy, respectively.) If + one or both of @a dx and @a dy are negative, the opposite happens: the + rectangle size decreases in the respective direction. + + Inflating and deflating behaves "naturally". Defined more precisely, + that means: + -# "Real" inflates (that is, @a dx and/or @a dy = 0) are not + constrained. Thus inflating a rectangle can cause its upper left + corner to move into the negative numbers. (2.5.4 and older forced + the top left coordinate to not fall below (0, 0), which implied a + forced move of the rectangle.) + -# Deflates are clamped to not reduce the width or height of the + rectangle below zero. In such cases, the top-left corner is + nonetheless handled properly. For example, a rectangle at (10, 10) + with size (20, 40) that is inflated by (-15, -15) will become + located at (20, 25) at size (0, 10). Finally, observe that the width + and height are treated independently. In the above example, the + width is reduced by 20, whereas the height is reduced by the full 30 + (rather than also stopping at 20, when the width reached zero). + @see Deflate() */ - void Inflate(wxCoord dx, wxCoord dy) const; - void Inflate(const wxSize& diff) const; - void Inflate(wxCoord diff) const; + void Inflate(wxCoord dx, wxCoord dy); + void Inflate(const wxSize& diff); + void Inflate(wxCoord diff); wxRect Inflate(wxCoord dx, wxCoord dy) const; //@} //@{ /** - Modifies the rectangle to contain the overlapping box of this rectangle and the - one passed in as parameter. The const version returns the new rectangle, the - other one modifies this rectangle in place. + Modifies the rectangle to contain the overlapping box of this rectangle + and the one passed in as parameter. */ - wxRect Intersect(const wxRect& rect); - const wxRect& Intersect(const wxRect& rect); + wxRect Intersect(const wxRect& rect) const; + wxRect& Intersect(const wxRect& rect); //@} /** @@ -224,8 +329,8 @@ public: bool Intersects(const wxRect& rect) const; /** - Returns @true if this rectangle has a width or height less than or equal to - 0 and @false otherwise. + Returns @true if this rectangle has a width or height less than or + equal to 0 and @false otherwise. */ bool IsEmpty() const; @@ -246,7 +351,7 @@ public: /** Sets the size. - + @see GetSize() */ void SetSize(const wxSize& s); @@ -268,30 +373,32 @@ public: //@{ /** - Modifies the rectangle to contain the bounding box of this rectangle and the - one passed in as parameter. The const version returns the new rectangle, the - other one modifies this rectangle in place. + Modifies the rectangle to contain the bounding box of this rectangle + and the one passed in as parameter. */ - wxRect Union(const wxRect& rect); - const wxRect& Union(const wxRect& rect); + wxRect Union(const wxRect& rect) const; + wxRect& Union(const wxRect& rect); //@} /** - int height - Height member. + Inequality operator. */ + bool operator !=(const wxRect& r1, const wxRect& r2); + //@{ + /** + Like Union(), but doesn't treat empty rectangles specially. + */ + wxRect operator +(const wxRect& r1, const wxRect& r2); + wxRect& operator +=(const wxRect& r); + //@} //@{ /** Returns the intersection of two rectangles (which may be empty). */ - bool operator !=(const wxRect& r1, const wxRect& r2); - wxRect operator +(const wxRect& r1, const wxRect& r2); - wxRect operator +=(const wxRect& r); - See also wxRect operator *(const wxRect& r1, - const wxRect& r2); - wxRect operator *=(const wxRect& r); + wxRect operator *(const wxRect& r1, const wxRect& r2); + wxRect& operator *=(const wxRect& r); //@} /** @@ -305,57 +412,24 @@ public: bool operator ==(const wxRect& r1, const wxRect& r2); /** - int width - Width member. + Height member. */ - + int height; /** - int x - x coordinate of the top-level corner of the rectangle. + Width member. */ - + int width; /** - int y - y coordinate of the top-level corner of the rectangle. - */ -}; - - - -/** - @class wxBrushList - @wxheader{gdicmn.h} - - A brush list is a list containing all brushes which have been created. - - @library{wxcore} - @category{gdi} - - @see wxBrush -*/ -class wxBrushList : public wxList -{ -public: - /** - Constructor. The application should not construct its own brush list: - use the object pointer @b wxTheBrushList. + x coordinate of the top-level corner of the rectangle. */ - wxBrushList(); + int x; /** - Finds a brush with the specified attributes and returns it, else creates a new - brush, adds it - to the brush list, and returns it. - - @param colour - Colour object. - @param style - Brush style. See wxBrush::SetStyle for a list of styles. + y coordinate of the top-level corner of the rectangle. */ - wxBrush* FindOrCreateBrush(const wxColour& colour, - int style = wxSOLID); + int y; }; @@ -364,14 +438,17 @@ public: @class wxPoint @wxheader{gdicmn.h} - A @b wxPoint is a useful data structure for graphics operations. - It simply contains integer @e x and @e y members. + A wxPoint is a useful data structure for graphics operations. - See also wxRealPoint for a floating point version. + It contains integer @e x and @e y members. See wxRealPoint for a floating + point version. @library{wxcore} @category{data} + @stdobjects + ::wxDefaultPosition + @see wxRealPoint */ class wxPoint @@ -379,44 +456,49 @@ class wxPoint public: //@{ /** - Create a point. + Constructs a point. */ wxPoint(); wxPoint(int x, int y); //@} - //@{ /** - Operators for sum and subtraction between a wxPoint object and a - wxSize object. + Assignment operator. */ void operator =(const wxPoint& pt); + bool operator ==(const wxPoint& p1, const wxPoint& p2); bool operator !=(const wxPoint& p1, const wxPoint& p2); + wxPoint operator +(const wxPoint& p1, const wxPoint& p2); wxPoint operator -(const wxPoint& p1, const wxPoint& p2); - wxPoint operator +=(const wxPoint& pt); - wxPoint operator -=(const wxPoint& pt); + + wxPoint& operator +=(const wxPoint& pt); + wxPoint& operator -=(const wxPoint& pt); + wxPoint operator +(const wxPoint& pt, const wxSize& sz); wxPoint operator -(const wxPoint& pt, const wxSize& sz); wxPoint operator +(const wxSize& sz, const wxPoint& pt); wxPoint operator -(const wxSize& sz, const wxPoint& pt); - wxPoint operator +=(const wxSize& sz); - wxPoint operator -=(const wxSize& sz); - //@} + + wxPoint& operator +=(const wxSize& sz); + wxPoint& operator -=(const wxSize& sz); /** - int x x member. */ - + int x; /** - int y y member. */ + int y; }; +/** + Global istance of a wxPoint initialized with values (-1,-1). +*/ +wxPoint wxDefaultPosition; /** @@ -424,17 +506,93 @@ public: @wxheader{gdicmn.h} wxWidgets maintains a database of standard RGB colours for a predefined - set of named colours (such as "BLACK'', "LIGHT GREY''). The - application may add to this set if desired by using - wxColourDatabase::AddColour and may use it to look up - colours by names using wxColourDatabase::Find or find the names - for the standard colour suing wxColourDatabase::FindName. - - There is one predefined instance of this class called - @b wxTheColourDatabase. + set of named colours. The application may add to this set if desired by + using AddColour() and may use it to look up colours by names using Find() + or find the names for the standard colour using FindName(). + + There is one predefined, global instance of this class called + ::wxTheColourDatabase. + + The standard database contains at least the following colours: + + @beginTable + + AQUAMARINE + @n BLACK + @n BLUE + @n BLUE VIOLET + @n BROWN + @n CADET BLUE + @n CORAL + @n CORNFLOWER BLUE + @n CYAN + @n DARK GREY + @n DARK GREEN + @n DARK OLIVE GREEN + @n DARK ORCHID + @n DARK SLATE BLUE + @n DARK SLATE GREY + @n DARK TURQUOISE + @n DIM GREY + + FIREBRICK + @n FOREST GREEN + @n GOLD + @n GOLDENROD + @n GREY + @n GREEN + @n GREEN YELLOW + @n INDIAN RED + @n KHAKI + @n LIGHT BLUE + @n LIGHT GREY + @n LIGHT STEEL BLUE + @n LIME GREEN + @n MAGENTA + @n MAROON + @n MEDIUM AQUAMARINE + @n MEDIUM BLUE + + MEDIUM FOREST GREEN + @n MEDIUM GOLDENROD + @n MEDIUM ORCHID + @n MEDIUM SEA GREEN + @n MEDIUM SLATE BLUE + @n MEDIUM SPRING GREEN + @n MEDIUM TURQUOISE + @n MEDIUM VIOLET RED + @n MIDNIGHT BLUE + @n NAVY + @n ORANGE + @n ORANGE RED + @n ORCHID + @n PALE GREEN + @n PINK + @n PLUM + @n PURPLE + + RED + @n SALMON + @n SEA GREEN + @n SIENNA + @n SKY BLUE + @n SLATE BLUE + @n SPRING GREEN + @n STEEL BLUE + @n TAN + @n THISTLE + @n TURQUOISE + @n VIOLET + @n VIOLET RED + @n WHEAT + @n WHITE + @n YELLOW + @n YELLOW GREEN + + @endTable @library{wxcore} - @category{FIXME} + @category{gdi} @see wxColour */ @@ -442,99 +600,54 @@ class wxColourDatabase { public: /** - Constructs the colour database. It will be initialized at the first use. + Constructs the colour database. It will be initialized at the first + use. */ wxColourDatabase(); - //@{ /** - Adds a colour to the database. If a colour with the same name already exists, - it is replaced. - Please note that the overload taking a pointer is deprecated and will be - removed in the next wxWidgets version, please don't use it. + Adds a colour to the database. If a colour with the same name already + exists, it is replaced. */ - void AddColour(const wxString& colourName, - const wxColour& colour); - void AddColour(const wxString& colourName, wxColour* colour); - //@} + void AddColour(const wxString& colourName, const wxColour& colour); /** - Finds a colour given the name. Returns an invalid colour object (that is, such - that its @ref wxColour::isok Ok method returns @false) if the colour wasn't - found in the database. + Finds a colour given the name. Returns an invalid colour object (that + is, wxColour::IsOk() will return @false) if the colour wasn't found in + the database. */ wxColour Find(const wxString& colourName); /** - Finds a colour name given the colour. Returns an empty string if the colour is - not found in the database. + Finds a colour name given the colour. Returns an empty string if the + colour is not found in the database. */ wxString FindName(const wxColour& colour) const; }; - -/** - @class wxFontList - @wxheader{gdicmn.h} - - A font list is a list containing all fonts which have been created. There - is only one instance of this class: @b wxTheFontList. Use this object to search - for a previously created font of the desired type and create it if not already - found. - In some windowing systems, the font may be a scarce resource, so it is best to - reuse old resources if possible. When an application finishes, all fonts will - be - deleted and their resources freed, eliminating the possibility of 'memory - leaks'. - - @library{wxcore} - @category{gdi} - - @see wxFont -*/ -class wxFontList : public wxList -{ -public: - /** - Constructor. The application should not construct its own font list: - use the object pointer @b wxTheFontList. - */ - wxFontList(); - - /** - Finds a font of the given specification, or creates one and adds it to the - list. See the @ref wxFont::ctor "wxFont constructor" for - details of the arguments. - */ - wxFont* FindOrCreateFont(int point_size, int family, int style, - int weight, - bool underline = false, - const wxString& facename = NULL, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); -}; - - - /** @class wxSize @wxheader{gdicmn.h} - A @b wxSize is a useful data structure for graphics operations. - It simply contains integer @e width and @e height members. - - wxSize is used throughout wxWidgets as well as wxPoint which, although almost - equivalent to wxSize, has a different meaning: wxPoint represents a position - while wxSize - the size. + A wxSize is a useful data structure for graphics operations. It simply + contains integer @e width and @e height members. - @b wxPython note: wxPython defines aliases for the @c x and @c y members - named @c width and @c height since it makes much more sense for - sizes. + wxSize is used throughout wxWidgets as well as wxPoint which, although + almost equivalent to wxSize, has a different meaning: wxPoint represents a + position while wxSize represents the size. + @beginWxPythonOnly + wxPython defines aliases for the @e x and @e y members named @e width and + @e height since it makes much more sense for sizes. + @endWxPythonOnly @library{wxcore} @category{data} + @stdobjects + ::wxDefaultSize + @see wxPoint, wxRealPoint */ class wxSize @@ -550,11 +663,8 @@ public: //@{ /** - Decreases the size in x- and y- directions - By @e size.x and @e size.y for the first overload - By @a dx and @a dy for the second one - By @a d and @a d for the third one - + Decreases the size in both x and y directions. + @see IncBy() */ void DecBy(const wxSize& size); @@ -563,9 +673,9 @@ public: //@} /** - Decrements this object so that both of its dimensions are not greater than the - corresponding dimensions of the @e size. - + Decrements this object so that both of its dimensions are not greater + than the corresponding dimensions of the @a size. + @see IncTo() */ void DecTo(const wxSize& size); @@ -582,11 +692,8 @@ public: //@{ /** - Increases the size in x- and y- directions - By @e size.x and @e size.y for the first overload - By @a dx and @a dy for the second one - By @a d and @a d for the third one - + Increases the size in both x and y directions. + @see DecBy() */ void IncBy(const wxSize& size); @@ -595,49 +702,31 @@ public: //@} /** - Increments this object so that both of its dimensions are not less than the - corresponding dimensions of the @e size. - + Increments this object so that both of its dimensions are not less than + the corresponding dimensions of the @a size. + @see DecTo() */ void IncTo(const wxSize& size); /** - Returns @true if neither of the size object components is equal to -1, which - is used as default for the size values in wxWidgets (hence the predefined - @c wxDefaultSize has both of its components equal to -1). - This method is typically used before calling - SetDefaults(). + Returns @true if neither of the size object components is equal to -1, + which is used as default for the size values in wxWidgets (hence the + predefined ::wxDefaultSize has both of its components equal to -1). + + This method is typically used before calling SetDefaults(). */ bool IsFullySpecified() const; - //@{ /** - Operators for division and multiplication between a wxSize object and an - integer. - */ - void operator =(const wxSize& sz); - bool operator ==(const wxSize& s1, const wxSize& s2); - bool operator !=(const wxSize& s1, const wxSize& s2); - wxSize operator +(const wxSize& s1, const wxSize& s2); - wxSize operator -(const wxSize& s1, const wxSize& s2); - wxSize operator +=(const wxSize& sz); - wxSize operator -=(const wxSize& sz); - wxSize operator /(const wxSize& sz, int factor); - wxSize operator *(const wxSize& sz, int factor); - wxSize operator *(int factor, const wxSize& sz); - wxSize operator /=(int factor); - wxSize operator *=(int factor); - //@} + Scales the dimensions of this object by the given factors. If you want + to scale both dimensions by the same factor you can also use + operator*=(). - /** - Scales the dimensions of this object by the given factors. - If you want to scale both dimensions by the same factor you can also use - the @ref operators() "operator *=" - Returns a reference to this object (so that you can concatenate other - operations in the same line). + @return A reference to this object (so that you can concatenate other + operations in the same line). */ - wxSize Scale(float xscale, float yscale); + wxSize& Scale(float xscale, float yscale); /** Sets the width and height members. @@ -645,10 +734,17 @@ public: void Set(int width, int height); /** - Combine this size object with another one replacing the default (i.e. equal - to -1) components of this object with those of the other. It is typically - used like this: - + Combine this size object with another one replacing the default (i.e. + equal to -1) components of this object with those of the other. It is + typically used like this: + + @code + if ( !size.IsFullySpecified() ) + { + size.SetDefaults(GetDefaultSize()); + } + @endcode + @see IsFullySpecified() */ void SetDefaults(const wxSize& sizeDefault); @@ -662,76 +758,32 @@ public: Sets the width. */ void SetWidth(int width); -}; - + /** + Assignment operator. + */ + void operator =(const wxSize& sz); -/** - @class wxPenList - @wxheader{gdicmn.h} + bool operator ==(const wxSize& s1, const wxSize& s2); + bool operator !=(const wxSize& s1, const wxSize& s2); - There is only one instance of this class: @b wxThePenList. Use - this object to search for a previously created pen of the desired - type and create it if not already found. In some windowing systems, - the pen may be a scarce resource, so it can pay to reuse old - resources if possible. When an application finishes, all pens will - be deleted and their resources freed, eliminating the possibility of - 'memory leaks'. However, it is best not to rely on this automatic - cleanup because it can lead to double deletion in some circumstances. - - There are two mechanisms in recent versions of wxWidgets which make the - pen list less useful than it once was. Under Windows, scarce resources - are cleaned up internally if they are not being used. Also, a referencing - counting mechanism applied to all GDI objects means that some sharing - of underlying resources is possible. You don't have to keep track of pointers, - working out when it is safe delete a pen, because the referencing counting does - it for you. For example, you can set a pen in a device context, and then - immediately delete the pen you passed, because the pen is 'copied'. - - So you may find it easier to ignore the pen list, and instead create - and copy pens as you see fit. If your Windows resource meter suggests - your application is using too many resources, you can resort to using - GDI lists to share objects explicitly. - - The only compelling use for the pen list is for wxWidgets to keep - track of pens in order to clean them up on exit. It is also kept for - backward compatibility with earlier versions of wxWidgets. + wxSize operator +(const wxSize& s1, const wxSize& s2); + wxSize operator -(const wxSize& s1, const wxSize& s2); + wxSize& operator +=(const wxSize& sz); + wxSize& operator -=(const wxSize& sz); - @library{wxcore} - @category{gdi} + wxSize operator /(const wxSize& sz, int factor); + wxSize operator *(const wxSize& sz, int factor); + wxSize operator *(int factor, const wxSize& sz); + wxSize& operator /=(int factor); + wxSize& operator *=(int factor); +}; - @see wxPen +/** + Global instance of a wxSize object initialized to (-1,-1). */ -class wxPenList -{ -public: - /** - Constructor. The application should not construct its own pen list: - use the object pointer @b wxThePenList. - */ - wxPenList(); +wxSize wxDefaultSize; - //@{ - /** - Finds a pen with the specified attributes and returns it, else creates a new - pen, adds it - to the pen list, and returns it. - - @param colour - Colour object. - @param colourName - Colour name, which should be in the colour database. - @param width - Width of pen. - @param style - Pen style. See wxPen::wxPen for a list of styles. - */ - wxPen* FindOrCreatePen(const wxColour& colour, int width, - int style); - wxPen* FindOrCreatePen(const wxString& colourName, int width, - int style); - //@} -}; @@ -739,59 +791,91 @@ public: // Global functions/macros // ============================================================================ +/** @ingroup group_funcmacro_gdi */ //@{ + /** - Returns the dimensions of the work area on the display. On Windows - this means the area not covered by the taskbar, etc. Other platforms - are currently defaulting to the whole display until a way is found to - provide this info for all window managers, etc. + This macro loads a bitmap from either application resources (on the + platforms for which they exist, i.e. Windows and OS2) or from an XPM file. + This can help to avoid using @ifdef_ when creating bitmaps. + + @see @ref overview_bitmap, wxICON() + + @header{wx/gdicmn.h} */ -void wxClientDisplayRect(int* x, int* y, int* width, - int* height); -wxRect wxGetClientDisplayRect(); -//@} +#define wxBITMAP(bitmapName) -//@{ /** - Returns the display size in pixels. + This macro loads an icon from either application resources (on the + platforms for which they exist, i.e. Windows and OS2) or from an XPM file. + This can help to avoid using @ifdef_ when creating icons. + + @see @ref overview_bitmap, wxBITMAP() + + @header{wx/gdicmn.h} */ -void wxDisplaySize(int* width, int* height); -wxSize wxGetDisplaySize(); -//@} +wxICON(); -//@{ /** - Returns the display size in millimeters. + Returns @true if the display is colour, @false otherwise. + + @header{wx/gdicmn.h} */ -void wxDisplaySizeMM(int* width, int* height); -wxSize wxGetDisplaySizeMM(); -//@} +bool wxColourDisplay(); /** - This macro loads an icon from either application resources (on the platforms - for which they exist, i.e. Windows and OS2) or from an XPM file. It allows to - avoid using @c #ifdefs when creating icons. + Returns the depth of the display (a value of 1 denotes a monochrome + display). - @see @ref overview_wxbitmapoverview, wxBITMAP() + @header{wx/gdicmn.h} */ -wxICON(); +int wxDisplayDepth(); /** - Returns @true if the display is colour, @false otherwise. + Globally sets the cursor; only has an effect on Windows, Mac and GTK+. You + should call this function with wxNullCursor to restore the system cursor. + + @see wxCursor, wxWindow::SetCursor() + + @header{wx/gdicmn.h} */ -bool wxColourDisplay(); +void wxSetCursor(const wxCursor& cursor); + +//@} + +/** @ingroup group_funcmacro_gdi */ +//@{ +/** + Returns the dimensions of the work area on the display. On Windows this + means the area not covered by the taskbar, etc. Other platforms are + currently defaulting to the whole display until a way is found to provide + this info for all window managers, etc. + + @header{wx/gdicmn.h} +*/ +void wxClientDisplayRect(int* x, int* y, int* width, int* height); +wxRect wxGetClientDisplayRect(); +//@} +/** @ingroup group_funcmacro_gdi */ +//@{ /** - This macro loads a bitmap from either application resources (on the platforms - for which they exist, i.e. Windows and OS2) or from an XPM file. It allows to - avoid using @c #ifdefs when creating bitmaps. + Returns the display size in pixels. - @see @ref overview_wxbitmapoverview, wxICON() + @header{wx/gdicmn.h} */ -#define wxBITMAP() /* implementation is private */ +void wxDisplaySize(int* width, int* height); +wxSize wxGetDisplaySize(); +//@} +/** @ingroup group_funcmacro_gdi */ +//@{ /** - Returns the depth of the display (a value of 1 denotes a monochrome display). + Returns the display size in millimeters. + + @header{wx/gdicmn.h} */ -int wxDisplayDepth(); +void wxDisplaySizeMM(int* width, int* height); +wxSize wxGetDisplaySizeMM(); +//@}