]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/state.h
Minor style fixes
[libs/gltk.git] / source / state.h
index 6cbe152ead5fdbd41a230b1cf668b2c5f9c9bad8..eb124691dfba756673b01b3718e1f8c6114062ee 100644 (file)
@@ -2,30 +2,39 @@
 #define MSP_GLTK_STATE_H_
 
 #include <istream>
-#include <msp/parser/value.h>
+#include <msp/datafile/value.h>
 
 namespace Msp {
 namespace GLtk {
 
 enum State
 {
-       NORMAL,   //< Default state
-       HOVER,    //< Pointer over the widget
-       ACTIVE,   //< Widget is active (e.g. pressed button)
-       DISABLED, //< Widget is unresponsive
-       N_STATES_ //< Sentry value
+       NORMAL = 0,   //< Default state
+       HOVER = 1,    //< Pointer over the widget
+       ACTIVE = 2,   //< Widget is active (e.g. pressed button)
+       FOCUS = 4,    //< Widget has input focus
+       DISABLED = 8, //< Widget is unresponsive
+       N_STATES_ = 16 //< Sentry value
 };
 
-extern std::istream &operator>>(std::istream &, State &);
+inline State operator|(State a, State b)
+{ return static_cast<State>(static_cast<int>(a)|static_cast<int>(b)); }
 
-} // namespace GLtk
+inline State operator|=(State &a, State b)
+{ a = a|b; return a; }
+
+inline State operator&(State a, State b)
+{ return static_cast<State>(static_cast<int>(a)&static_cast<int>(b)); }
 
-namespace Parser {
+inline State operator&=(State &a, State b)
+{ a = a&b; return a; }
 
-template<>
-struct TypeResolver<GLtk::State> { static const Value::Type type=Value::ENUM; };
+inline State operator~(State a)
+{ return static_cast<State>(~static_cast<int>(a)); }
 
-} // namespace Parser
+extern std::istream &operator>>(std::istream &, State &);
+
+} // namespace GLtk
 } // namespace Msp
 
 #endif