fltk/damage.h File Reference


Detailed Description

Values of the bits stored in Widget::damage().

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
}


Wed Sep 10 02:47:46 2008. FLTK ©2007 Bill Spitzak and others.
Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.