| @@ -29,11 +29,11 @@ class ComponentLayout; | |||
| //============================================================================== | |||
| /** | |||
| A rectangle whose co-ordinates can be defined in terms of absolute or | |||
| A rectangle whose coordinates can be defined in terms of absolute or | |||
| proportional distances. | |||
| Designed mainly for storing component positions, this gives you a lot of | |||
| control over how each co-ordinate is stored, either as an absolute position, | |||
| control over how each coordinate is stored, either as an absolute position, | |||
| or as a proportion of the size of a parent rectangle. | |||
| It also allows you to define the anchor points by which the rectangle is | |||
| @@ -68,7 +68,7 @@ class PositionedRectangle | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| /** Creates an empty rectangle with all co-ordinates set to zero. | |||
| /** Creates an empty rectangle with all coordinates set to zero. | |||
| The default anchor point is top-left; the default | |||
| */ | |||
| @@ -122,20 +122,20 @@ public: | |||
| /** Returns a string version of this position, from which it can later be | |||
| re-generated. | |||
| The format is four co-ordinates, "x y w h". | |||
| The format is four coordinates, "x y w h". | |||
| - If a co-ordinate is absolute, it is stored as an integer, e.g. "100". | |||
| - If a co-ordinate is proportional to its parent's width or height, it is stored | |||
| - If a coordinate is absolute, it is stored as an integer, e.g. "100". | |||
| - If a coordinate is proportional to its parent's width or height, it is stored | |||
| as a percentage, e.g. "80%". | |||
| - If the X or Y co-ordinate is relative to the parent's right or bottom edge, the | |||
| - If the X or Y coordinate is relative to the parent's right or bottom edge, the | |||
| number has "R" appended to it, e.g. "100R" means a distance of 100 pixels from | |||
| the parent's right-hand edge. | |||
| - If the X or Y co-ordinate is relative to the parent's centre, the number has "C" | |||
| - If the X or Y coordinate is relative to the parent's centre, the number has "C" | |||
| appended to it, e.g. "-50C" would be 50 pixels left of the parent's centre. | |||
| - If the X or Y co-ordinate should be anchored at the component's right or bottom | |||
| - If the X or Y coordinate should be anchored at the component's right or bottom | |||
| edge, then it has "r" appended to it. So "-50Rr" would mean that this component's | |||
| right-hand edge should be 50 pixels left of the parent's right-hand edge. | |||
| - If the X or Y co-ordinate should be anchored at the component's centre, then it | |||
| - If the X or Y coordinate should be anchored at the component's centre, then it | |||
| has "c" appended to it. So "-50Rc" would mean that this component's | |||
| centre should be 50 pixels left of the parent's right-hand edge. "40%c" means that | |||
| this component's centre should be placed 40% across the parent's width. | |||
| @@ -198,17 +198,17 @@ public: | |||
| } | |||
| //============================================================================== | |||
| /** Updates this object's co-ordinates to match the given rectangle. | |||
| /** Updates this object's coordinates to match the given rectangle. | |||
| This will set all co-ordinates based on the given rectangle, re-calculating | |||
| This will set all coordinates based on the given rectangle, re-calculating | |||
| any proportional distances, and using the current anchor points. | |||
| So for example if the x co-ordinate mode is currently proportional, this will | |||
| So for example if the x coordinate mode is currently proportional, this will | |||
| re-calculate x based on the rectangle's relative position within the target | |||
| rectangle's width. | |||
| If the target rectangle's width or height are zero then it may not be possible | |||
| to re-calculate some proportional co-ordinates. In this case, those co-ordinates | |||
| to re-calculate some proportional coordinates. In this case, those coordinates | |||
| will not be changed. | |||
| */ | |||
| void updateFrom (const Rectangle<int>& newPosition, | |||
| @@ -228,12 +228,12 @@ public: | |||
| updatePosAndSize (y, h, newY, newH, yMode, hMode, target.getY(), target.getHeight()); | |||
| } | |||
| /** Updates this object's co-ordinates to match the bounds of this component. | |||
| /** Updates this object's coordinates to match the bounds of this component. | |||
| This is equivalent to calling updateFrom() with the component's bounds and | |||
| it parent size. | |||
| If the component doesn't currently have a parent, then proportional co-ordinates | |||
| If the component doesn't currently have a parent, then proportional coordinates | |||
| might not be updated because it would need to know the parent's size to do the | |||
| maths for this. | |||
| */ | |||
| @@ -249,18 +249,18 @@ public: | |||
| /** Specifies the point within the rectangle, relative to which it should be positioned. */ | |||
| enum AnchorPoint | |||
| { | |||
| anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */ | |||
| anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */ | |||
| anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */ | |||
| anchorAtLeftOrTop = 1 << 0, /**< The x or y coordinate specifies where the left or top edge of the rectangle should be. */ | |||
| anchorAtRightOrBottom = 1 << 1, /**< The x or y coordinate specifies where the right or bottom edge of the rectangle should be. */ | |||
| anchorAtCentre = 1 << 2 /**< The x or y coordinate specifies where the centre of the rectangle should be. */ | |||
| }; | |||
| /** Specifies how an x or y co-ordinate should be interpreted. */ | |||
| /** Specifies how an x or y coordinate should be interpreted. */ | |||
| enum PositionMode | |||
| { | |||
| absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */ | |||
| absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */ | |||
| absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */ | |||
| proportionOfParentSize = 1 << 6 /**< The x or y co-ordinate specifies a proportion of the parent's width or height, measured from the parent's top or left. */ | |||
| absoluteFromParentTopLeft = 1 << 3, /**< The x or y coordinate specifies an absolute distance from the parent's top or left edge. */ | |||
| absoluteFromParentBottomRight = 1 << 4, /**< The x or y coordinate specifies an absolute distance from the parent's bottom or right edge. */ | |||
| absoluteFromParentCentre = 1 << 5, /**< The x or y coordinate specifies an absolute distance from the parent's centre. */ | |||
| proportionOfParentSize = 1 << 6 /**< The x or y coordinate specifies a proportion of the parent's width or height, measured from the parent's top or left. */ | |||
| }; | |||
| /** Specifies how the width or height should be interpreted. */ | |||
| @@ -272,11 +272,11 @@ public: | |||
| }; | |||
| //============================================================================== | |||
| /** Sets all options for all co-ordinates. | |||
| /** Sets all options for all coordinates. | |||
| This requires a reference rectangle to be specified, because if you're changing any | |||
| of the modes from proportional to absolute or vice-versa, then it'll need to convert | |||
| the co-ordinates, and will need to know the parent size so it can calculate this. | |||
| the coordinates, and will need to know the parent size so it can calculate this. | |||
| */ | |||
| void setModes (const AnchorPoint xAnchor, const PositionMode xMode_, | |||
| const AnchorPoint yAnchor, const PositionMode yMode_, | |||
| @@ -306,7 +306,7 @@ public: | |||
| } | |||
| } | |||
| /** Returns the anchoring mode for the x co-ordinate. | |||
| /** Returns the anchoring mode for the x coordinate. | |||
| To change any of the modes, use setModes(). | |||
| */ | |||
| AnchorPoint getAnchorPointX() const noexcept | |||
| @@ -314,7 +314,7 @@ public: | |||
| return (AnchorPoint) (xMode & (anchorAtLeftOrTop | anchorAtRightOrBottom | anchorAtCentre)); | |||
| } | |||
| /** Returns the positioning mode for the x co-ordinate. | |||
| /** Returns the positioning mode for the x coordinate. | |||
| To change any of the modes, use setModes(). | |||
| */ | |||
| PositionMode getPositionModeX() const noexcept | |||
| @@ -323,7 +323,7 @@ public: | |||
| | absoluteFromParentCentre | proportionOfParentSize)); | |||
| } | |||
| /** Returns the raw x co-ordinate. | |||
| /** Returns the raw x coordinate. | |||
| If the x position mode is absolute, then this will be the absolute value. If it's | |||
| proportional, then this will be a fractional proportion, where 1.0 means the full | |||
| @@ -331,13 +331,12 @@ public: | |||
| */ | |||
| double getX() const noexcept { return x; } | |||
| /** Sets the raw value of the x co-ordinate. | |||
| /** Sets the raw value of the x coordinate. | |||
| See getX() for the meaning of this value. | |||
| */ | |||
| void setX (const double newX) noexcept { x = newX; } | |||
| /** Returns the anchoring mode for the y co-ordinate. | |||
| /** Returns the anchoring mode for the y coordinate. | |||
| To change any of the modes, use setModes(). | |||
| */ | |||
| AnchorPoint getAnchorPointY() const noexcept | |||
| @@ -345,7 +344,7 @@ public: | |||
| return (AnchorPoint) (yMode & (anchorAtLeftOrTop | anchorAtRightOrBottom | anchorAtCentre)); | |||
| } | |||
| /** Returns the positioning mode for the y co-ordinate. | |||
| /** Returns the positioning mode for the y coordinate. | |||
| To change any of the modes, use setModes(). | |||
| */ | |||
| PositionMode getPositionModeY() const noexcept | |||
| @@ -354,7 +353,7 @@ public: | |||
| | absoluteFromParentCentre | proportionOfParentSize)); | |||
| } | |||
| /** Returns the raw y co-ordinate. | |||
| /** Returns the raw y coordinate. | |||
| If the y position mode is absolute, then this will be the absolute value. If it's | |||
| proportional, then this will be a fractional proportion, where 1.0 means the full | |||
| @@ -362,8 +361,7 @@ public: | |||
| */ | |||
| double getY() const noexcept { return y; } | |||
| /** Sets the raw value of the y co-ordinate. | |||
| /** Sets the raw value of the y coordinate. | |||
| See getY() for the meaning of this value. | |||
| */ | |||
| void setY (const double newY) noexcept { y = newY; } | |||
| @@ -138,7 +138,7 @@ public: | |||
| void run() override | |||
| { | |||
| // this is the code that runs this thread - we'll loop continuously, | |||
| // updating the co-ordinates of our blob. | |||
| // updating the coordinates of our blob. | |||
| // threadShouldExit() returns true when the stopThread() method has been | |||
| // called, so we should check it often, and exit as soon as it gets flagged. | |||
| @@ -148,7 +148,7 @@ Colour ColourGradient::getColourAtPosition (const double position) const noexcep | |||
| //============================================================================== | |||
| void ColourGradient::createLookupTable (PixelARGB* const lookupTable, const int numEntries) const noexcept | |||
| { | |||
| JUCE_COLOURGRADIENT_CHECK_COORDS_INITIALISED // Trying to use this object without setting its co-ordinates? | |||
| JUCE_COLOURGRADIENT_CHECK_COORDS_INITIALISED // Trying to use this object without setting its coordinates? | |||
| jassert (colours.size() >= 2); | |||
| jassert (numEntries > 0); | |||
| jassert (colours.getReference(0).position == 0); // The first colour specified has to go at position 0 | |||
| @@ -180,7 +180,7 @@ void ColourGradient::createLookupTable (PixelARGB* const lookupTable, const int | |||
| int ColourGradient::createLookupTable (const AffineTransform& transform, HeapBlock <PixelARGB>& lookupTable) const | |||
| { | |||
| JUCE_COLOURGRADIENT_CHECK_COORDS_INITIALISED // Trying to use this object without setting its co-ordinates? | |||
| JUCE_COLOURGRADIENT_CHECK_COORDS_INITIALISED // Trying to use this object without setting its coordinates? | |||
| jassert (colours.size() >= 2); | |||
| const int numEntries = jlimit (1, jmax (1, (colours.size() - 1) << 8), | |||
| @@ -267,7 +267,7 @@ public: | |||
| /** Fills a rectangle with the current colour or brush. | |||
| This uses sub-pixel positioning so is slower than the fillRect method which | |||
| takes integer co-ordinates. | |||
| takes integer coordinates. | |||
| */ | |||
| void fillRect (float x, float y, float width, float height) const; | |||
| @@ -474,7 +474,7 @@ public: | |||
| /** Draws an image. | |||
| This will draw the whole of an image, positioning its top-left corner at the | |||
| given co-ordinates, and keeping its size the same. This is the simplest image | |||
| given coordinates, and keeping its size the same. This is the simplest image | |||
| drawing method - the others give more control over the scaling and clipping | |||
| of the images. | |||
| @@ -61,7 +61,7 @@ public: | |||
| //============================================================================== | |||
| /** Moves the origin to a new position. | |||
| The co-ords are relative to the current origin, and indicate the new position | |||
| The coordinates are relative to the current origin, and indicate the new position | |||
| of (0, 0). | |||
| */ | |||
| virtual void setOrigin (int x, int y) = 0; | |||
| @@ -181,7 +181,7 @@ public: | |||
| the lines can be left- or right-justified, or centred horizontally in the space | |||
| between x and (x + maxLineWidth). | |||
| The y co-ordinate is the position of the baseline of the first line of text - subsequent | |||
| The y coordinate is the position of the baseline of the first line of text - subsequent | |||
| lines will be placed below it, separated by a distance of font.getHeight(). | |||
| */ | |||
| void addJustifiedText (const Font& font, | |||
| @@ -239,7 +239,7 @@ public: | |||
| */ | |||
| void createPath (Path& path) const; | |||
| /** Looks for a glyph that contains the given co-ordinate. | |||
| /** Looks for a glyph that contains the given coordinate. | |||
| @returns the index of the glyph, or -1 if none were found. | |||
| */ | |||
| @@ -79,7 +79,7 @@ public: | |||
| static const AffineTransform identity; | |||
| //============================================================================== | |||
| /** Transforms a 2D co-ordinate using this matrix. */ | |||
| /** Transforms a 2D coordinate using this matrix. */ | |||
| template <typename ValueType> | |||
| void transformPoint (ValueType& x, ValueType& y) const noexcept | |||
| { | |||
| @@ -88,7 +88,7 @@ public: | |||
| y = static_cast <ValueType> (mat10 * oldX + mat11 * y + mat12); | |||
| } | |||
| /** Transforms two 2D co-ordinates using this matrix. | |||
| /** Transforms two 2D coordinates using this matrix. | |||
| This is just a shortcut for calling transformPoint() on each of these pairs of | |||
| coordinates in turn. (And putting all the calculations into one function hopefully | |||
| also gives the compiler a bit more scope for pipelining it). | |||
| @@ -104,7 +104,7 @@ public: | |||
| y2 = static_cast <ValueType> (mat10 * oldX2 + mat11 * y2 + mat12); | |||
| } | |||
| /** Transforms three 2D co-ordinates using this matrix. | |||
| /** Transforms three 2D coordinates using this matrix. | |||
| This is just a shortcut for calling transformPoint() on each of these pairs of | |||
| coordinates in turn. (And putting all the calculations into one function hopefully | |||
| also gives the compiler a bit more scope for pipelining it). | |||
| @@ -146,7 +146,7 @@ public: | |||
| /** Returns a transform which is the same as this one followed by a rotation about a given point. | |||
| The rotation is specified by a number of radians to rotate clockwise, centred around | |||
| the co-ordinates passed in. | |||
| the coordinates passed in. | |||
| */ | |||
| AffineTransform rotated (float angleInRadians, | |||
| float pivotX, | |||
| @@ -191,7 +191,7 @@ public: | |||
| /** Returns a shear transform, centred around the origin (0, 0). */ | |||
| static AffineTransform shear (float shearX, float shearY) noexcept; | |||
| /** Returns a transform that will flip co-ordinates vertically within a window of the given height. | |||
| /** Returns a transform that will flip coordinates vertically within a window of the given height. | |||
| This is handy for converting between upside-down coordinate systems such as OpenGL or CoreGraphics. | |||
| */ | |||
| static AffineTransform verticalFlip (float height) noexcept; | |||
| @@ -57,7 +57,7 @@ public: | |||
| { | |||
| } | |||
| /** Creates a line based on the co-ordinates of its start and end points. */ | |||
| /** Creates a line based on the coordinates of its start and end points. */ | |||
| Line (ValueType startX, ValueType startY, ValueType endX, ValueType endY) noexcept | |||
| : start (startX, startY), | |||
| end (endX, endY) | |||
| @@ -84,16 +84,16 @@ public: | |||
| ~Line() noexcept {} | |||
| //============================================================================== | |||
| /** Returns the x co-ordinate of the line's start point. */ | |||
| /** Returns the x coordinate of the line's start point. */ | |||
| inline ValueType getStartX() const noexcept { return start.x; } | |||
| /** Returns the y co-ordinate of the line's start point. */ | |||
| /** Returns the y coordinate of the line's start point. */ | |||
| inline ValueType getStartY() const noexcept { return start.y; } | |||
| /** Returns the x co-ordinate of the line's end point. */ | |||
| /** Returns the x coordinate of the line's end point. */ | |||
| inline ValueType getEndX() const noexcept { return end.x; } | |||
| /** Returns the y co-ordinate of the line's end point. */ | |||
| /** Returns the y coordinate of the line's end point. */ | |||
| inline ValueType getEndY() const noexcept { return end.y; } | |||
| /** Returns the line's start point. */ | |||
| @@ -128,10 +128,10 @@ public: | |||
| /** Returns the length of the line. */ | |||
| ValueType getLength() const noexcept { return start.getDistanceFrom (end); } | |||
| /** Returns true if the line's start and end x co-ordinates are the same. */ | |||
| /** Returns true if the line's start and end x coordinates are the same. */ | |||
| bool isVertical() const noexcept { return start.x == end.x; } | |||
| /** Returns true if the line's start and end y co-ordinates are the same. */ | |||
| /** Returns true if the line's start and end y coordinates are the same. */ | |||
| bool isHorizontal() const noexcept { return start.y == end.y; } | |||
| /** Returns the line's angle. | |||
| @@ -164,7 +164,7 @@ public: | |||
| are parallel, this will just be set to the position | |||
| of one of the line's endpoints. | |||
| @returns true if the line segments intersect; false if they dont. Even if they | |||
| don't intersect, the intersection co-ordinates returned will still | |||
| don't intersect, the intersection coordinates returned will still | |||
| be valid | |||
| */ | |||
| bool intersects (const Line& line, Point<ValueType>& intersection) const noexcept | |||
| @@ -22,7 +22,7 @@ | |||
| ============================================================================== | |||
| */ | |||
| // tests that some co-ords aren't NaNs | |||
| // tests that some coordinates aren't NaNs | |||
| #define JUCE_CHECK_COORDS_ARE_VALID(x, y) \ | |||
| jassert (x == x && y == y); | |||
| @@ -190,7 +190,7 @@ public: | |||
| /** Begins a new subpath with a given starting position. | |||
| This will move the path's current position to the co-ordinates passed in and | |||
| This will move the path's current position to the coordinates passed in and | |||
| make it ready to draw lines or curves starting from this position. | |||
| After adding whatever lines and curves are needed, you can either | |||
| @@ -203,7 +203,7 @@ public: | |||
| /** Begins a new subpath with a given starting position. | |||
| This will move the path's current position to the co-ordinates passed in and | |||
| This will move the path's current position to the coordinates passed in and | |||
| make it ready to draw lines or curves starting from this position. | |||
| After adding whatever lines and curves are needed, you can either | |||
| @@ -30,7 +30,7 @@ | |||
| //============================================================================== | |||
| /** | |||
| A pair of (x, y) co-ordinates. | |||
| A pair of (x, y) coordinates. | |||
| The ValueType template should be a primitive type such as int, float, double, | |||
| rather than a class. | |||
| @@ -41,92 +41,106 @@ template <typename ValueType> | |||
| class Point | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| /** Creates a point with co-ordinates (0, 0). */ | |||
| /** Creates a point at the origin */ | |||
| Point() noexcept : x(), y() {} | |||
| /** Creates a copy of another point. */ | |||
| Point (const Point& other) noexcept : x (other.x), y (other.y) {} | |||
| /** Creates a point from an (x, y) position. */ | |||
| Point (const ValueType initialX, const ValueType initialY) noexcept : x (initialX), y (initialY) {} | |||
| Point (ValueType initialX, ValueType initialY) noexcept : x (initialX), y (initialY) {} | |||
| //============================================================================== | |||
| /** Copies this point from another one. */ | |||
| Point& operator= (const Point& other) noexcept { x = other.x; y = other.y; return *this; } | |||
| Point& operator= (const Point& other) noexcept { x = other.x; y = other.y; return *this; } | |||
| inline bool operator== (Point other) const noexcept { return x == other.x && y == other.y; } | |||
| inline bool operator!= (Point other) const noexcept { return x != other.x || y != other.y; } | |||
| inline bool operator== (Point other) const noexcept { return x == other.x && y == other.y; } | |||
| inline bool operator!= (Point other) const noexcept { return x != other.x || y != other.y; } | |||
| /** Returns true if the point is (0, 0). */ | |||
| bool isOrigin() const noexcept { return x == ValueType() && y == ValueType(); } | |||
| bool isOrigin() const noexcept { return x == ValueType() && y == ValueType(); } | |||
| /** Returns the point's x co-ordinate. */ | |||
| inline ValueType getX() const noexcept { return x; } | |||
| /** Returns the point's x coordinate. */ | |||
| inline ValueType getX() const noexcept { return x; } | |||
| /** Returns the point's y co-ordinate. */ | |||
| inline ValueType getY() const noexcept { return y; } | |||
| /** Returns the point's y coordinate. */ | |||
| inline ValueType getY() const noexcept { return y; } | |||
| /** Sets the point's x co-ordinate. */ | |||
| inline void setX (const ValueType newX) noexcept { x = newX; } | |||
| /** Sets the point's x coordinate. */ | |||
| inline void setX (ValueType newX) noexcept { x = newX; } | |||
| /** Sets the point's y co-ordinate. */ | |||
| inline void setY (const ValueType newY) noexcept { y = newY; } | |||
| /** Sets the point's y coordinate. */ | |||
| inline void setY (ValueType newY) noexcept { y = newY; } | |||
| /** Returns a point which has the same Y position as this one, but a new X. */ | |||
| Point withX (const ValueType newX) const noexcept { return Point (newX, y); } | |||
| Point withX (ValueType newX) const noexcept { return Point (newX, y); } | |||
| /** Returns a point which has the same X position as this one, but a new Y. */ | |||
| Point withY (const ValueType newY) const noexcept { return Point (x, newY); } | |||
| Point withY (ValueType newY) const noexcept { return Point (x, newY); } | |||
| /** Changes the point's x and y co-ordinates. */ | |||
| void setXY (const ValueType newX, const ValueType newY) noexcept { x = newX; y = newY; } | |||
| /** Changes the point's x and y coordinates. */ | |||
| void setXY (ValueType newX, ValueType newY) noexcept { x = newX; y = newY; } | |||
| /** Adds a pair of co-ordinates to this value. */ | |||
| void addXY (const ValueType xToAdd, const ValueType yToAdd) noexcept { x += xToAdd; y += yToAdd; } | |||
| /** Adds a pair of coordinates to this value. */ | |||
| void addXY (ValueType xToAdd, ValueType yToAdd) noexcept { x += xToAdd; y += yToAdd; } | |||
| //============================================================================== | |||
| /** Returns a point with a given offset from this one. */ | |||
| Point translated (const ValueType xDelta, const ValueType yDelta) const noexcept { return Point (x + xDelta, y + yDelta); } | |||
| Point translated (ValueType deltaX, ValueType deltaY) const noexcept { return Point (x + deltaX, y + deltaY); } | |||
| /** Adds two points together */ | |||
| Point operator+ (Point other) const noexcept { return Point (x + other.x, y + other.y); } | |||
| /** Adds another point's coordinates to this one */ | |||
| Point& operator+= (Point other) noexcept { x += other.x; y += other.y; return *this; } | |||
| /** Adds two points together. */ | |||
| Point operator+ (Point other) const noexcept { return Point (x + other.x, y + other.y); } | |||
| /** Subtracts one points from another */ | |||
| Point operator- (Point other) const noexcept { return Point (x - other.x, y - other.y); } | |||
| /** Adds another point's co-ordinates to this one. */ | |||
| Point& operator+= (Point other) noexcept { x += other.x; y += other.y; return *this; } | |||
| /** Subtracts another point's coordinates to this one */ | |||
| Point& operator-= (Point other) noexcept { x -= other.x; y -= other.y; return *this; } | |||
| /** Subtracts one points from another. */ | |||
| Point operator- (Point other) const noexcept { return Point (x - other.x, y - other.y); } | |||
| /** Multiplies two points together */ | |||
| Point operator* (Point other) const noexcept { return Point (x * other.x, y * other.y); } | |||
| /** Subtracts another point's co-ordinates to this one. */ | |||
| Point& operator-= (Point other) noexcept { x -= other.x; y -= other.y; return *this; } | |||
| /** Multiplies another point's coordinates to this one */ | |||
| Point& operator*= (Point other) noexcept { x *= other.x; y *= other.y; return *this; } | |||
| /** Divides one points from another */ | |||
| Point operator/ (Point other) const noexcept { return Point (x / other.x, y / other.y); } | |||
| /** Divides another point's coordinates to this one */ | |||
| Point& operator/= (Point other) noexcept { x /= other.x; y /= other.y; return *this; } | |||
| /** Returns a point whose coordinates are multiplied by a given value. */ | |||
| template <typename FloatType> | |||
| Point operator* (const FloatType multiplier) const noexcept { return Point ((ValueType) (x * multiplier), (ValueType) (y * multiplier)); } | |||
| Point operator* (FloatType multiplier) const noexcept { return Point ((ValueType) (x * multiplier), (ValueType) (y * multiplier)); } | |||
| /** Returns a point whose coordinates are divided by a given value. */ | |||
| template <typename FloatType> | |||
| Point operator/ (const FloatType divisor) const noexcept { return Point ((ValueType) (x / divisor), (ValueType) (y / divisor)); } | |||
| Point operator/ (FloatType divisor) const noexcept { return Point ((ValueType) (x / divisor), (ValueType) (y / divisor)); } | |||
| /** Multiplies the point's co-ordinates by a value. */ | |||
| /** Multiplies the point's coordinates by a value. */ | |||
| template <typename FloatType> | |||
| Point& operator*= (const FloatType multiplier) noexcept { x = (ValueType) (x * multiplier); y = (ValueType) (y * multiplier); return *this; } | |||
| Point& operator*= (FloatType multiplier) noexcept { x = (ValueType) (x * multiplier); y = (ValueType) (y * multiplier); return *this; } | |||
| /** Divides the point's co-ordinates by a value. */ | |||
| /** Divides the point's coordinates by a value. */ | |||
| template <typename FloatType> | |||
| Point& operator/= (const FloatType divisor) noexcept { x = (ValueType) (x / divisor); y = (ValueType) (y / divisor); return *this; } | |||
| Point& operator/= (FloatType divisor) noexcept { x = (ValueType) (x / divisor); y = (ValueType) (y / divisor); return *this; } | |||
| /** Returns the inverse of this point. */ | |||
| Point operator-() const noexcept { return Point (-x, -y); } | |||
| Point operator-() const noexcept { return Point (-x, -y); } | |||
| //============================================================================== | |||
| /** This type will be double if the Point's type is double, otherwise it will be float. */ | |||
| typedef typename TypeHelpers::SmallestFloatType<ValueType>::type FloatType; | |||
| //============================================================================== | |||
| /** Returns the straight-line distance between this point and the origin. */ | |||
| ValueType getDistanceFromOrigin() const noexcept { return juce_hypot (x, y); } | |||
| ValueType getDistanceFromOrigin() const noexcept { return juce_hypot (x, y); } | |||
| /** Returns the straight-line distance between this point and another one. */ | |||
| ValueType getDistanceFrom (Point other) const noexcept { return juce_hypot (x - other.x, y - other.y); } | |||
| /** This type will be double if the Point's type is double, otherwise it will be float. */ | |||
| typedef typename TypeHelpers::SmallestFloatType<ValueType>::type FloatType; | |||
| ValueType getDistanceFrom (Point other) const noexcept { return juce_hypot (x - other.x, y - other.y); } | |||
| /** Returns the angle from this point to another one. | |||
| @@ -134,39 +148,59 @@ public: | |||
| where this point is the centre and the other point is on the circumference. | |||
| */ | |||
| FloatType getAngleToPoint (Point other) const noexcept | |||
| { return static_cast<FloatType> (std::atan2 (other.x - x, y - other.y)); } | |||
| { | |||
| return static_cast<FloatType> (std::atan2 (other.x - x, y - other.y)); | |||
| } | |||
| /** Returns the point that would be reached by rotating this point clockwise | |||
| about the origin by the specified angle. | |||
| */ | |||
| Point rotatedAboutOrigin (ValueType angleRadians) const noexcept | |||
| { | |||
| return Point (x * std::cos (angleRadians) - y * std::sin (angleRadians), | |||
| x * std::sin (angleRadians) + y * std::cos (angleRadians)); | |||
| } | |||
| /** Taking this point to be the centre of a circle, this returns a point on its circumference. | |||
| @param radius the radius of the circle. | |||
| @param angle the angle of the point, in radians clockwise from the 12 o'clock position. | |||
| */ | |||
| Point<FloatType> getPointOnCircumference (const float radius, const float angle) const noexcept | |||
| { return Point<FloatType> (static_cast <FloatType> (x + radius * std::sin (angle)), | |||
| static_cast <FloatType> (y - radius * std::cos (angle))); } | |||
| Point<FloatType> getPointOnCircumference (float radius, float angle) const noexcept | |||
| { | |||
| return Point<FloatType> (static_cast <FloatType> (x + radius * std::sin (angle)), | |||
| static_cast <FloatType> (y - radius * std::cos (angle))); | |||
| } | |||
| /** Taking this point to be the centre of an ellipse, this returns a point on its circumference. | |||
| @param radiusX the horizontal radius of the circle. | |||
| @param radiusY the vertical radius of the circle. | |||
| @param angle the angle of the point, in radians clockwise from the 12 o'clock position. | |||
| */ | |||
| Point<FloatType> getPointOnCircumference (const float radiusX, const float radiusY, const float angle) const noexcept | |||
| { return Point<FloatType> (static_cast <FloatType> (x + radiusX * std::sin (angle)), | |||
| static_cast <FloatType> (y - radiusY * std::cos (angle))); } | |||
| Point<FloatType> getPointOnCircumference (float radiusX, float radiusY, float angle) const noexcept | |||
| { | |||
| return Point<FloatType> (static_cast <FloatType> (x + radiusX * std::sin (angle)), | |||
| static_cast <FloatType> (y - radiusY * std::cos (angle))); | |||
| } | |||
| /** Returns the dot-product of two points (x1 * x2 + y1 * y2). */ | |||
| FloatType getDotProduct (Point other) const noexcept { return x * other.x + y * other.y; } | |||
| /** Uses a transform to change the point's co-ordinates. | |||
| //============================================================================== | |||
| /** Uses a transform to change the point's coordinates. | |||
| This will only compile if ValueType = float! | |||
| @see AffineTransform::transformPoint | |||
| */ | |||
| void applyTransform (const AffineTransform& transform) noexcept { transform.transformPoint (x, y); } | |||
| /** Returns the position of this point, if it is transformed by a given AffineTransform. */ | |||
| Point transformedBy (const AffineTransform& transform) const noexcept | |||
| { return Point (transform.mat00 * x + transform.mat01 * y + transform.mat02, | |||
| transform.mat10 * x + transform.mat11 * y + transform.mat12); } | |||
| /** Returns the dot-product of two points (x1 * x2 + y1 * y2). */ | |||
| FloatType getDotProduct (Point other) const noexcept { return x * other.x + y * other.y; } | |||
| { | |||
| return Point (transform.mat00 * x + transform.mat01 * y + transform.mat02, | |||
| transform.mat10 * x + transform.mat11 * y + transform.mat12); | |||
| } | |||
| //============================================================================== | |||
| /** Casts this point to a Point<int> object. */ | |||
| Point<int> toInt() const noexcept { return Point<int> (static_cast <int> (x), static_cast<int> (y)); } | |||
| @@ -41,7 +41,7 @@ class Rectangle | |||
| public: | |||
| //============================================================================== | |||
| /** Creates a rectangle of zero size. | |||
| The default co-ordinates will be (0, 0, 0, 0). | |||
| The default coordinates will be (0, 0, 0, 0). | |||
| */ | |||
| Rectangle() noexcept | |||
| : w(), h() | |||
| @@ -103,10 +103,10 @@ public: | |||
| /** Returns true if the rectangle's width and height are both zero or less */ | |||
| bool isEmpty() const noexcept { return w <= ValueType() || h <= ValueType(); } | |||
| /** Returns the x co-ordinate of the rectangle's left-hand-side. */ | |||
| /** Returns the x coordinate of the rectangle's left-hand-side. */ | |||
| inline ValueType getX() const noexcept { return pos.x; } | |||
| /** Returns the y co-ordinate of the rectangle's top edge. */ | |||
| /** Returns the y coordinate of the rectangle's top edge. */ | |||
| inline ValueType getY() const noexcept { return pos.y; } | |||
| /** Returns the width of the rectangle. */ | |||
| @@ -115,16 +115,16 @@ public: | |||
| /** Returns the height of the rectangle. */ | |||
| inline ValueType getHeight() const noexcept { return h; } | |||
| /** Returns the x co-ordinate of the rectangle's right-hand-side. */ | |||
| /** Returns the x coordinate of the rectangle's right-hand-side. */ | |||
| inline ValueType getRight() const noexcept { return pos.x + w; } | |||
| /** Returns the y co-ordinate of the rectangle's bottom edge. */ | |||
| /** Returns the y coordinate of the rectangle's bottom edge. */ | |||
| inline ValueType getBottom() const noexcept { return pos.y + h; } | |||
| /** Returns the x co-ordinate of the rectangle's centre. */ | |||
| /** Returns the x coordinate of the rectangle's centre. */ | |||
| ValueType getCentreX() const noexcept { return pos.x + w / (ValueType) 2; } | |||
| /** Returns the y co-ordinate of the rectangle's centre. */ | |||
| /** Returns the y coordinate of the rectangle's centre. */ | |||
| ValueType getCentreY() const noexcept { return pos.y + h / (ValueType) 2; } | |||
| /** Returns the centre point of the rectangle. */ | |||
| @@ -161,7 +161,7 @@ public: | |||
| /** Changes the rectangle's size, leaving the position of its top-left corner unchanged. */ | |||
| void setSize (const ValueType newWidth, const ValueType newHeight) noexcept { w = newWidth; h = newHeight; } | |||
| /** Changes all the rectangle's co-ordinates. */ | |||
| /** Changes all the rectangle's coordinates. */ | |||
| void setBounds (const ValueType newX, const ValueType newY, | |||
| const ValueType newWidth, const ValueType newHeight) noexcept { pos.x = newX; pos.y = newY; w = newWidth; h = newHeight; } | |||
| @@ -250,7 +250,7 @@ public: | |||
| Rectangle withBottom (const ValueType newBottom) const noexcept { return Rectangle (pos.x, jmin (pos.y, newBottom), w, jmax (ValueType(), newBottom - pos.y)); } | |||
| //============================================================================== | |||
| /** Moves the rectangle's position by adding amount to its x and y co-ordinates. */ | |||
| /** Moves the rectangle's position by adding amount to its x and y coordinates. */ | |||
| void translate (const ValueType deltaX, | |||
| const ValueType deltaY) noexcept | |||
| { | |||
| @@ -465,13 +465,13 @@ public: | |||
| /** Returns true if the two rectangles are not identical. */ | |||
| bool operator!= (const Rectangle& other) const noexcept { return pos != other.pos || w != other.w || h != other.h; } | |||
| /** Returns true if this co-ordinate is inside the rectangle. */ | |||
| /** Returns true if this coordinate is inside the rectangle. */ | |||
| bool contains (const ValueType xCoord, const ValueType yCoord) const noexcept | |||
| { | |||
| return xCoord >= pos.x && yCoord >= pos.y && xCoord < pos.x + w && yCoord < pos.y + h; | |||
| } | |||
| /** Returns true if this co-ordinate is inside the rectangle. */ | |||
| /** Returns true if this coordinate is inside the rectangle. */ | |||
| bool contains (const Point<ValueType> point) const noexcept | |||
| { | |||
| return point.x >= pos.x && point.y >= pos.y && point.x < pos.x + w && point.y < pos.y + h; | |||
| @@ -725,7 +725,7 @@ public: | |||
| } | |||
| //============================================================================== | |||
| /** Static utility to intersect two sets of rectangular co-ordinates. | |||
| /** Static utility to intersect two sets of rectangular coordinates. | |||
| Returns false if the two regions didn't overlap. | |||
| @see intersectRectangle | |||
| */ | |||
| @@ -208,10 +208,10 @@ public: | |||
| */ | |||
| void consolidate(); | |||
| /** Adds an x and y value to all the co-ordinates. */ | |||
| /** Adds an x and y value to all the coordinates. */ | |||
| void offsetAll (int dx, int dy) noexcept; | |||
| /** Scales all the co-ordinates. */ | |||
| /** Scales all the coordinates. */ | |||
| template <typename ScaleType> | |||
| void scaleAll (ScaleType scaleFactor) noexcept | |||
| { | |||
| @@ -244,7 +244,7 @@ public: | |||
| //============================================================================== | |||
| /** Returns the colour of one of the pixels in the image. | |||
| If the co-ordinates given are beyond the image's boundaries, this will | |||
| If the coordinates given are beyond the image's boundaries, this will | |||
| return Colours::transparentBlack. | |||
| @see setPixelAt, Image::BitmapData::getPixelColour | |||
| @@ -253,7 +253,7 @@ public: | |||
| /** Sets the colour of one of the image's pixels. | |||
| If the co-ordinates are beyond the image's boundaries, then nothing will happen. | |||
| If the coordinates are beyond the image's boundaries, then nothing will happen. | |||
| Note that this won't do any alpha-blending, it'll just replace the existing pixel | |||
| with the given one. The colour's opacity will be ignored if this image doesn't have | |||
| @@ -266,10 +266,10 @@ public: | |||
| /** Changes the opacity of a pixel. | |||
| This only has an effect if the image has an alpha channel and if the | |||
| given co-ordinates are inside the image's boundary. | |||
| given coordinates are inside the image's boundary. | |||
| The multiplier must be in the range 0 to 1.0, and the current alpha | |||
| at the given co-ordinates will be multiplied by this value. | |||
| at the given coordinates will be multiplied by this value. | |||
| @see setPixelAt | |||
| */ | |||
| @@ -322,13 +322,13 @@ public: | |||
| ~BitmapData(); | |||
| /** Returns a pointer to the start of a line in the image. | |||
| The co-ordinate you provide here isn't checked, so it's the caller's responsibility to make | |||
| The coordinate you provide here isn't checked, so it's the caller's responsibility to make | |||
| sure it's not out-of-range. | |||
| */ | |||
| inline uint8* getLinePointer (int y) const noexcept { return data + y * lineStride; } | |||
| /** Returns a pointer to a pixel in the image. | |||
| The co-ordinates you give here are not checked, so it's the caller's responsibility to make sure they're | |||
| The coordinates you give here are not checked, so it's the caller's responsibility to make sure they're | |||
| not out-of-range. | |||
| */ | |||
| inline uint8* getPixelPointer (int x, int y) const noexcept { return data + y * lineStride + x * pixelStride; } | |||
| @@ -520,8 +520,8 @@ void CoreGraphicsContext::drawVerticalLine (const int x, float top, float bottom | |||
| #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 | |||
| CGContextFillRect (context, CGRectMake (x, flipHeight - bottom, 1.0f, bottom - top)); | |||
| #else | |||
| // On Leopard, unless both co-ordinates are non-integer, it disables anti-aliasing, so nudge | |||
| // the x co-ord slightly to trick it.. | |||
| // On Leopard, unless both coordinates are non-integer, it disables anti-aliasing, so nudge | |||
| // the x coordinate slightly to trick it.. | |||
| CGContextFillRect (context, CGRectMake (x + 1.0f / 256.0f, flipHeight - bottom, 1.0f + 1.0f / 256.0f, bottom - top)); | |||
| #endif | |||
| } | |||
| @@ -538,8 +538,8 @@ void CoreGraphicsContext::drawHorizontalLine (const int y, float left, float rig | |||
| #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 | |||
| CGContextFillRect (context, CGRectMake (left, flipHeight - (y + 1.0f), right - left, 1.0f)); | |||
| #else | |||
| // On Leopard, unless both co-ordinates are non-integer, it disables anti-aliasing, so nudge | |||
| // the x co-ord slightly to trick it.. | |||
| // On Leopard, unless both coordinates are non-integer, it disables anti-aliasing, so nudge | |||
| // the x coordinate slightly to trick it.. | |||
| CGContextFillRect (context, CGRectMake (left, flipHeight - (y + (1.0f + 1.0f / 256.0f)), right - left, 1.0f + 1.0f / 256.0f)); | |||
| #endif | |||
| } | |||
| @@ -131,7 +131,7 @@ public: | |||
| //============================================================================== | |||
| /** Adjusts the position and size of a rectangle to fit it into a space. | |||
| The source rectangle co-ordinates will be adjusted so that they fit into | |||
| The source rectangle coordinates will be adjusted so that they fit into | |||
| the destination rectangle based on this object's flags. | |||
| */ | |||
| void applyTo (double& sourceX, | |||
| @@ -157,7 +157,7 @@ public: | |||
| static_cast <ValueType> (w), static_cast <ValueType> (h)); | |||
| } | |||
| /** Returns the transform that should be applied to these source co-ordinates to fit them | |||
| /** Returns the transform that should be applied to these source coordinates to fit them | |||
| into the destination rectangle using the current flags. | |||
| */ | |||
| AffineTransform getTransformToFit (const Rectangle<float>& source, | |||
| @@ -67,7 +67,7 @@ public: | |||
| //============================================================================== | |||
| /** Returns the mouse position. | |||
| The co-ordinates are relative to the top-left of the main monitor. | |||
| The coordinates are relative to the top-left of the main monitor. | |||
| Note that this is just a shortcut for calling getMainMouseSource().getScreenPosition(), and | |||
| you should only resort to grabbing the global mouse position if there's really no | |||
| @@ -76,7 +76,7 @@ public: | |||
| static Point<int> getMousePosition(); | |||
| /** Makes the mouse pointer jump to a given location. | |||
| The co-ordinates are relative to the top-left of the main monitor. | |||
| The coordinates are relative to the top-left of the main monitor. | |||
| */ | |||
| static void setMousePosition (Point<int> newPosition); | |||
| @@ -199,7 +199,7 @@ public: | |||
| This will drill down into top-level windows to find the child component at | |||
| the given position. | |||
| Returns nullptr if the co-ordinates are inside a non-Juce window. | |||
| Returns nullptr if the coordinates are inside a non-Juce window. | |||
| */ | |||
| Component* findComponentAt (Point<int> screenPosition) const; | |||
| @@ -73,7 +73,7 @@ public: | |||
| /** Renders the Drawable at a given offset within the Graphics context. | |||
| The co-ordinates passed-in are used to translate the object relative to its own | |||
| The coordinates passed-in are used to translate the object relative to its own | |||
| origin before drawing it - this is basically a quick way of saying: | |||
| @code | |||
| @@ -139,7 +139,7 @@ public: | |||
| //============================================================================== | |||
| /** This callback changes the given co-ordinates to impose whatever the current | |||
| /** This callback changes the given coordinates to impose whatever the current | |||
| constraints are set to be. | |||
| @param bounds the target position that should be examined and adjusted | |||
| @@ -259,7 +259,7 @@ public: | |||
| @param width the width of the thumb area to draw in | |||
| @param height the height of the thumb area to draw in | |||
| @param isScrollbarVertical true if it's a vertical bar, false if horizontal | |||
| @param thumbStartPosition for vertical bars, the y co-ordinate of the top of the | |||
| @param thumbStartPosition for vertical bars, the y coordinate of the top of the | |||
| thumb, or its x position for horizontal bars | |||
| @param thumbSize for vertical bars, the height of the thumb, or its width for | |||
| horizontal bars. This may be 0 if the thumb shouldn't be drawn. | |||
| @@ -287,7 +287,7 @@ public: | |||
| /** Displays the menu at a specific location. | |||
| This is the same as show(), but uses a specific location (in global screen | |||
| co-ordinates) rather than the current mouse position. | |||
| coordinates) rather than the current mouse position. | |||
| The screenAreaToAttachTo parameter indicates a screen area to which the menu | |||
| will be adjacent. Depending on where this is, the menu will decide which edge to | |||
| @@ -57,7 +57,7 @@ public: | |||
| ~BubbleComponent(); | |||
| //============================================================================== | |||
| /** A list of permitted placements for the bubble, relative to the co-ordinates | |||
| /** A list of permitted placements for the bubble, relative to the coordinates | |||
| at which it should be pointing. | |||
| @see setAllowedPlacement | |||
| @@ -99,9 +99,9 @@ public: | |||
| /** Moves and resizes the bubble to point at a given point. | |||
| This will resize the bubble to fit its content, then position it | |||
| so that the tip of the bubble points to the given co-ordinate. The co-ordinates | |||
| so that the tip of the bubble points to the given coordinate. The coordinates | |||
| are relative to either the bubble component's parent component if it has one, or | |||
| they are screen co-ordinates if not. | |||
| they are screen coordinates if not. | |||
| It'll put itself either above, below, or to the side of this point, depending | |||
| on where there's the most space, honouring any restrictions that were set | |||
| @@ -113,8 +113,8 @@ public: | |||
| This will resize the bubble to fit its content, then find a position for it | |||
| so that it's next to, but doesn't overlap the given rectangle. The rectangle's | |||
| co-ordinates are relative to either the bubble component's parent component | |||
| if it has one, or they are screen co-ordinates if not. | |||
| coordinates are relative to either the bubble component's parent component | |||
| if it has one, or they are screen coordinates if not. | |||
| It'll put itself either above, below, or to the side of the component depending | |||
| on where there's the most space, honouring any restrictions that were set | |||
| @@ -50,7 +50,7 @@ public: | |||
| Your implementation of this method must find all the relevent items that lie | |||
| within the given rectangle. and add them to the itemsFound array. | |||
| The co-ordinates are relative to the top-left of the lasso component's parent | |||
| The coordinates are relative to the top-left of the lasso component's parent | |||
| component. (i.e. they are the same as the size and position of the lasso | |||
| component itself). | |||
| */ | |||
| @@ -133,25 +133,25 @@ public: | |||
| MouseInputSource& source; | |||
| //============================================================================== | |||
| /** Returns the x co-ordinate of the last place that a mouse was pressed. | |||
| /** Returns the x coordinate of the last place that a mouse was pressed. | |||
| The co-ordinate is relative to the component specified in MouseEvent::component. | |||
| The coordinate is relative to the component specified in MouseEvent::component. | |||
| @see getDistanceFromDragStart, getDistanceFromDragStartX, mouseWasClicked | |||
| */ | |||
| int getMouseDownX() const noexcept; | |||
| /** Returns the y co-ordinate of the last place that a mouse was pressed. | |||
| /** Returns the y coordinate of the last place that a mouse was pressed. | |||
| The co-ordinate is relative to the component specified in MouseEvent::component. | |||
| The coordinate is relative to the component specified in MouseEvent::component. | |||
| @see getDistanceFromDragStart, getDistanceFromDragStartX, mouseWasClicked | |||
| */ | |||
| int getMouseDownY() const noexcept; | |||
| /** Returns the co-ordinates of the last place that a mouse was pressed. | |||
| /** Returns the coordinates of the last place that a mouse was pressed. | |||
| The co-ordinates are relative to the component specified in MouseEvent::component. | |||
| The coordinates are relative to the component specified in MouseEvent::component. | |||
| @see getDistanceFromDragStart, getDistanceFromDragStartX, mouseWasClicked | |||
| */ | |||
| @@ -228,50 +228,38 @@ public: | |||
| */ | |||
| Point<int> getPosition() const noexcept; | |||
| /** Returns the mouse x position of this event, in global screen co-ordinates. | |||
| The co-ordinates are relative to the top-left of the main monitor. | |||
| /** Returns the mouse x position of this event, in global screen coordinates. | |||
| The coordinates are relative to the top-left of the main monitor. | |||
| @see getScreenPosition | |||
| */ | |||
| int getScreenX() const; | |||
| /** Returns the mouse y position of this event, in global screen co-ordinates. | |||
| The co-ordinates are relative to the top-left of the main monitor. | |||
| /** Returns the mouse y position of this event, in global screen coordinates. | |||
| The coordinates are relative to the top-left of the main monitor. | |||
| @see getScreenPosition | |||
| */ | |||
| int getScreenY() const; | |||
| /** Returns the mouse position of this event, in global screen co-ordinates. | |||
| The co-ordinates are relative to the top-left of the main monitor. | |||
| /** Returns the mouse position of this event, in global screen coordinates. | |||
| The coordinates are relative to the top-left of the main monitor. | |||
| @see getMouseDownScreenPosition | |||
| */ | |||
| Point<int> getScreenPosition() const; | |||
| /** Returns the x co-ordinate at which the mouse button was last pressed. | |||
| The co-ordinates are relative to the top-left of the main monitor. | |||
| /** Returns the x coordinate at which the mouse button was last pressed. | |||
| The coordinates are relative to the top-left of the main monitor. | |||
| @see getMouseDownScreenPosition | |||
| */ | |||
| int getMouseDownScreenX() const; | |||
| /** Returns the y co-ordinate at which the mouse button was last pressed. | |||
| The co-ordinates are relative to the top-left of the main monitor. | |||
| /** Returns the y coordinate at which the mouse button was last pressed. | |||
| The coordinates are relative to the top-left of the main monitor. | |||
| @see getMouseDownScreenPosition | |||
| */ | |||
| int getMouseDownScreenY() const; | |||
| /** Returns the co-ordinates at which the mouse button was last pressed. | |||
| The co-ordinates are relative to the top-left of the main monitor. | |||
| /** Returns the coordinates at which the mouse button was last pressed. | |||
| The coordinates are relative to the top-left of the main monitor. | |||
| @see getScreenPosition | |||
| */ | |||
| Point<int> getMouseDownScreenPosition() const; | |||
| @@ -149,7 +149,7 @@ public: | |||
| Calling this method when the mouse button is currently pressed will remove the cursor | |||
| from the screen and allow the mouse to (seem to) move beyond the edges of the screen. | |||
| This means that the co-ordinates returned to mouseDrag() will be unbounded, and this | |||
| This means that the coordinates returned to mouseDrag() will be unbounded, and this | |||
| can be used for things like custom slider controls or dragging objects around, where | |||
| movement would be otherwise be limited by the mouse hitting the edges of the screen. | |||
| @@ -269,11 +269,11 @@ public: | |||
| /** Returns the position of one of the cells in the table. | |||
| If relativeToComponentTopLeft is true, the co-ordinates are relative to | |||
| If relativeToComponentTopLeft is true, the coordinates are relative to | |||
| the table component's top-left. The row number isn't checked to see if it's | |||
| in-range, but the column ID must exist or this will return an empty rectangle. | |||
| If relativeToComponentTopLeft is false, the co-ords are relative to the | |||
| If relativeToComponentTopLeft is false, the coordinates are relative to the | |||
| top-left of the table's top-left cell. | |||
| */ | |||
| Rectangle<int> getCellPosition (int columnId, int rowNumber, | |||
| @@ -420,7 +420,7 @@ public: | |||
| String getHighlightedText() const; | |||
| /** Finds the index of the character at a given position. | |||
| The co-ordinates are relative to the component's top-left. | |||
| The coordinates are relative to the component's top-left. | |||
| */ | |||
| int getTextIndexAt (int x, int y); | |||
| @@ -150,7 +150,7 @@ public: | |||
| /** Returns the rectangle that this item occupies. | |||
| If relativeToTreeViewTopLeft is true, the co-ordinates are relative to the | |||
| If relativeToTreeViewTopLeft is true, the coordinates are relative to the | |||
| top-left of the TreeView comp, so this will depend on the scroll-position of | |||
| the tree. If false, it is relative to the top-left of the topmost item in the | |||
| tree (so this would be unaffected by scrolling the view). | |||
| @@ -136,7 +136,7 @@ public: | |||
| //============================================================================== | |||
| /** Moves and resizes the window. | |||
| If the native window is contained in another window, then the co-ordinates are | |||
| If the native window is contained in another window, then the coordinates are | |||
| relative to the parent window's origin, not the screen origin. | |||
| This should result in a callback to handleMovedOrResized(). | |||
| @@ -145,18 +145,18 @@ public: | |||
| /** Returns the current position and size of the window. | |||
| If the native window is contained in another window, then the co-ordinates are | |||
| If the native window is contained in another window, then the coordinates are | |||
| relative to the parent window's origin, not the screen origin. | |||
| */ | |||
| virtual Rectangle<int> getBounds() const = 0; | |||
| /** Converts a position relative to the top-left of this component to screen co-ordinates. */ | |||
| /** Converts a position relative to the top-left of this component to screen coordinates. */ | |||
| virtual Point<int> localToGlobal (const Point<int>& relativePosition) = 0; | |||
| /** Converts a rectangle relative to the top-left of this component to screen co-ordinates. */ | |||
| /** Converts a rectangle relative to the top-left of this component to screen coordinates. */ | |||
| virtual Rectangle<int> localToGlobal (const Rectangle<int>& relativePosition); | |||
| /** Converts a screen co-ordinate to a position relative to the top-left of this component. */ | |||
| /** Converts a screen coordinate to a position relative to the top-left of this component. */ | |||
| virtual Point<int> globalToLocal (const Point<int>& screenPosition) = 0; | |||
| /** Converts a screen area to a position relative to the top-left of this component. */ | |||
| @@ -105,7 +105,7 @@ public: | |||
| Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const; | |||
| /** Finds the character at a given on-screen position. | |||
| The co-ordinates are relative to this component's top-left origin. | |||
| The coordinates are relative to this component's top-left origin. | |||
| */ | |||
| CodeDocument::Position getPositionAt (int x, int y); | |||
| @@ -59,7 +59,7 @@ public: | |||
| /** Shows a message bubble at a particular position. | |||
| This shows the bubble with its stem pointing to the given location | |||
| (co-ordinates being relative to its parent component). | |||
| (coordinates being relative to its parent component). | |||
| For details about exactly how it decides where to position itself, see | |||
| BubbleComponent::updatePosition(). | |||
| @@ -50,7 +50,7 @@ public: | |||
| // The ComponentMovementWatcher version of this method avoids calling | |||
| // us when the top-level comp is resized, but for an NSView we need to know this | |||
| // because with inverted co-ords, we need to update the position even if the | |||
| // because with inverted coordinates, we need to update the position even if the | |||
| // top-left pos hasn't changed | |||
| if (comp.isOnDesktop() && wasResized) | |||
| componentMovedOrResized (wasMoved, wasResized); | |||