X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstate.h;h=eb124691dfba756673b01b3718e1f8c6114062ee;hb=1bc84ded58379ee24315db8784d9fb710a02e24e;hp=8e29ab063dde7cad948514005ff561f3e986a02a;hpb=c2635c5a3dca6a6cea5562fd387beb0662b18cf0;p=libs%2Fgltk.git diff --git a/source/state.h b/source/state.h index 8e29ab0..eb12469 100644 --- a/source/state.h +++ b/source/state.h @@ -1,10 +1,3 @@ -/* $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_ @@ -16,13 +9,29 @@ 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 }; +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)); } + extern std::istream &operator>>(std::istream &, State &); } // namespace GLtk