summaryrefslogtreecommitdiff
path: root/src/fltk_binding/fltk-enums.adb
blob: 292e5ff64c672c27f0407096c50d1e789c20e32e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71


with Interfaces.C;
use type Interfaces.C.unsigned_long;


package body FLTK.Enums is


    function Shortcut
           (Key : Pressable_Key)
        return Shortcut_Key is
    begin
        return This : Shortcut_Key do
            This.Modifier := Mod_None;
            This.Keypress := Key;
        end return;
    end Shortcut;




    function Key_To_C
           (Key : Shortcut_Key)
        return Interfaces.C.unsigned_long is
    begin
        return Interfaces.C.unsigned_long (Key.Modifier) *
               65536 + Character'Pos (Key.Keypress);
    end Key_To_C;




    function "+"
           (Left, Right : in Modifier_Key)
        return Modifier_Key is
    begin
        return Left or Right;
    end "+";




    function "+"
           (Left  : in Modifier_Key;
            Right : in Pressable_Key)
        return Shortcut_Key is
    begin
        return This : Shortcut_Key do
            This.Modifier := Left;
            This.Keypress := Right;
        end return;
    end "+";




    function "+"
           (Left  : in Modifier_Key;
            Right : in Shortcut_Key)
        return Shortcut_Key is
    begin
        return This : Shortcut_Key do
            This.Modifier := Left or Right.Modifier;
            This.Keypress := Right.Keypress;
        end return;
    end "+";


end FLTK.Enums;