summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-groups-color_choosers.ads
blob: abc59748676b5781774a7019f2c8b9e2351b5614 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149


package FLTK.Widgets.Groups.Color_Choosers is


    type Color_Chooser is new Group with private;

    type Color_Chooser_Reference (Data : not null access Color_Chooser'Class) is
        limited null record with Implicit_Dereference => Data;

    type Color_Mode is (RGB, Byte, Hex, HSV);




    package Forge is

        function Create
               (X, Y, W, H : in Integer;
                Text       : in String := "")
            return Color_Chooser;

    end Forge;




    function Get_Red
           (This : in Color_Chooser)
        return Long_Float;

    function Get_Green
           (This : in Color_Chooser)
        return Long_Float;

    function Get_Blue
           (This : in Color_Chooser)
        return Long_Float;

    procedure Set_RGB
           (This    : in out Color_Chooser;
            R, G, B : in     Long_Float);




    function Get_Hue
           (This : in Color_Chooser)
        return Long_Float;

    function Get_Saturation
           (This : in Color_Chooser)
        return Long_Float;

    function Get_Value
           (This : in Color_Chooser)
        return Long_Float;

    procedure Set_HSV
           (This    : in out Color_Chooser;
            H, S, V : in     Long_Float);




    procedure HSV_To_RGB
           (H, S, V : in     Long_Float;
            R, G, B :    out Long_Float);

    procedure RGB_To_HSV
           (R, G, B : in     Long_Float;
            H, S, V :    out Long_Float);




    function Color_Was_Changed
           (This : in Color_Chooser)
        return Boolean;

    procedure Clear_Changed
           (This : in out Color_Chooser);




    function Get_Mode
           (This : in Color_Chooser)
        return Color_Mode;

    procedure Set_Mode
           (This : in out Color_Chooser;
            To   : in     Color_Mode);




    procedure Draw
           (This : in out Color_Chooser);

    function Handle
           (This  : in out Color_Chooser;
            Event : in     Event_Kind)
        return Event_Outcome;


private


    type Color_Chooser is new Group with record
        Was_Changed : Boolean := False;
    end record;

    overriding procedure Finalize
           (This : in out Color_Chooser);




    pragma Inline (Get_Red);
    pragma Inline (Get_Green);
    pragma Inline (Get_Blue);
    pragma Inline (Set_RGB);


    pragma Inline (Get_Hue);
    pragma Inline (Get_Saturation);
    pragma Inline (Get_Value);
    pragma Inline (Set_HSV);


    pragma Inline (HSV_To_RGB);
    pragma Inline (RGB_To_HSV);


    pragma Inline (Color_Was_Changed);
    pragma Inline (Clear_Changed);


    pragma Inline (Get_Mode);
    pragma Inline (Set_Mode);


    pragma Inline (Draw);
    pragma Inline (Handle);


end FLTK.Widgets.Groups.Color_Choosers;