From 501151d99cc8ec71eae7a3770ee3ba71c34cab18 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Wed, 20 Jul 2016 15:45:15 +1000 Subject: Menu shortcut keys and flags --- fltk-menu_items.adb | 63 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 4 deletions(-) (limited to 'fltk-menu_items.adb') diff --git a/fltk-menu_items.adb b/fltk-menu_items.adb index 6620a64..b72d8c3 100644 --- a/fltk-menu_items.adb +++ b/fltk-menu_items.adb @@ -8,6 +8,61 @@ use type System.Address; package body FLTK.Menu_Items is + function Create + (Key : Pressable_Key) + return Shortcut_Key is + begin + return This : Shortcut_Key do + This.Modifiers := Mod_None; + This.Keypress := Key; + end return; + end Create; + + + function "+" + (Left, Right : in Modifer_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.Modifiers := Left; + This.Keypress := Right; + end return; + end "+"; + + + function "+" + (Left : in Modifer_Key; + Right : in Shortcut_Key) + return Shortcut_Key is + begin + return This : Shortcut_Key do + This.Modifiers := Left or Right.Modifiers; + This.Keypress := Right.Keypress; + end return; + end "+"; + + + + + function "+" + (Left, Right : in Menu_Flag) + return Menu_Flag is + begin + return Left or Right; + end "+"; + + + + procedure Finalize (This : in out Menu_Item) is begin @@ -18,10 +73,10 @@ package body FLTK.Menu_Items is function Create - (Text : in String; - Shortcut : in Shortcut_Key; - Action : in FLTK.Callbacks.Callback; - Flags : Menu_Flag) + (Text : in String; + Action : in FLTK.Callbacks.Callback; + Shortcut : in Shortcut_Key := No_Key; + Flags : in Menu_Flag := Flag_Normal) return Menu_Item is begin return This : Menu_Item do -- cgit