summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-groups-spinners.adb
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2025-01-21 00:53:56 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2025-01-21 00:53:56 +1300
commitf9e453e3d456514066e8ecbed9fbac93a588a0d0 (patch)
tree06587afde830fb324d5ab7372f0f1686c4fd993a /src/fltk-widgets-groups-spinners.adb
parent67a43ef89ba41ac32b86cda7396c16fffaf691b3 (diff)
Using the type method is now more consistent
Diffstat (limited to 'src/fltk-widgets-groups-spinners.adb')
-rw-r--r--src/fltk-widgets-groups-spinners.adb24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/fltk-widgets-groups-spinners.adb b/src/fltk-widgets-groups-spinners.adb
index 00293eb..d73d3e9 100644
--- a/src/fltk-widgets-groups-spinners.adb
+++ b/src/fltk-widgets-groups-spinners.adb
@@ -10,7 +10,7 @@ with
use type
- Interfaces.C.int,
+ Interfaces.C.unsigned_char,
Interfaces.C.Strings.chars_ptr;
@@ -170,13 +170,13 @@ package body FLTK.Widgets.Groups.Spinners is
function fl_spinner_get_type
(S : in Storage.Integer_Address)
- return Interfaces.C.int;
+ return Interfaces.C.unsigned_char;
pragma Import (C, fl_spinner_get_type, "fl_spinner_get_type");
pragma Inline (fl_spinner_get_type);
procedure fl_spinner_set_type
(S : in Storage.Integer_Address;
- T : in Interfaces.C.int);
+ T : in Interfaces.C.unsigned_char);
pragma Import (C, fl_spinner_set_type, "fl_spinner_set_type");
pragma Inline (fl_spinner_set_type);
@@ -483,20 +483,26 @@ package body FLTK.Widgets.Groups.Spinners is
end Set_Format;
- function Get_Type
+ function Get_Kind
(This : in Spinner)
- return Spinner_Kind is
+ return Spinner_Kind
+ is
+ Result : Interfaces.C.unsigned_char := fl_spinner_get_type (This.Void_Ptr);
begin
- return Spinner_Kind'Val (fl_spinner_get_type (This.Void_Ptr) - 1);
- end Get_Type;
+ return Spinner_Kind'Val (Result - 1);
+ exception
+ when Constraint_Error => raise Internal_FLTK_Error with
+ "Fl_Spinner::type returned unexpected unsigned char value of " &
+ Interfaces.C.unsigned_char'Image (Result);
+ end Get_Kind;
- procedure Set_Type
+ procedure Set_Kind
(This : in out Spinner;
To : in Spinner_Kind) is
begin
fl_spinner_set_type (This.Void_Ptr, Spinner_Kind'Pos (To) + 1);
- end Set_Type;
+ end Set_Kind;