Mercurial > projects > doodle
annotate doodle/tk/events.d @ 28:1754cb773d41
Part-way through getting to compile with configure/builder.
author | Graham St Jack <graham.stjack@internode.on.net> |
---|---|
date | Sun, 02 Aug 2009 16:27:21 +0930 |
parents | tk/events.d@c643c04e3f5e |
children | 157b4ad5615d |
rev | line source |
---|---|
28
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
17
diff
changeset
|
1 module doodle.tk.events; |
0 | 2 |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
13
diff
changeset
|
3 public { |
28
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
17
diff
changeset
|
4 import doodle.tk.types; |
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
17
diff
changeset
|
5 import doodle.tk.geometry; |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
13
diff
changeset
|
6 } |
0 | 7 |
8 abstract class Event { | |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
13
diff
changeset
|
9 this(in Mask mask) { |
6 | 10 mMask = mask; |
0 | 11 } |
12 | |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
13
diff
changeset
|
13 Mask mask() const { return mMask; } |
0 | 14 |
15 private { | |
16 Mask mMask; | |
17 } | |
18 } | |
19 | |
13 | 20 final class CrossingEvent : Event { |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
13
diff
changeset
|
21 this(in Mask mask) { |
0 | 22 super(mask); |
23 } | |
24 | |
25 private { | |
26 } | |
27 } | |
28 | |
13 | 29 final class KeyEvent : Event { |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
13
diff
changeset
|
30 this(in string str, in uint value, in Mask mask) { |
0 | 31 super(mask); |
32 mStr = str; | |
33 mValue = value; | |
34 } | |
35 | |
5 | 36 string str() const { return mStr; } |
0 | 37 |
5 | 38 override string toString() const { |
8 | 39 return std.string.format("Key event: %s, %d, %s", mStr, mValue, mMask); |
0 | 40 } |
41 | |
42 private { | |
43 string mStr; | |
44 uint mValue; | |
45 } | |
46 } | |
47 | |
13 | 48 abstract class PointerEvent : Event { |
17 | 49 this(in Point pixel_point, in Point model_point, in Mask mask) { |
0 | 50 super(mask); |
17 | 51 mPixelPoint = pixel_point; |
3
7d57cae10805
Renamed geometry2 to geometry
David Bryant <daveb@acres.com.au>
parents:
2
diff
changeset
|
52 mModelPoint = model_point; |
0 | 53 } |
54 | |
17 | 55 Point pixel_point() const { return mPixelPoint; } |
5 | 56 Point model_point() const { return mModelPoint; } |
0 | 57 |
58 private { | |
17 | 59 Point mPixelPoint; |
3
7d57cae10805
Renamed geometry2 to geometry
David Bryant <daveb@acres.com.au>
parents:
2
diff
changeset
|
60 Point mModelPoint; |
0 | 61 } |
62 } | |
63 | |
64 final class ButtonEvent : PointerEvent { | |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
13
diff
changeset
|
65 this(in ButtonAction button_action, |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
13
diff
changeset
|
66 in ButtonName button_name, |
17 | 67 in Point pixel_point, |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
13
diff
changeset
|
68 in Point model_point, |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
13
diff
changeset
|
69 in Mask mask) { |
17 | 70 super(pixel_point, model_point, mask); |
7 | 71 mButtonAction = button_action; |
72 mButtonName = button_name; | |
0 | 73 } |
74 | |
5 | 75 override string toString() const { |
8 | 76 return std.string.format("Button event: %s, %s, %s, %s, %s", |
77 enumToString(mButtonAction), enumToString(mButtonName), | |
17 | 78 mPixelPoint, mModelPoint, mMask); |
0 | 79 } |
80 | |
7 | 81 ButtonAction button_action() const { return mButtonAction; } |
82 ButtonName button_name() const { return mButtonName; } | |
0 | 83 |
84 private { | |
7 | 85 ButtonAction mButtonAction; |
86 ButtonName mButtonName; | |
0 | 87 } |
88 } | |
89 | |
90 final class MotionEvent : PointerEvent { | |
17 | 91 this(in Point pixel_point, |
5 | 92 in Point model_point, |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
13
diff
changeset
|
93 in Mask mask) { |
17 | 94 super(pixel_point, model_point, mask); |
0 | 95 } |
96 | |
5 | 97 override string toString() const { |
8 | 98 return std.string.format("Motion event: %s, %s, %s", |
17 | 99 mPixelPoint, mModelPoint, mMask); |
0 | 100 } |
101 } | |
102 | |
103 final class ScrollEvent : PointerEvent { | |
5 | 104 this(in ScrollDirection scroll_direction, |
17 | 105 in Point pixel_point, |
5 | 106 in Point model_point, |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
13
diff
changeset
|
107 in Mask mask) { |
17 | 108 super(pixel_point, model_point, mask); |
0 | 109 mScrollDirection = scroll_direction; |
110 } | |
111 | |
5 | 112 override string toString() const { |
8 | 113 return std.string.format("Scroll event: %s, %s, %s, %s", |
17 | 114 enumToString(mScrollDirection), mPixelPoint, mModelPoint, mMask); |
0 | 115 } |
116 | |
5 | 117 ScrollDirection scroll_direction() const { return mScrollDirection; } |
0 | 118 |
119 private { | |
120 ScrollDirection mScrollDirection; | |
121 } | |
122 } |