1 // =================================
 2 // Copyright (c) 2022 Seppo Laakko
 3 // Distributed under the MIT license
 4 // =================================
 5 
 6 using System;
 7 
 8 namespace System.Screen
 9 {
10     public class delegate void SelectEventHandler();
11     public class delegate void ChangedEventHandler();
12     public class delegate void FocusEventHandler();
13     public class delegate void PressedEventHandler();
14 
15     public class WriteScreenEventArgs
16     {
17         public nothrow WriteScreenEventArgs(const Rect& rect_) : rect(rect_)
18         {
19         }
20         public nothrow const Rect& GetRect() const
21         {
22             return rect;
23         }
24         private Rect rect;
25     }
26     
27     public class delegate void WriteScreenEventHandler(WriteScreenEventArgs& writeScreenEventArgs);
28     
29     public class KeyEventArgs
30     {
31         public nothrow KeyEventArgs(uchar key_) : key(key_)handled(false)
32         {
33         }
34         public nothrow uchar Key() const
35         {
36             return key;
37         }
38         public nothrow bool Handled() const
39         {
40             return handled;
41         }
42         public nothrow void SetHandled()
43         {
44             handled = true;
45         }
46         private uchar key;
47         private bool handled;
48     }
49     
50     public class delegate void KeyEventHandler(KeyEventArgs& keyEventArgs);
51     
52     public class delegate void TimerEventHandler(TimerEventArgs& args);
53 
54     public class TimerEventArgs
55     {
56         public nothrow TimerEventArgs(int timerId_) : timerId(timerId_)
57         {
58         }
59         public nothrow int TimerId() const
60         {
61             return timerId;
62         }
63         private int timerId;
64     }
65 
66     public class CloseEventArgs
67     {
68         public nothrow CloseEventArgs() : cancel(false)
69         {
70         }
71         public nothrow bool Cancel() const
72         {
73             return cancel;
74         }
75         public nothrow void SetCancel()
76         {
77             cancel = true;
78         }
79         private bool cancel;
80     }
81     
82     public class delegate void CloseEventHandler(CloseEventArgs& closeEventArgs);
83 }