Mercurial > projects > doodle
view tk/types.d @ 0:e907d2c54ec3
Initial import
author | David Bryant <daveb@acres.com.au> |
---|---|
date | Wed, 13 May 2009 15:42:39 +0930 |
parents | |
children | d6f44347373d |
line wrap: on
line source
module tk.types; private import std.string; enum ButtonPress { SINGLE, DOUBLE, TRIPLE, RELEASE } enum ButtonNumber { BUTTON_1, BUTTON_2, BUTTON_3, BUTTON_4, BUTTON_5, } enum ScrollDirection { UP, DOWN, LEFT, RIGHT } enum Modifier { SHIFT, CAPS_LOCK, CONTROL, ALT, NUM_LOCK, META, SCROLL_LOCK, BUTTON_1, BUTTON_2, BUTTON_3, BUTTON_4, BUTTON_5 } class Mask { this() { //mBits = 0; } void add(Modifier modifier) { mBits |= bit(modifier); } void remove(Modifier modifier) { mBits &= ~bit(modifier); } bool query(Modifier modifier) { return cast(bool)(mBits & bit(modifier)); } override string toString() { return format("%d", mBits); } private { static int bit(Modifier modifier) { return 1 << cast(int)modifier; } int mBits; } }