1 /** DGui project file.
2 
3 Copyright: Trogu Antonio Davide 2011-2013
4 
5 License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0).
6 
7 Authors: Trogu Antonio Davide
8 */
9 module dguihub.core.events.eventargs;
10 
11 class EventArgs {
12    private static EventArgs _empty;
13 
14    protected this() {
15 
16    }
17 
18    @property public static EventArgs empty() {
19       if (!this._empty) {
20          _empty = new EventArgs();
21       }
22 
23       return _empty;
24    }
25 }
26 
27 class CancelEventArgs(T) : EventArgs {
28    private bool _cancel = false;
29    private T _t;
30 
31    public this(T t) {
32       this._t = t;
33    }
34 
35    @property public final bool cancel() {
36       return this._cancel;
37    }
38 
39    @property public final void cancel(bool b) {
40       this._cancel = b;
41    }
42 
43    @property public final T item() {
44       return this._t;
45    }
46 }
47 
48 class ItemEventArgs(T) : EventArgs {
49    private T _checkedItem;
50 
51    public this(T item) {
52       this._checkedItem = item;
53    }
54 
55    @property public T item() {
56       return this._checkedItem;
57    }
58 }
59 
60 class ItemChangedEventArgs(T) : EventArgs {
61    private T _oldItem;
62    private T _newItem;
63 
64    public this(T oItem, T nItem) {
65       this._oldItem = oItem;
66       this._newItem = nItem;
67    }
68 
69    @property public T oldItem() {
70       return this._oldItem;
71    }
72 
73    @property public T newItem() {
74       return this._newItem;
75    }
76 }