X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fstate.h;h=7c2828aae0ab47f24b672fc368ef0dd8ceeedbd4;hb=ae991f3bbd83fa0afff5e1fc31be50e1f2d17875;hp=6cbe152ead5fdbd41a230b1cf668b2c5f9c9bad8;hpb=c1f038acb91eb3bfaa34dfd4729d19ed3f871a42;p=libs%2Fgltk.git diff --git a/source/state.h b/source/state.h index 6cbe152..7c2828a 100644 --- a/source/state.h +++ b/source/state.h @@ -1,31 +1,47 @@ +/* $Id$ + +This file is part of libmspgltk +Copyright © 2007 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + #ifndef MSP_GLTK_STATE_H_ #define MSP_GLTK_STATE_H_ #include -#include +#include 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(static_cast(a)|static_cast(b)); } -} // namespace GLtk +inline State operator|=(State &a, State b) +{ a = a|b; return a; } -namespace Parser { +inline State operator&(State a, State b) +{ return static_cast(static_cast(a)&static_cast(b)); } -template<> -struct TypeResolver { static const Value::Type type=Value::ENUM; }; +inline State operator&=(State &a, State b) +{ a = a&b; return a; } -} // namespace Parser +inline State operator~(State a) +{ return static_cast(~static_cast(a)); } + +extern std::istream &operator>>(std::istream &, State &); + +} // namespace GLtk } // namespace Msp #endif