Functions | |
uchar | fltk::Widget::damage () const |
void | fltk::Widget::set_damage (uchar c) |
void | fltk::Widget::redraw () |
void | fltk::Widget::redraw (uchar c) |
void | fltk::Widget::redraw_label () |
void | fltk::Widget::redraw_highlight () |
virtual void | fltk::Widget::draw () |
MyClass::handle(int event) { ... if (change_to_part1) damage(1); if (change_to_part2) damage(2); if (change_to_part3) damage(4); } MyClass::draw() { if (damage() & fltk::DAMAGE_ALL) { ... draw frame/box and other static stuff ... } if (damage() & (fltk::DAMAGE_ALL | 1)) draw_part1(); if (damage() & (fltk::DAMAGE_ALL | 2)) draw_part2(); if (damage() & (fltk::DAMAGE_ALL | 4)) draw_part3(); }
Except for DAMAGE_ALL, each widget is allowed to assign any meaning to any of the bits it wants. The enumerations are just to provide suggested meanings.
|
The 'or' of all the calls to redraw() done since the last draw(). Cleared to zero after draw() is called. |
|
Fltk calls this virtual function to draw the widget, after setting up the graphics (current window, xy translation, etc) so that any drawing functions will go into this widget. User code should not call this! You probably want to call redraw(). The default version calls draw_box() and draw_label(), thus drawing the box() to fill the widget and putting the label() and image() inside it to fill it, unless the align() flags are set to put it outside. Information on how to write your own version is here. Reimplemented in fltk::Divider, fltk::Group, fltk::Window, fltk::DockHolder, fltk::GripperBar, fltk::RegionHolder, fltk::ToolDivider, fltk::ToolWindow, and fltk::WindowHolder. |
|
Indicates that draw() should be called, and turns on the given bits in damage(). At least these bits, and possibly others, will still be on when draw() is called. |
|
Same as redraw(DAMAGE_ALL). This bit is used by most widgets to indicate that they should not attempt any incremental update, and should instead completely draw themselves. |
|
Causes a redraw if highlighting changes. Calls redraw(DAMAGE_HIGHLIGHT) if this widget has a non-zero highlight_color(). This is designed to be called in response to ENTER and EXIT events and not redraw the widget if the no highlight color is being used. |
|
Indicates that the label() should be redrawn. This does nothing if there is no label. If it is an outside label (see align()) then the parent() is told to redraw it. Otherwise redraw() is called. |
|
Directly change the value returned by damage(). Note that this replaces the value, it does not turn bits on. Use redraw() to turn bits on. |