summaryrefslogtreecommitdiffstats
path: root/fltk-2/include/fltk/damage.h
blob: 43865bdd118c53bbe3e8235fb90463a6b6163be1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*! \file
   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:

\code
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();
}
\endcode

  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.

*/

#ifndef fltk_damage_h
#define fltk_damage_h

namespace fltk {

enum {
  DAMAGE_VALUE		= 0x01,
  DAMAGE_PUSHED		= 0x02,
  DAMAGE_SCROLL		= 0x04,
  DAMAGE_OVERLAY	= 0x04, // reused value
  DAMAGE_HIGHLIGHT	= 0x08,
  DAMAGE_CHILD		= 0x10,
  DAMAGE_CHILD_LABEL	= 0x20,
  DAMAGE_EXPOSE		= 0x40,
  DAMAGE_CONTENTS	= 0x40, // reused value
  DAMAGE_ALL		= 0x80
};

}

#endif