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 (int w, int h) | |
Rectangle (int x, int y, int w, int h) | |
Rectangle () | |
void | set (const Rectangle &r, int w, int h, int flags=0) |
void | set (int x, int y, int w, int h) |
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 |
void | x (int v) |
int | x () const |
void | y (int v) |
int | y () const |
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.
Referenced by fltk::Item::draw(), fltk::Widget::draw_box(), fltk::Widget::draw_frame(), fltk::Menu::draw_in(), fltk::Tooltip::enter(), fltk::PopupMenu::popup(), and fltk::Menu::try_popup().
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::x | ( | ) | const [inline] |
Left edge
Referenced by fltk::TiledImage::_draw(), fltk::Image::_draw(), fltk::addchord(), fltk::addpie(), fltk::clipout(), fltk::CreatedWindow::create(), fltk::Window::destroy(), fltk::Slider::draw(), fltk::Item::draw(), fltk::Input::draw(), fltk::Image::draw(), fltk::Choice::draw(), fltk::Button::draw(), fltk::Widget::draw_background(), fltk::Group::draw_child(), fltk::Menu::draw_in(), fltk::Widget::draw_label(), fltk::Group::draw_outside_label(), fltk::Slider::draw_ticks(), fltk::drawtext(), fltk::fillpath(), fltk::fillstrokepath(), fltk::Monitor::find(), fltk::Menu::find_selected(), fltk::Group::fix_old_positions(), fltk::Window::flush(), fltk::Window::fullscreen(), fltk::Widget::get_absolute_rect(), fltk::glstart(), fltk::Slider::handle(), fltk::handle(), fltk::Group::handle(), fltk::Window::hotspot(), fltk::Symbol::inset(), intersect(), fltk::intersect_with_clip(), fltk::Tooltip::layout(), fltk::Group::layout(), fltk::Monitor::list(), fltk::Widget::make_current(), merge(), fltk::Input::mouse_position(), fltk::not_clipped(), fltk::TextDisplay::position_to_xy(), fltk::push_clip(), fltk::Widget::redraw(), fltk::Widget::resize(), fltk::scrollrect(), fltk::Widget::send(), set(), fltk::Image::setpixels(), fltk::Window::show(), fltk::Group::sizes(), fltk::strokepath(), fltk::Window::system_layout(), fltk::transform(), fltk::Menu::try_popup(), fltk::StatusBarGroup::update_box(), fltk::Group::update_child(), fltk::TextDisplay::xy_to_position(), and fltk::TextDisplay::xy_to_rowcol().
int fltk::Rectangle::y | ( | ) | const [inline] |
Top edge
Referenced by fltk::TiledImage::_draw(), fltk::Image::_draw(), fltk::addchord(), fltk::addpie(), fltk::clipout(), fltk::CreatedWindow::create(), fltk::Slider::draw(), fltk::Item::draw(), fltk::Input::draw(), fltk::Image::draw(), fltk::Choice::draw(), fltk::Widget::draw_background(), fltk::Group::draw_child(), fltk::Menu::draw_in(), fltk::Widget::draw_label(), fltk::Group::draw_outside_label(), fltk::Slider::draw_ticks(), fltk::drawtext(), fltk::fillpath(), fltk::fillstrokepath(), fltk::Monitor::find(), fltk::Menu::find_selected(), fltk::Group::fix_old_positions(), fltk::Window::flush(), fltk::Window::fullscreen(), fltk::Widget::get_absolute_rect(), fltk::Slider::handle(), fltk::handle(), fltk::Group::handle(), fltk::Window::hotspot(), fltk::Symbol::inset(), intersect(), fltk::intersect_with_clip(), fltk::Tooltip::layout(), fltk::Group::layout(), fltk::Monitor::list(), fltk::Widget::make_current(), merge(), fltk::Input::mouse_position(), fltk::not_clipped(), fltk::TextDisplay::position_to_xy(), fltk::push_clip(), fltk::Widget::redraw(), fltk::Widget::resize(), fltk::scrollrect(), fltk::Widget::send(), set(), fltk::Image::setpixels(), fltk::Window::show(), fltk::Group::sizes(), fltk::strokepath(), fltk::Window::system_layout(), fltk::transform(), fltk::Menu::try_popup(), fltk::Group::update_child(), fltk::TextDisplay::xy_to_position(), and fltk::TextDisplay::xy_to_rowcol().
int fltk::Rectangle::w | ( | ) | const [inline] |
Distance between left and right edges
Referenced by fltk::TiledImage::_draw(), fltk::Image::_draw(), fltk::addchord(), fltk::addpie(), fltk::Monitor::all(), fltk::TabGroupPager::available_width(), fltk::ScrollGroup::bbox(), fltk::clipout(), fltk::CreatedWindow::create(), fltk::Window::destroy(), fltk::Slider::draw(), fltk::PopupMenu::draw(), fltk::Item::draw(), fltk::Input::draw(), fltk::Image::draw(), fltk::Choice::draw(), fltk::Button::draw(), fltk::GlutWindow::draw(), fltk::Widget::draw_background(), fltk::Widget::draw_box(), fltk::Widget::draw_frame(), fltk::Menu::draw_in(), fltk::Widget::draw_label(), fltk::Group::draw_outside_label(), fltk::Window::draw_overlay(), fltk::Symbol::draw_symbol_overlay(), fltk::Slider::draw_ticks(), fltk::drawimage(), fltk::drawtext(), fltk::Tooltip::enter(), fltk::fillpath(), fltk::fillstrokepath(), fltk::Menu::find_selected(), fltk::Window::flush(), fltk::Window::fullscreen(), fltk::Widget::get_absolute_rect(), fltk::Menu::get_location(), fltk::glstart(), fltk::Group::Group(), fltk::Slider::handle(), fltk::handle(), fltk::Input::handle(), fltk::Group::handle(), fltk::Window::hotspot(), fltk::Group::init_sizes(), fltk::Symbol::inset(), fltk::intersect_with_clip(), fltk::Divider::layout(), fltk::Item::layout(), fltk::Group::layout(), fltk::Menu::layout_in(), fltk::Input::line_end(), fltk::Input::line_start(), fltk::Monitor::list(), fltk::Widget::make_current(), fltk::Input::mouse_position(), fltk::not_clipped(), fltk::GlWindow::ortho(), fltk::PopupMenu::popup(), fltk::Widget::position(), fltk::push_clip(), fltk::readimage(), fltk::Widget::redraw(), fltk::Widget::resize(), fltk::scrollrect(), set(), fltk::Image::setpixels(), fltk::Window::show(), fltk::Group::sizes(), fltk::strokepath(), fltk::Window::system_layout(), fltk::transform(), fltk::Menu::try_popup(), fltk::Input::up_down_position(), fltk::StatusBarGroup::update_box(), and fltk::Scrollbar::value().
int fltk::Rectangle::h | ( | ) | const [inline] |
Distance between top and bottom edges
Referenced by fltk::TiledImage::_draw(), fltk::Image::_draw(), fltk::addchord(), fltk::addpie(), fltk::Monitor::all(), fltk::ScrollGroup::bbox(), fltk::clipout(), fltk::CreatedWindow::create(), fltk::Slider::draw(), fltk::PopupMenu::draw(), fltk::Item::draw(), fltk::Input::draw(), fltk::Image::draw(), fltk::Choice::draw(), fltk::Button::draw(), fltk::GlutWindow::draw(), fltk::Widget::draw_background(), fltk::Widget::draw_box(), fltk::Widget::draw_frame(), fltk::Menu::draw_in(), fltk::Widget::draw_label(), fltk::Group::draw_outside_label(), fltk::Window::draw_overlay(), fltk::Symbol::draw_symbol_overlay(), fltk::Slider::draw_ticks(), fltk::drawimage(), fltk::drawtext(), fltk::Tooltip::enter(), fltk::fillpath(), fltk::fillstrokepath(), fltk::Menu::find_selected(), fltk::Window::flush(), fltk::Window::fullscreen(), fltk::Widget::get_absolute_rect(), fltk::Menu::get_location(), fltk::glstart(), fltk::Group::Group(), fltk::Slider::handle(), fltk::handle(), fltk::Input::handle(), fltk::Group::handle(), fltk::Input::handle_key(), fltk::Window::hotspot(), fltk::Group::init_sizes(), fltk::Symbol::inset(), fltk::intersect_with_clip(), fltk::Tooltip::layout(), fltk::Divider::layout(), fltk::Item::layout(), fltk::Group::layout(), fltk::Menu::layout_in(), fltk::Input::line_end(), fltk::Input::line_start(), fltk::Monitor::list(), fltk::Widget::make_current(), fltk::Browser::make_item_visible(), fltk::not_clipped(), fltk::GlWindow::ortho(), fltk::PopupMenu::popup(), fltk::Widget::position(), fltk::push_clip(), fltk::Widget::redraw(), fltk::Widget::resize(), fltk::scrollrect(), set(), fltk::Image::setpixels(), fltk::Window::show(), fltk::Group::sizes(), fltk::strokepath(), fltk::Window::system_layout(), fltk::transform(), fltk::Menu::try_popup(), fltk::Input::up_down_position(), fltk::StatusBarGroup::update_box(), and fltk::Scrollbar::value().
int fltk::Rectangle::r | ( | ) | const [inline] |
Return x()+w(), the right edge of the rectangle.
Referenced by fltk::Image::_draw(), fltk::Menu::add_many(), fltk::clipout(), fltk::Slider::draw(), fltk::PopupMenu::draw(), fltk::Item::draw(), fltk::Input::draw(), fltk::Choice::draw(), fltk::Button::draw(), fltk::Menu::draw_in(), fltk::Widget::draw_label(), fltk::Group::draw_outside_label(), fltk::Slider::draw_ticks(), fltk::fillpath(), fltk::fillstrokepath(), fltk::Monitor::find(), fltk::Menu::find_selected(), fltk::Window::flush(), fltk::Menu::get_location(), fltk::Input::handle(), fltk::Window::hotspot(), intersect(), fltk::intersect_with_clip(), fltk::Tooltip::layout(), fltk::Menu::layout_in(), fltk::Input::line_end(), fltk::Input::line_start(), fltk::Valuator::linesize(), fltk::Monitor::list(), merge(), fltk::not_clipped(), fltk::Widget::redraw(), set(), fltk::Window::show(), fltk::Group::sizes(), fltk::strokepath(), fltk::Menu::try_popup(), fltk::Input::up_down_position(), fltk::StatusBarGroup::update_box(), and fltk::Scrollbar::value().
int fltk::Rectangle::b | ( | ) | const [inline] |
Return y()+h(), the bottom edge of the rectangle.
Referenced by fltk::Image::_draw(), fltk::clipout(), fltk::Input::copy(), fltk::Slider::draw(), fltk::Menu::draw_in(), fltk::Widget::draw_label(), fltk::Group::draw_outside_label(), fltk::Slider::draw_ticks(), fltk::drawtext(), fltk::fillpath(), fltk::fillstrokepath(), fltk::Monitor::find(), fltk::glstart(), fltk::Window::hotspot(), intersect(), fltk::intersect_with_clip(), fltk::Tooltip::layout(), fltk::Monitor::list(), merge(), fltk::Input::mouse_position(), fltk::not_clipped(), fltk::Widget::redraw(), set(), fltk::strokepath(), fltk::Input::undo(), and fltk::Scrollbar::value().
void fltk::Rectangle::x | ( | int | v | ) | [inline] |
Move the rectangle so the left edge is at v.
void fltk::Rectangle::y | ( | int | v | ) | [inline] |
Move the rectangle so the top edge is at v.
void fltk::Rectangle::w | ( | int | v | ) | [inline] |
void fltk::Rectangle::h | ( | int | v | ) | [inline] |
void fltk::Rectangle::set_x | ( | int | v | ) | [inline] |
Change x() without changing r(), by changing the width.
Referenced by fltk::Slider::draw(), fltk::Button::draw(), fltk::Widget::draw_label(), intersect(), fltk::intersect_with_clip(), merge(), and fltk::Widget::redraw().
void fltk::Rectangle::set_y | ( | int | v | ) | [inline] |
Change y() without changing b(), by changing the height.
Referenced by fltk::Slider::draw(), fltk::Widget::draw_label(), intersect(), fltk::intersect_with_clip(), merge(), and fltk::Widget::redraw().
void fltk::Rectangle::set_r | ( | int | v | ) | [inline] |
Change r() without changing x(), by changine the width.
Referenced by fltk::Slider::draw(), fltk::Widget::draw_label(), fltk::Group::draw_outside_label(), intersect(), fltk::intersect_with_clip(), merge(), and fltk::Widget::redraw().
void fltk::Rectangle::set_b | ( | int | v | ) | [inline] |
Change b() without changing y(), by changine the height.
Referenced by fltk::Slider::draw(), fltk::Widget::draw_label(), fltk::Group::draw_outside_label(), intersect(), fltk::intersect_with_clip(), merge(), and fltk::Widget::redraw().
void fltk::Rectangle::set | ( | int | x, | |
int | y, | |||
int | w, | |||
int | h | |||
) | [inline] |
Set x(), y(), w(), and h() all at once.
Referenced by fltk::Monitor::all(), fltk::ScrollGroup::bbox(), fltk::Window::borders(), fltk::CreatedWindow::create(), fltk::handle(), fltk::intersect_with_clip(), fltk::Monitor::list(), and fltk::transform().
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.
References fltk::ALIGN_BOTTOM, fltk::ALIGN_LEFT, fltk::ALIGN_RIGHT, fltk::ALIGN_TOP, b(), h(), r(), w(), x(), and y().
void fltk::Rectangle::move_x | ( | int | d | ) | [inline] |
Add d to x() without changing r() (it reduces w() by d).
Referenced by fltk::ScrollGroup::bbox(), fltk::PopupMenu::draw(), fltk::Item::draw(), fltk::Input::draw(), fltk::Widget::draw_label(), fltk::Symbol::draw_symbol_overlay(), and fltk::Input::handle().
void fltk::Rectangle::move_y | ( | int | d | ) | [inline] |
Add d to y() without changing b() (it reduces h() by d).
Referenced by fltk::ScrollGroup::bbox(), fltk::Input::draw(), fltk::Widget::draw_label(), fltk::Symbol::draw_symbol_overlay(), and fltk::Menu::try_popup().
void fltk::Rectangle::move_r | ( | int | d | ) | [inline] |
void fltk::Rectangle::move_b | ( | int | d | ) | [inline] |
void fltk::Rectangle::inset | ( | int | d | ) | [inline] |
Move all edges in by d. See also Symbol::inset()
void fltk::Rectangle::move | ( | int | dx, | |
int | dy | |||
) | [inline] |
Move entire rectangle by given distance in x and y.
Referenced by fltk::Menu::draw_in(), fltk::Symbol::inset(), fltk::Tooltip::layout(), fltk::Widget::redraw(), and fltk::Menu::try_popup().
bool fltk::Rectangle::empty | ( | ) | const [inline] |
True if w() or h() are less or equal to zero.
Referenced by fltk::TiledImage::_draw(), fltk::Image::_draw(), fltk::clipout(), fltk::fillpath(), fltk::intersect_with_clip(), merge(), fltk::Widget::redraw(), fltk::Image::setpixels(), fltk::strokepath(), and fltk::transform().
bool fltk::Rectangle::not_empty | ( | ) | const [inline] |
int fltk::Rectangle::center_x | ( | ) | const [inline] |
Integer center position. Rounded to the left if w() is odd.
Referenced by fltk::Slider::draw(), fltk::fillpath(), fltk::fillstrokepath(), and fltk::strokepath().
int fltk::Rectangle::center_y | ( | ) | const [inline] |
Integer center position. Rounded to lower y if h() is odd.
Referenced by fltk::Slider::draw(), fltk::fillpath(), fltk::fillstrokepath(), and fltk::strokepath().
int Rectangle::baseline_y | ( | ) | const |
Where to put baseline to center current font nicely
References fltk::getascent(), and fltk::getdescent().
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
Referenced by fltk::event_inside().
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).
References b(), empty(), r(), set_b(), set_r(), set_x(), set_y(), x(), and y().
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.
References b(), r(), set_b(), set_r(), set_x(), set_y(), x(), and y().