X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstate.h;h=eb124691dfba756673b01b3718e1f8c6114062ee;hb=HEAD;hp=4e57990c9f015b9ddb2827d767322f188b2b6c3f;hpb=d7ae291415a21cc886fe318070b41ac8d3e57a30;p=libs%2Fgltk.git diff --git a/source/state.h b/source/state.h index 4e57990..51d17b2 100644 --- a/source/state.h +++ b/source/state.h @@ -3,20 +3,37 @@ #include #include +#include "mspgltk_api.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(static_cast(a)|static_cast(b)); } + +inline State operator|=(State &a, State b) +{ a = a|b; return a; } + +inline State operator&(State a, State b) +{ return static_cast(static_cast(a)&static_cast(b)); } + +inline State operator&=(State &a, State b) +{ a = a&b; return a; } + +inline State operator~(State a) +{ return static_cast(~static_cast(a)); } + +MSPGLTK_API std::istream &operator>>(std::istream &, State &); } // namespace GLtk } // namespace Msp