]> git.tdb.fi Git - libs/gltk.git/blob - source/state.h
51d17b2bb758fa14e08186c815fc565612148373
[libs/gltk.git] / source / state.h
1 #ifndef MSP_GLTK_STATE_H_
2 #define MSP_GLTK_STATE_H_
3
4 #include <istream>
5 #include <msp/datafile/value.h>
6 #include "mspgltk_api.h"
7
8 namespace Msp {
9 namespace GLtk {
10
11 enum State
12 {
13         NORMAL = 0,   //< Default state
14         HOVER = 1,    //< Pointer over the widget
15         ACTIVE = 2,   //< Widget is active (e.g. pressed button)
16         FOCUS = 4,    //< Widget has input focus
17         DISABLED = 8, //< Widget is unresponsive
18         N_STATES_ = 16 //< Sentry value
19 };
20
21 inline State operator|(State a, State b)
22 { return static_cast<State>(static_cast<int>(a)|static_cast<int>(b)); }
23
24 inline State operator|=(State &a, State b)
25 { a = a|b; return a; }
26
27 inline State operator&(State a, State b)
28 { return static_cast<State>(static_cast<int>(a)&static_cast<int>(b)); }
29
30 inline State operator&=(State &a, State b)
31 { a = a&b; return a; }
32
33 inline State operator~(State a)
34 { return static_cast<State>(~static_cast<int>(a)); }
35
36 MSPGLTK_API std::istream &operator>>(std::istream &, State &);
37
38 } // namespace GLtk
39 } // namespace Msp
40
41 #endif