Enumerations | |
| enum | { DAMAGE_VALUE, DAMAGE_PUSHED, DAMAGE_SCROLL, DAMAGE_OVERLAY, DAMAGE_HIGHLIGHT, DAMAGE_CHILD, DAMAGE_CHILD_LABEL, DAMAGE_EXPOSE, DAMAGE_CONTENTS, DAMAGE_ALL } |
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() & DAMAGE_ALL) { ... draw frame/box and other static stuff ... } if (damage() & (DAMAGE_ALL | 1)) draw_part1(); if (damage() & (DAMAGE_ALL | 2)) draw_part2(); if (damage() & (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.
|
|
|
©2006 Bill Spitzak and others.