diff options
Diffstat (limited to 'body/fltk-widgets-groups-color_choosers.adb')
-rw-r--r-- | body/fltk-widgets-groups-color_choosers.adb | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/body/fltk-widgets-groups-color_choosers.adb b/body/fltk-widgets-groups-color_choosers.adb index 15f34ed..cce0f08 100644 --- a/body/fltk-widgets-groups-color_choosers.adb +++ b/body/fltk-widgets-groups-color_choosers.adb @@ -26,6 +26,8 @@ package body FLTK.Widgets.Groups.Color_Choosers is -- Functions From C -- ------------------------ + -- Allocation -- + function new_fl_color_chooser (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -41,6 +43,8 @@ package body FLTK.Widgets.Groups.Color_Choosers is + -- RGB Color -- + function fl_color_chooser_r (N : in Storage.Integer_Address) return Interfaces.C.double; @@ -69,6 +73,8 @@ package body FLTK.Widgets.Groups.Color_Choosers is + -- HSV Color -- + function fl_color_chooser_hue (N : in Storage.Integer_Address) return Interfaces.C.double; @@ -97,6 +103,8 @@ package body FLTK.Widgets.Groups.Color_Choosers is + -- RGB / HSV Conversion -- + procedure fl_color_chooser_hsv2rgb (H, S, V : in Interfaces.C.double; R, G, B : out Interfaces.C.double); @@ -112,6 +120,8 @@ package body FLTK.Widgets.Groups.Color_Choosers is + -- Settings -- + function fl_color_chooser_get_mode (N : in Storage.Integer_Address) return Interfaces.C.int; @@ -127,6 +137,8 @@ package body FLTK.Widgets.Groups.Color_Choosers is + -- Drawing, Events -- + procedure fl_color_chooser_draw (W : in Storage.Integer_Address); pragma Import (C, fl_color_chooser_draw, "fl_color_chooser_draw"); @@ -196,11 +208,11 @@ package body FLTK.Widgets.Groups.Color_Choosers is begin return This : Color_Chooser do This.Void_Ptr := new_fl_color_chooser - (Interfaces.C.int (X), - Interfaces.C.int (Y), - Interfaces.C.int (W), - Interfaces.C.int (H), - Interfaces.C.To_C (Text)); + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.To_C (Text)); Extra_Init (This, X, Y, W, H, Text); end return; end Create; @@ -226,6 +238,8 @@ package body FLTK.Widgets.Groups.Color_Choosers is -- API Subprograms -- ----------------------- + -- RGB Color -- + function Get_Red (This : in Color_Chooser) return Long_Float is @@ -254,7 +268,7 @@ package body FLTK.Widgets.Groups.Color_Choosers is (This : in out Color_Chooser; R, G, B : in Long_Float) is - Result : Interfaces.C.int := fl_color_chooser_rgb + Result : constant Interfaces.C.int := fl_color_chooser_rgb (This.Void_Ptr, Interfaces.C.double (R), Interfaces.C.double (G), @@ -262,7 +276,9 @@ package body FLTK.Widgets.Groups.Color_Choosers is begin pragma Assert (Result in 0 .. 1); exception - when Chk.Assertion_Error => raise Internal_FLTK_Error; + when Chk.Assertion_Error => raise Internal_FLTK_Error with + "Fl_Color_Chooser::rgb returned unexpected int value of " & + Interfaces.C.int'Image (Result); end Set_RGB; @@ -271,7 +287,7 @@ package body FLTK.Widgets.Groups.Color_Choosers is R, G, B : in Long_Float) return Boolean is - Result : Interfaces.C.int := fl_color_chooser_rgb + Result : constant Interfaces.C.int := fl_color_chooser_rgb (This.Void_Ptr, Interfaces.C.double (R), Interfaces.C.double (G), @@ -279,12 +295,16 @@ package body FLTK.Widgets.Groups.Color_Choosers is begin return Boolean'Val (Result); exception - when Constraint_Error => raise Internal_FLTK_Error; + when Constraint_Error => raise Internal_FLTK_Error with + "Fl_Color_Chooser::rgb returned unexpected int value of " & + Interfaces.C.int'Image (Result); end Set_RGB; + -- HSV Color -- + function Get_Hue (This : in Color_Chooser) return Long_Float is @@ -313,7 +333,7 @@ package body FLTK.Widgets.Groups.Color_Choosers is (This : in out Color_Chooser; H, S, V : in Long_Float) is - Result : Interfaces.C.int := fl_color_chooser_hsv + Result : constant Interfaces.C.int := fl_color_chooser_hsv (This.Void_Ptr, Interfaces.C.double (H), Interfaces.C.double (S), @@ -321,7 +341,9 @@ package body FLTK.Widgets.Groups.Color_Choosers is begin pragma Assert (Result in 0 .. 1); exception - when Chk.Assertion_Error => raise Internal_FLTK_Error; + when Chk.Assertion_Error => raise Internal_FLTK_Error with + "Fl_Color_Chooser:hsv returned unexpected int value of " & + Interfaces.C.int'Image (Result); end Set_HSV; @@ -330,7 +352,7 @@ package body FLTK.Widgets.Groups.Color_Choosers is H, S, V : in Long_Float) return Boolean is - Result : Interfaces.C.int := fl_color_chooser_hsv + Result : constant Interfaces.C.int := fl_color_chooser_hsv (This.Void_Ptr, Interfaces.C.double (H), Interfaces.C.double (S), @@ -338,12 +360,16 @@ package body FLTK.Widgets.Groups.Color_Choosers is begin return Boolean'Val (Result); exception - when Constraint_Error => raise Internal_FLTK_Error; + when Constraint_Error => raise Internal_FLTK_Error with + "Fl_Color_Chooser::hsv returned unexpected int value of " & + Interfaces.C.int'Image (Result); end Set_HSV; + -- RGB / HSV Conversion -- + procedure HSV_To_RGB (H, S, V : in Long_Float; R, G, B : out Long_Float) is @@ -374,6 +400,8 @@ package body FLTK.Widgets.Groups.Color_Choosers is + -- Settings -- + function Get_Mode (This : in Color_Chooser) return Color_Mode is |