Functions | |
virtual void | fltk::Widget::layout () |
bool | fltk::Widget::resize (int x, int y, int w, int h) |
bool | fltk::Widget::position (int x, int y) |
bool | fltk::Widget::resize (int w, int h) |
void | fltk::Widget::relayout () |
uchar | fltk::Widget::layout_damage () const |
void | fltk::Widget::layout_damage (uchar c) |
bool | fltk::Widget::horizontal () const |
bool | fltk::Widget::vertical () const |
void | fltk::Widget::set_vertical () |
void | fltk::Widget::set_horizontal () |
This is useful because often calculating the new layout is quite expensive, this expense is thus deferred until the user will actually see the new size.
Some Group widgets such as fltk::PackedGroup will also use the virtual layout() function to find out how big a widget should be. Widgets are allowed to change their own dimensions in layout(). The only rule is that if nothing except the x/y position is changed and layout() is called a second time, they must not change size again. Usually a widget will alter only one of w() or h(), and usually it will only make itself larger, not smaller. Most widgets only set w() or h() if one or both of them are zero.
|
Return true if this widget has a horizontal orientation and fltk::Pack will position it against the top or bottom edge. This is the default. |
|
Virtual function to respond to layout_damage(), it should calculate the correct size of this widget and all it's children. This function is called by fltk or by the layout() method in other widgets. User programs should not call it. A widget is allowed to alter it's own size in a layout() method, to indicate a size that the data will fit in. A parent widget is then expected to rearrange itself to accomodate the new size. This may mean it will move the widget and thus layout() will be called again. You can look at layout_damage() to find out why this is being called. The base class redraws the widget and sets layout_damage() to zero. Reimplemented in fltk::Divider, fltk::Group, fltk::Window, fltk::BarHolder, fltk::DockHolder, fltk::GripperBar, fltk::RegionHolder, fltk::ToolBar, fltk::ToolDivider, fltk::ToolWindow, and fltk::WindowHolder. |
|
Directly change the value returned by layout_damage(). |
|
The 'or' of all the calls to relayout() or resize() done since the last time layout() was called. For more information see the Layout and Resizing chapter. A typical layout function does not care about the widget moving, an easy way to skip it is as follows:
MyClass::layout() { if (!(layout_damage() & ~LAYOUT_XY)) return; do_expensive_layout(); redraw(); } |
|
|
Same as relayout(LAYOUT_DAMAGE), indicates that data inside the widget may have changed, but the size did not change. This flag is also on when the widget is initially created. |
|
Same as resize() to x(), y(), w, h Reimplemented in fltk::Group, and fltk::DockBase. |
|
Change the size or position of the widget. Nothing is done if the passed size and position are the same as before. If there is a change then relayout() is called so that the virtual function layout() is called before the next draw(). Reimplemented in fltk::Group, and fltk::DockBase. |
|
Undoes set_vertical() and makes horizontal() return true. This will affect how a surrounding fltk::Pack (or similar group) will place the widget, but you must call relayout() to indicate that this must be recalculated. |
|
Makes vertical() return true. This will affect how a surrounding fltk::Pack (or similar group) will place the widget, but you must call relayout() to indicate that this must be recalculated. Some widgets classes such as fltk::MenuBar or fltk::Slider will draw differently if this is turned on, in a vertical arrangement. |
|
Same as !horizontal(). |