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 dgui.core.events.eventargs;
10 
11 class EventArgs
12 {
13 	private static EventArgs _empty;
14 
15 	protected this()
16 	{
17 
18 	}
19 
20 	@property public static EventArgs empty()
21 	{
22 		if(!this._empty)
23 		{
24 			_empty = new EventArgs();
25 		}
26 
27 		return _empty;
28 	}
29 }
30 
31 class CancelEventArgs(T): EventArgs
32 {
33 	private bool _cancel = false;
34 	private T _t;
35 
36 	public this(T t)
37 	{
38 		this._t = t;
39 	}
40 
41 	@property public final bool cancel()
42 	{
43 		return this._cancel;
44 	}
45 
46 	@property public final void cancel(bool b)
47 	{
48 		this._cancel = b;
49 	}
50 
51 	@property public final T item()
52 	{
53 		return this._t;
54 	}
55 }
56 
57 class ItemEventArgs(T): EventArgs
58 {
59 	private T _checkedItem;
60 
61 	public this(T item)
62 	{
63 		this._checkedItem = item;
64 	}
65 
66 	@property public T item()
67 	{
68 		return this._checkedItem;
69 	}
70 }
71 
72 class ItemChangedEventArgs(T): EventArgs
73 {
74 	private T _oldItem;
75 	private T _newItem;
76 
77 	public this(T oItem, T nItem)
78 	{
79 		this._oldItem = oItem;
80 		this._newItem = nItem;
81 	}
82 
83 	@property public T oldItem()
84 	{
85 		return this._oldItem;
86 	}
87 
88 	@property public T newItem()
89 	{
90 		return this._newItem;
91 	}
92 }