diff options
Diffstat (limited to 'src/fltk_binding/fltk-enums.ads')
-rw-r--r-- | src/fltk_binding/fltk-enums.ads | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/fltk_binding/fltk-enums.ads b/src/fltk_binding/fltk-enums.ads index 00a56c2..91f7353 100644 --- a/src/fltk_binding/fltk-enums.ads +++ b/src/fltk_binding/fltk-enums.ads @@ -1,5 +1,9 @@ +with Interfaces.C; +private with FLTK.Enum_Values; + + package FLTK.Enums is @@ -95,5 +99,48 @@ package FLTK.Enums is Free_Label); + -- type Modifier_Key is private; + type Modifier_Key is new Interfaces.Unsigned_8; + + -- type Shortcut_Key is private; + type Shortcut_Key is + record + Modifier : Modifier_Key; + Keypress : Character; + end record; + + subtype Pressable_Key is Character range Character'Val (32) .. Character'Val (126); + function Shortcut (Key : Pressable_Key) return Shortcut_Key; + No_Key : constant Shortcut_Key; + + + function "+" (Left, Right : in Modifier_Key) return Modifier_Key; + function "+" (Left : in Modifier_Key; Right : in Pressable_Key) return Shortcut_Key; + function "+" (Left : in Modifier_Key; Right : in Shortcut_Key) return Shortcut_Key; + Mod_None : constant Modifier_Key; + Mod_Shift : constant Modifier_Key; + Mod_Ctrl : constant Modifier_Key; + Mod_Alt : constant Modifier_Key; + + + function Key_To_C + (Key : Shortcut_Key) + return Interfaces.C.unsigned_long; + + +private + + + -- these values designed to align with FLTK enumeration types + Mod_None : constant Modifier_Key := 2#00000000#; + Mod_Shift : constant Modifier_Key := 2#00000001#; + Mod_Ctrl : constant Modifier_Key := 2#00000100#; + Mod_Alt : constant Modifier_Key := 2#00001000#; + + + No_Key : constant Shortcut_Key := + (Modifier => Mod_None, Keypress => Character'Val (0)); + + end FLTK.Enums; |