1 /**
2 * Module for text event args handling.
3 *
4 * Authors:
5 *   Jacob Jensen
6 * License:
7 *   https://github.com/PoisonEngine/poison-ui/blob/master/LICENSE
8 */
9 module poison.core.eventargs.texteventargs;
10 
11 import poison.core.eventargs : EventArgs;
12 
13 /// Event args for text events.
14 class TextEventArgs : EventArgs {
15   private:
16   /// The last character entered.
17   dchar _last;
18 
19   /// The current character entered.
20   dchar _current;
21 
22   public:
23   @property {
24     /// Gets the last character entered.
25     dchar last() { return _last; }
26 
27     /// Gets the current character entered.
28     dchar current() { return _current; }
29   }
30 
31   /**
32   * Enteres a character.
33   * Params:
34   *   enteredChar = The entered character.
35   */
36   void enter(dchar enteredChar) {
37     _last = _current;
38     _current = enteredChar;
39   }
40 
41   package(poison):
42   /// Creates a new instance of text event args.
43   this() {
44     super();
45   }
46 }