diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-16 12:17:46 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-16 12:17:46 +1300 |
commit | ba1719013e5bab82a2accb4aadfd8451c3ebc931 (patch) | |
tree | 0ce67b8257b0ed05e50704ec6a808aac0659816b /src/fltk-widgets-menus-choices.adb | |
parent | 106316bcedec72c5380a7544c27be6a5c117e57a (diff) |
Fixed bug in Fl_Choice binding, filled small hole in Fl_Menu_Button binding
Diffstat (limited to 'src/fltk-widgets-menus-choices.adb')
-rw-r--r-- | src/fltk-widgets-menus-choices.adb | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/fltk-widgets-menus-choices.adb b/src/fltk-widgets-menus-choices.adb index f0fb03a..09c58b8 100644 --- a/src/fltk-widgets-menus-choices.adb +++ b/src/fltk-widgets-menus-choices.adb @@ -43,14 +43,14 @@ package body FLTK.Widgets.Menus.Choices is pragma Inline (fl_choice_value); function fl_choice_set_value - (M : in Storage.Integer_Address; - I : in Interfaces.C.int) + (M, I : in Storage.Integer_Address) return Interfaces.C.int; pragma Import (C, fl_choice_set_value, "fl_choice_set_value"); pragma Inline (fl_choice_set_value); function fl_choice_set_value2 - (M, I : in Storage.Integer_Address) + (M : in Storage.Integer_Address; + I : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_choice_set_value2, "fl_choice_set_value2"); pragma Inline (fl_choice_set_value2); @@ -145,14 +145,6 @@ package body FLTK.Widgets.Menus.Choices is -- 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 Get_Chosen; - - function Chosen_Index (This : in Choice) return Extended_Index is @@ -162,22 +154,40 @@ package body FLTK.Widgets.Menus.Choices is procedure Set_Chosen - (This : in out Choice; - Place : in Index) + (This : in out Choice; + Item : in FLTK.Menu_Items.Menu_Item) is Ignore_Ret : Interfaces.C.int; begin - Ignore_Ret := fl_choice_set_value (This.Void_Ptr, Interfaces.C.int (Place) - 1); + Ignore_Ret := fl_choice_set_value (This.Void_Ptr, Wrapper (Item).Void_Ptr); end Set_Chosen; - procedure Set_Chosen + function Set_Chosen (This : in out Choice; Item : in FLTK.Menu_Items.Menu_Item) + return Boolean is + begin + return fl_choice_set_value (This.Void_Ptr, Wrapper (Item).Void_Ptr) /= 0; + end Set_Chosen; + + + procedure Set_Chosen + (This : in out Choice; + Place : in Index) is Ignore_Ret : Interfaces.C.int; begin - Ignore_Ret := fl_choice_set_value2 (This.Void_Ptr, Wrapper (Item).Void_Ptr); + Ignore_Ret := fl_choice_set_value2 (This.Void_Ptr, Interfaces.C.int (Place) - 1); + end Set_Chosen; + + + function Set_Chosen + (This : in out Choice; + Place : in Index) + return Boolean is + begin + return fl_choice_set_value2 (This.Void_Ptr, Interfaces.C.int (Place) - 1) /= 0; end Set_Chosen; |