2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: gdicmn.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxRealPoint
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-03-15 14:15:46 -04:00
|
|
|
|
|
|
|
/**
|
2008-04-06 11:28:55 -04:00
|
|
|
Bitmap type flags.
|
|
|
|
|
|
|
|
See wxBitmap and wxImage classes.
|
2008-03-15 14:15:46 -04:00
|
|
|
*/
|
|
|
|
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.
|
2008-04-06 11:28:55 -04:00
|
|
|
|
|
|
|
See wxCursor.
|
2008-03-15 14:15:46 -04:00
|
|
|
*/
|
|
|
|
enum wxStockCursor
|
|
|
|
{
|
|
|
|
wxCURSOR_NONE,
|
|
|
|
wxCURSOR_ARROW,
|
|
|
|
wxCURSOR_RIGHT_ARROW,
|
|
|
|
wxCURSOR_BULLSEYE,
|
|
|
|
wxCURSOR_CHAR,
|
|
|
|
wxCURSOR_CROSS,
|
|
|
|
wxCURSOR_HAND,
|
|
|
|
wxCURSOR_IBEAM,
|
|
|
|
wxCURSOR_LEFT_BUTTON,
|
|
|
|
wxCURSOR_MAGNIFIER,
|
|
|
|
wxCURSOR_MIDDLE_BUTTON,
|
|
|
|
wxCURSOR_NO_ENTRY,
|
|
|
|
wxCURSOR_PAINT_BRUSH,
|
|
|
|
wxCURSOR_PENCIL,
|
|
|
|
wxCURSOR_POINT_LEFT,
|
|
|
|
wxCURSOR_POINT_RIGHT,
|
|
|
|
wxCURSOR_QUESTION_ARROW,
|
|
|
|
wxCURSOR_RIGHT_BUTTON,
|
|
|
|
wxCURSOR_SIZENESW,
|
|
|
|
wxCURSOR_SIZENS,
|
|
|
|
wxCURSOR_SIZENWSE,
|
|
|
|
wxCURSOR_SIZEWE,
|
|
|
|
wxCURSOR_SIZING,
|
|
|
|
wxCURSOR_SPRAYCAN,
|
|
|
|
wxCURSOR_WAIT,
|
|
|
|
wxCURSOR_WATCH,
|
|
|
|
wxCURSOR_BLANK,
|
|
|
|
wxCURSOR_DEFAULT, //!< standard X11 cursor
|
|
|
|
wxCURSOR_COPY_ARROW , //!< MacOS Theme Plus arrow
|
|
|
|
// Not yet implemented for Windows
|
|
|
|
wxCURSOR_CROSS_REVERSE,
|
|
|
|
wxCURSOR_DOUBLE_ARROW,
|
|
|
|
wxCURSOR_BASED_ARROW_UP,
|
|
|
|
wxCURSOR_BASED_ARROW_DOWN,
|
|
|
|
wxCURSOR_ARROWWAIT,
|
|
|
|
wxCURSOR_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxRealPoint
|
|
|
|
@wxheader{gdicmn.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A @b wxRealPoint is a useful data structure for graphics operations.
|
2008-04-06 11:28:55 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
It contains floating point @e x and @e y members.
|
|
|
|
See also wxPoint for an integer version.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{data}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxPoint
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxRealPoint
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
2008-04-06 11:28:55 -04:00
|
|
|
wxRealPoint();
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-04-06 11:28:55 -04:00
|
|
|
Initializes the point with the given coordinates.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxRealPoint(double x, double y);
|
2008-04-06 11:28:55 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
X coordinate of this point.
|
|
|
|
*/
|
|
|
|
double x;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Y coordinate of this point.
|
|
|
|
*/
|
|
|
|
double y;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxRect
|
|
|
|
@wxheader{gdicmn.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A class for manipulating rectangles.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{data}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxPoint, wxSize
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxRect
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Creates a wxRect object from size values at the origin.
|
|
|
|
*/
|
|
|
|
wxRect();
|
2008-03-08 09:43:31 -05:00
|
|
|
wxRect(int x, int y, int width, int height);
|
|
|
|
wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
|
|
|
|
wxRect(const wxPoint& pos, const wxSize& size);
|
|
|
|
wxRect(const wxSize& size);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
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
|
2008-03-09 08:33:59 -04:00
|
|
|
directions but if @a dir includes only @c wxVERTICAL or only
|
2008-03-08 08:52:38 -05:00
|
|
|
@c wxHORIZONTAL flag, then it is only centered in this direction while
|
|
|
|
the other component of its position remains unchanged.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const;
|
|
|
|
const wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Returns @true if the given rectangle is completely inside this rectangle
|
|
|
|
(or touches its boundary) and @false otherwise.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool Contains(int x, int y) const;
|
|
|
|
const bool Contains(const wxPoint& pt) const;
|
|
|
|
const bool Contains(const wxRect& rect) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
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.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see Inflate()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
void Deflate(wxCoord dx, wxCoord dy) const;
|
|
|
|
void Deflate(const wxSize& diff) const;
|
|
|
|
void Deflate(wxCoord diff) const;
|
|
|
|
wxRect Deflate(wxCoord dx, wxCoord dy) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the bottom point of the rectangle.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetBottom() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the position of the bottom left corner.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxPoint GetBottomLeft() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the position of the bottom right corner.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxPoint GetBottomRight() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the height member.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetHeight() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the left point of the rectangle (the same as wxRect::GetX).
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetLeft() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the position.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxPoint GetPosition() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the right point of the rectangle.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetRight() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the size.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetSize()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxSize GetSize() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the top point of the rectangle (the same as wxRect::GetY).
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetTop() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
Gets the position of the top left corner of the rectangle, same as
|
2008-03-08 08:52:38 -05:00
|
|
|
GetPosition().
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxPoint GetTopLeft() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the position of the top right corner.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxPoint GetTopRight() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the width member.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetWidth() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the x member.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetX() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the y member.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetY() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Increases the size of the rectangle.
|
2008-03-09 08:33:59 -04:00
|
|
|
The second form uses the same @a diff for both @a dx and @e dy.
|
2008-03-08 08:52:38 -05:00
|
|
|
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
|
2008-03-09 08:33:59 -04:00
|
|
|
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
|
2008-03-08 08:52:38 -05:00
|
|
|
size decreases in the respective direction.
|
2008-04-01 09:59:28 -04:00
|
|
|
Inflating and deflating behaves "naturally". Defined more precisely, that
|
2008-03-08 08:52:38 -05:00
|
|
|
means:
|
2008-04-01 09:59:28 -04:00
|
|
|
"Real" inflates (that is, @a dx and/or @a dy = 0) are not
|
2008-03-08 08:52:38 -05:00
|
|
|
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).
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see Deflate()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
void Inflate(wxCoord dx, wxCoord dy) const;
|
|
|
|
void Inflate(const wxSize& diff) const;
|
|
|
|
void Inflate(wxCoord diff) const;
|
|
|
|
wxRect Inflate(wxCoord dx, wxCoord dy) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
wxRect Intersect(const wxRect& rect);
|
2008-03-09 12:24:26 -04:00
|
|
|
const wxRect& Intersect(const wxRect& rect);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if this rectangle has a non-empty intersection with the
|
2008-03-09 08:33:59 -04:00
|
|
|
rectangle @a rect and @false otherwise.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool Intersects(const wxRect& rect) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
Returns @true if this rectangle has a width or height less than or equal to
|
2008-03-08 08:52:38 -05:00
|
|
|
0 and @false otherwise.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsEmpty() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Moves the rectangle by the specified offset. If @a dx is positive, the
|
|
|
|
rectangle is moved to the right, if @a dy is positive, it is moved to the
|
2008-03-08 08:52:38 -05:00
|
|
|
bottom, otherwise it is moved to the left or top respectively.
|
|
|
|
*/
|
|
|
|
void Offset(wxCoord dx, wxCoord dy);
|
2008-03-08 09:43:31 -05:00
|
|
|
void Offset(const wxPoint& pt);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the height.
|
|
|
|
*/
|
|
|
|
void SetHeight(int height);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the size.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetSize()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetSize(const wxSize& s);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the width.
|
|
|
|
*/
|
|
|
|
void SetWidth(int width);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the x position.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void SetX(int x);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the y position.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void SetY(int y);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
wxRect Union(const wxRect& rect);
|
2008-03-09 12:24:26 -04:00
|
|
|
const wxRect& Union(const wxRect& rect);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
int height
|
|
|
|
Height member.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Returns the intersection of two rectangles (which may be empty).
|
|
|
|
*/
|
|
|
|
bool operator !=(const wxRect& r1, const wxRect& r2);
|
2008-03-08 09:43:31 -05:00
|
|
|
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);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Assignment operator.
|
|
|
|
*/
|
|
|
|
void operator =(const wxRect& rect);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Equality operator.
|
|
|
|
*/
|
|
|
|
bool operator ==(const wxRect& r1, const wxRect& r2);
|
|
|
|
|
|
|
|
/**
|
|
|
|
int width
|
|
|
|
Width member.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
int x
|
|
|
|
x coordinate of the top-level corner of the rectangle.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
int y
|
|
|
|
y coordinate of the top-level corner of the rectangle.
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxPoint
|
|
|
|
@wxheader{gdicmn.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A @b wxPoint is a useful data structure for graphics operations.
|
|
|
|
It simply contains integer @e x and @e y members.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
See also wxRealPoint for a floating point version.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{data}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-06 11:28:55 -04:00
|
|
|
@stdobjects
|
|
|
|
::wxDefaultPosition
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxRealPoint
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxPoint
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Create a point.
|
|
|
|
*/
|
|
|
|
wxPoint();
|
2008-03-08 09:43:31 -05:00
|
|
|
wxPoint(int x, int y);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Operators for sum and subtraction between a wxPoint object and a
|
|
|
|
wxSize object.
|
|
|
|
*/
|
|
|
|
void operator =(const wxPoint& pt);
|
2008-03-08 09:43:31 -05:00
|
|
|
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, 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);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
int x
|
|
|
|
x member.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
int y
|
|
|
|
y member.
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
2008-04-06 11:28:55 -04:00
|
|
|
/**
|
|
|
|
Global istance of a wxPoint initialized with values -1;-1.
|
|
|
|
*/
|
|
|
|
wxPoint wxDefaultPosition;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxColourDatabase
|
|
|
|
@wxheader{gdicmn.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
wxWidgets maintains a database of standard RGB colours for a predefined
|
2008-04-01 09:59:28 -04:00
|
|
|
set of named colours (such as "BLACK", "LIGHT GREY"). The
|
2008-03-08 08:52:38 -05:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
There is one predefined instance of this class called
|
|
|
|
@b wxTheColourDatabase.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{FIXME}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxColour
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxColourDatabase
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
void AddColour(const wxString& colourName,
|
|
|
|
const wxColour& colour);
|
2008-03-08 09:43:31 -05:00
|
|
|
void AddColour(const wxString& colourName, wxColour* colour);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
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.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxString FindName(const wxColour& colour) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxSize
|
|
|
|
@wxheader{gdicmn.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A @b wxSize is a useful data structure for graphics operations.
|
|
|
|
It simply contains integer @e width and @e height members.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{data}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-06 11:28:55 -04:00
|
|
|
@stdobjects
|
|
|
|
::wxDefaultSize
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxPoint, wxRealPoint
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxSize
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Creates a size object.
|
|
|
|
*/
|
|
|
|
wxSize();
|
2008-03-08 09:43:31 -05:00
|
|
|
wxSize(int width, int height);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Decreases the size in x- and y- directions
|
|
|
|
By @e size.x and @e size.y for the first overload
|
2008-03-09 08:33:59 -04:00
|
|
|
By @a dx and @a dy for the second one
|
|
|
|
By @a d and @a d for the third one
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see IncBy()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void DecBy(const wxSize& size);
|
2008-03-08 09:43:31 -05:00
|
|
|
void DecBy(int dx, int dy);
|
|
|
|
void DecBy(int d);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Decrements this object so that both of its dimensions are not greater than the
|
|
|
|
corresponding dimensions of the @e size.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see IncTo()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void DecTo(const wxSize& size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the height member.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetHeight() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the width member.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetWidth() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Increases the size in x- and y- directions
|
|
|
|
By @e size.x and @e size.y for the first overload
|
2008-03-09 08:33:59 -04:00
|
|
|
By @a dx and @a dy for the second one
|
|
|
|
By @a d and @a d for the third one
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see DecBy()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void IncBy(const wxSize& size);
|
2008-03-08 09:43:31 -05:00
|
|
|
void IncBy(int dx, int dy);
|
|
|
|
void IncBy(int d);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Increments this object so that both of its dimensions are not less than the
|
|
|
|
corresponding dimensions of the @e size.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see DecTo()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
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().
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsFullySpecified() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Operators for division and multiplication between a wxSize object and an
|
|
|
|
integer.
|
|
|
|
*/
|
|
|
|
void operator =(const wxSize& sz);
|
2008-03-08 09:43:31 -05:00
|
|
|
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);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
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).
|
|
|
|
*/
|
|
|
|
wxSize Scale(float xscale, float yscale);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the width and height members.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void Set(int width, int height);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
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:
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see IsFullySpecified()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetDefaults(const wxSize& sizeDefault);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the height.
|
|
|
|
*/
|
|
|
|
void SetHeight(int height);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the width.
|
|
|
|
*/
|
|
|
|
void SetWidth(int width);
|
|
|
|
};
|
|
|
|
|
2008-04-06 11:28:55 -04:00
|
|
|
/**
|
|
|
|
Global instance of a wxSize object initialized with values -1;-1.
|
|
|
|
*/
|
|
|
|
wxSize wxDefaultSize;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
// ============================================================================
|
|
|
|
// Global functions/macros
|
|
|
|
// ============================================================================
|
|
|
|
|
2008-03-12 15:08:48 -04:00
|
|
|
/** @ingroup group_funcmacro_gdi */
|
2008-03-08 08:52:38 -05:00
|
|
|
//@{
|
2008-03-11 03:57:21 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-03-20 02:00:05 -04:00
|
|
|
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}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-20 02:00:05 -04:00
|
|
|
#define wxBITMAP(bitmapName)
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-20 02:00:05 -04:00
|
|
|
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}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-20 02:00:05 -04:00
|
|
|
wxICON();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-20 02:00:05 -04:00
|
|
|
Returns @true if the display is colour, @false otherwise.
|
|
|
|
|
|
|
|
@header{wx/gdicmn.h}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-20 02:00:05 -04:00
|
|
|
bool wxColourDisplay();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-20 02:00:05 -04:00
|
|
|
Returns the depth of the display (a value of 1 denotes a monochrome
|
|
|
|
display).
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-20 02:00:05 -04:00
|
|
|
@header{wx/gdicmn.h}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-20 02:00:05 -04:00
|
|
|
int wxDisplayDepth();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-20 02:00:05 -04:00
|
|
|
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}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-20 02:00:05 -04:00
|
|
|
void wxSetCursor(const wxCursor& cursor);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-20 02:00:05 -04:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @ingroup group_funcmacro_gdi */
|
|
|
|
//@{
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-03-20 02:00:05 -04:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-20 02:00:05 -04:00
|
|
|
@header{wx/gdicmn.h}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-20 02:00:05 -04:00
|
|
|
void wxClientDisplayRect(int* x, int* y, int* width, int* height);
|
|
|
|
wxRect wxGetClientDisplayRect();
|
|
|
|
//@}
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-20 02:00:05 -04:00
|
|
|
/** @ingroup group_funcmacro_gdi */
|
|
|
|
//@{
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-03-20 02:00:05 -04:00
|
|
|
Returns the display size in pixels.
|
|
|
|
|
|
|
|
@header{wx/gdicmn.h}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-20 02:00:05 -04:00
|
|
|
void wxDisplaySize(int* width, int* height);
|
|
|
|
wxSize wxGetDisplaySize();
|
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @ingroup group_funcmacro_gdi */
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Returns the display size in millimeters.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-20 02:00:05 -04:00
|
|
|
@header{wx/gdicmn.h}
|
|
|
|
*/
|
|
|
|
void wxDisplaySizeMM(int* width, int* height);
|
|
|
|
wxSize wxGetDisplaySizeMM();
|
2008-03-11 03:57:21 -04:00
|
|
|
//@}
|
|
|
|
|