summaryrefslogtreecommitdiff
path: root/src/fltk-menu_items.ads
blob: 5964a48a4d4a1ba012e0600eeaa68679da9365a8 (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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210

with

    FLTK.Widgets;


package FLTK.Menu_Items is


    type Menu_Item is new Wrapper with private;

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




    package Forge is

        --  Usually you don't bother with this and just add items
        --  to Menus directly using the Add subprograms in that package.

        function Create
               (Text        : in String;
                Action      : in FLTK.Widgets.Widget_Callback := null;
                Shortcut    : in Key_Combo := No_Key;
                Flags       : in Menu_Flag := Flag_Normal)
            return Menu_Item;

    end Forge;




    function Get_Callback
           (Item : in Menu_Item)
        return FLTK.Widgets.Widget_Callback;

    procedure Set_Callback
           (Item : in out Menu_Item;
            Func : in     FLTK.Widgets.Widget_Callback);

    procedure Do_Callback
           (Item   : in out Menu_Item;
            Widget : in out FLTK.Widgets.Widget'Class);




    function Has_Checkbox
           (Item : in Menu_Item)
        return Boolean;

    function Is_Radio
           (Item : in Menu_Item)
        return Boolean;

    function Get_State
           (Item : in Menu_Item)
        return Boolean;

    procedure Set_State
           (Item : in out Menu_Item;
            To   : in     Boolean);

    procedure Set_Only
           (Item : in out Menu_Item);




    function Get_Label
           (Item : in Menu_Item)
        return String;

    procedure Set_Label
           (Item : in out Menu_Item;
            Text : in     String);

    function Get_Label_Color
           (Item : in Menu_Item)
        return Color;

    procedure Set_Label_Color
           (Item : in out Menu_Item;
            To   : in     Color);

    function Get_Label_Font
           (Item : in Menu_Item)
        return Font_Kind;

    procedure Set_Label_Font
           (Item : in out Menu_Item;
            To   : in     Font_Kind);

    function Get_Label_Size
           (Item : in Menu_Item)
        return Font_Size;

    procedure Set_Label_Size
           (Item : in out Menu_Item;
            To   : in     Font_Size);

    function Get_Label_Type
           (Item : in Menu_Item)
        return Label_Kind;

    procedure Set_Label_Type
           (Item : in out Menu_Item;
            To   : in     Label_Kind);




    function Get_Shortcut
           (Item : in Menu_Item)
        return Key_Combo;

    procedure Set_Shortcut
           (Item : in out Menu_Item;
            To   : in     Key_Combo);

    function Get_Flags
           (Item : in Menu_Item)
        return Menu_Flag;

    procedure Set_Flags
           (Item : in out Menu_Item;
            To   : in     Menu_Flag);




    procedure Activate
           (Item : in out Menu_Item);

    procedure Deactivate
           (Item : in out Menu_Item);

    procedure Show
           (Item : in out Menu_Item);

    procedure Hide
           (Item : in out Menu_Item);

    function Is_Active
           (Item : in Menu_Item)
        return Boolean;

    function Is_Visible
           (Item : in Menu_Item)
        return Boolean;

    function Is_Active_And_Visible
           (Item : in Menu_Item)
        return Boolean;


private


    type Menu_Item is new Wrapper with null record;

    overriding procedure Finalize
           (This : in out Menu_Item);




    pragma Inline (Get_Callback);
    pragma Inline (Set_Callback);
    pragma Inline (Do_Callback);


    pragma Inline (Has_Checkbox);
    pragma Inline (Is_Radio);
    pragma Inline (Get_State);
    pragma Inline (Set_State);
    pragma Inline (Set_Only);


    pragma Inline (Get_Label);
    pragma Inline (Set_Label);
    pragma Inline (Get_Label_Color);
    pragma Inline (Set_Label_Color);
    pragma Inline (Get_Label_Font);
    pragma Inline (Set_Label_Font);
    pragma Inline (Get_Label_Size);
    pragma Inline (Set_Label_Size);
    pragma Inline (Get_Label_Type);
    pragma Inline (Set_Label_Type);


    pragma Inline (Get_Shortcut);
    pragma Inline (Set_Shortcut);
    pragma Inline (Get_Flags);
    pragma Inline (Set_Flags);


    pragma Inline (Activate);
    pragma Inline (Deactivate);
    pragma Inline (Show);
    pragma Inline (Hide);
    pragma Inline (Is_Active);
    pragma Inline (Is_Visible);
    pragma Inline (Is_Active_And_Visible);


end FLTK.Menu_Items;