When redrawing your widgets you should look at the damage bits to see what parts of your widget need redrawing. The Widget::handle() method can then set individual damage bits to limit the amount of drawing that needs to be done, and the Widget::draw() method can test these bits to decide what to 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.
Namespaces | |
namespace | fltk |
Enumerations | |
enum | { fltk::DAMAGE_VALUE, fltk::DAMAGE_PUSHED, fltk::DAMAGE_SCROLL, fltk::DAMAGE_OVERLAY, fltk::DAMAGE_HIGHLIGHT, fltk::DAMAGE_CHILD, fltk::DAMAGE_CHILD_LABEL, fltk::DAMAGE_EXPOSE, fltk::DAMAGE_CONTENTS, fltk::DAMAGE_ALL } |