From f9e453e3d456514066e8ecbed9fbac93a588a0d0 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Tue, 21 Jan 2025 00:53:56 +1300 Subject: Using the type method is now more consistent --- src/fltk-widgets-valuators-counters.adb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/fltk-widgets-valuators-counters.adb') diff --git a/src/fltk-widgets-valuators-counters.adb b/src/fltk-widgets-valuators-counters.adb index 619b074..e04e180 100644 --- a/src/fltk-widgets-valuators-counters.adb +++ b/src/fltk-widgets-valuators-counters.adb @@ -309,6 +309,36 @@ package body FLTK.Widgets.Valuators.Counters is end Handle; + + + function Get_Kind + (This : in out Counter) + return Counter_Kind + is + Result : Interfaces.C.unsigned_char := fl_widget_get_type (This.Void_Ptr); + begin + return Counter_Kind'Val (Result); + exception + when Constraint_Error => raise Internal_FLTK_Error with + "Fl_Counter::type returned unexpected unsigned char value of " & + Interfaces.C.unsigned_char'Image (Result); + end Get_Kind; + + + package body Extra is + + procedure Set_Kind + (This : in out Counter; + Value : in Counter_Kind) is + begin + fl_widget_set_type (This.Void_Ptr, Counter_Kind'Pos (Value)); + end Set_Kind; + + pragma Inline (Set_Kind); + + end Extra; + + end FLTK.Widgets.Valuators.Counters; -- cgit