Mercurial > projects > doodle
view tk/types.d @ 2:d6f44347373d
* Switched over to geometry done with structs instead of classes.
* Removed direct access to gtk structs
* Refactoring
author | David Bryant <daveb@acres.com.au> |
---|---|
date | Fri, 10 Jul 2009 15:15:27 +0930 |
parents | e907d2c54ec3 |
children | 8a39b13cd3e6 |
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 { 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; } }