diff options
Diffstat (limited to 'src/fltk-widgets-menus-choices.adb')
-rw-r--r-- | src/fltk-widgets-menus-choices.adb | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/src/fltk-widgets-menus-choices.adb b/src/fltk-widgets-menus-choices.adb index fc60efc..f0fb03a 100644 --- a/src/fltk-widgets-menus-choices.adb +++ b/src/fltk-widgets-menus-choices.adb @@ -17,18 +17,9 @@ use type package body FLTK.Widgets.Menus.Choices is - procedure choice_set_draw_hook - (W, D : in Storage.Integer_Address); - pragma Import (C, choice_set_draw_hook, "choice_set_draw_hook"); - pragma Inline (choice_set_draw_hook); - - procedure choice_set_handle_hook - (W, H : in Storage.Integer_Address); - pragma Import (C, choice_set_handle_hook, "choice_set_handle_hook"); - pragma Inline (choice_set_handle_hook); - - - + ------------------------ + -- Functions From C -- + ------------------------ function new_fl_choice (X, Y, W, H : in Interfaces.C.int; @@ -82,12 +73,17 @@ package body FLTK.Widgets.Menus.Choices is + ------------------- + -- Destructors -- + ------------------- + procedure Extra_Final (This : in out Choice) is begin Extra_Final (Menu (This)); end Extra_Final; + procedure Finalize (This : in out Choice) is begin @@ -101,6 +97,10 @@ package body FLTK.Widgets.Menus.Choices is + -------------------- + -- Constructors -- + -------------------- + procedure Extra_Init (This : in out Choice; X, Y, W, H : in Integer; @@ -110,6 +110,14 @@ package body FLTK.Widgets.Menus.Choices is end Extra_Init; + procedure Initialize + (This : in out Choice) is + begin + This.Draw_Ptr := fl_choice_draw'Address; + This.Handle_Ptr := fl_choice_handle'Address; + end Initialize; + + package body Forge is function Create @@ -125,8 +133,6 @@ package body FLTK.Widgets.Menus.Choices is Interfaces.C.int (H), Interfaces.C.To_C (Text)); Extra_Init (This, X, Y, W, H, Text); - choice_set_draw_hook (This.Void_Ptr, Storage.To_Integer (Draw_Hook'Address)); - choice_set_handle_hook (This.Void_Ptr, Storage.To_Integer (Handle_Hook'Address)); end return; end Create; @@ -135,12 +141,16 @@ package body FLTK.Widgets.Menus.Choices is - function Chosen + ----------------------- + -- API Subprograms -- + ----------------------- + + function Get_Chosen (This : in Choice) return FLTK.Menu_Items.Menu_Item_Reference is begin return (Data => This.My_Items.Element (This.Chosen_Index)); - end Chosen; + end Get_Chosen; function Chosen_Index @@ -176,7 +186,7 @@ package body FLTK.Widgets.Menus.Choices is procedure Draw (This : in out Choice) is begin - fl_choice_draw (This.Void_Ptr); + Menu (This).Draw; end Draw; @@ -185,10 +195,10 @@ package body FLTK.Widgets.Menus.Choices is Event : in Event_Kind) return Event_Outcome is begin - return Event_Outcome'Val - (fl_choice_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + return Menu (This).Handle (Event); end Handle; end FLTK.Widgets.Menus.Choices; + |