Inherited by fltk::Monitor, and fltk::Widget.
Public Member Functions | |
int | b () const |
int | baseline_y () const |
int | center_x () const |
int | center_y () const |
bool | contains (int x, int y) const |
bool | empty () const |
void | h (int v) |
int | h () const |
void | inset (int d) |
void | intersect (const Rectangle &r) |
void | merge (const Rectangle &r) |
void | move (int dx, int dy) |
void | move_b (int d) |
void | move_r (int d) |
void | move_x (int d) |
void | move_y (int d) |
bool | not_empty () const |
int | r () const |
Rectangle (const Rectangle &r, int w, int h, int flags=0) | |
Rectangle (const Rectangle &r) | |
Rectangle () | |
Rectangle (int x, int y, int w, int h) | |
Rectangle (int w, int h) | |
void | set (int x, int y, int w, int h) |
void | set (const Rectangle &r, int w, int h, int flags=0) |
void | set_b (int v) |
void | set_r (int v) |
void | set_x (int v) |
void | set_y (int v) |
void | w (int v) |
int | w () const |
int | x () const |
void | x (int v) |
void | y (int v) |
int | y () const |
Describes an integer-sized rectangle. This is the base class of Widget, and also used a lot to pass rectangular areas to drawing functions. Almost all the functions are inline.
Negative w() or h() is supposed to mean an empty and thus invisible rectangle, but some code will treat the rectangle as reflected about x or y. Set the size to zero to make sure you have an empty one.
Rectangle::Rectangle | ( | ) | [inline] |
The default constructor does not put anything into the fields! You can either call set() or just modify the x_, y_, w_, and h_ variables directly.
fltk::Rectangle::Rectangle | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) | [inline] |
fltk::Rectangle::Rectangle | ( | int | w, |
int | h | ||
) | [inline] |
fltk::Rectangle::Rectangle | ( | const Rectangle & | r | ) | [inline] |
Copy constructor.
fltk::Rectangle::Rectangle | ( | const Rectangle & | r, |
int | w, | ||
int | h, | ||
int | flags = 0 |
||
) | [inline] |
Constructor that calls set().
int fltk::Rectangle::b | ( | ) | const [inline] |
Return y()+h(), the bottom edge of the rectangle.
int Rectangle::baseline_y | ( | ) | const |
Where to put baseline to center current font nicely
int fltk::Rectangle::center_x | ( | ) | const [inline] |
Integer center position. Rounded to the left if w() is odd.
int fltk::Rectangle::center_y | ( | ) | const [inline] |
Integer center position. Rounded to lower y if h() is odd.
bool fltk::Rectangle::contains | ( | int | x, |
int | y | ||
) | const [inline] |
True if rectangle contains the pixel who's upper-left corner is at x,y
void fltk::Rectangle::h | ( | int | v | ) | [inline] |
int fltk::Rectangle::h | ( | ) | const [inline] |
Distance between top and bottom edges
void fltk::Rectangle::inset | ( | int | d | ) | [inline] |
Move all edges in by d. See also Symbol::inset()
void fltk::Rectangle::intersect | ( | const Rectangle & | r | ) |
Replace the value with the intersection of this rectangle and R. If the rectangles do not intersect, the result may have negative width and/or height, this means empty() will return true, but some code may still draw this rectangle.
void fltk::Rectangle::merge | ( | const Rectangle & | r | ) |
Replace the value with the union of this rectangle and R (ie the rectangle that surrounds both of these rectangles). If one rectangle is empty(), the other is returned unchanged (ie it does not union in the degenerate point of that rectangle).
void fltk::Rectangle::move | ( | int | dx, |
int | dy | ||
) | [inline] |
Move entire rectangle by given distance in x and y.
void fltk::Rectangle::move_x | ( | int | d | ) | [inline] |
void fltk::Rectangle::move_y | ( | int | d | ) | [inline] |
bool fltk::Rectangle::not_empty | ( | ) | const [inline] |
int fltk::Rectangle::r | ( | ) | const [inline] |
Return x()+w(), the right edge of the rectangle.
void fltk::Rectangle::set | ( | const Rectangle & | r, |
int | w, | ||
int | h, | ||
int | flags = 0 |
||
) |
Sets x, y, w, h so that's it's centered or aligned (if flags!=0) inside the source r
Initialize to the size w,h. The rectangle is placed inside the source rectangle r either centered or against an edge depending on the ALIGN values in flags. For centered alignment if the difference in sizes is odd, it always rounds up and left. Default value for flags is to center in both directions.
void fltk::Rectangle::set | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) | [inline] |
void fltk::Rectangle::set_b | ( | int | v | ) | [inline] |
void fltk::Rectangle::set_r | ( | int | v | ) | [inline] |
void fltk::Rectangle::set_x | ( | int | v | ) | [inline] |
void fltk::Rectangle::set_y | ( | int | v | ) | [inline] |
int fltk::Rectangle::w | ( | ) | const [inline] |
Distance between left and right edges
int fltk::Rectangle::x | ( | ) | const [inline] |
Left edge
void fltk::Rectangle::x | ( | int | v | ) | [inline] |
Move the rectangle so the left edge is at v.
int fltk::Rectangle::y | ( | ) | const [inline] |
Top edge
void fltk::Rectangle::y | ( | int | v | ) | [inline] |
Move the rectangle so the top edge is at v.