summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-groups-windows-double-cairo.ads
blob: 111f7ac049db7920e1b406c2ad4de10396353ce1 (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


--  Programmed by Jedidiah Barber
--  Released into the public domain


with

    System;


package FLTK.Widgets.Groups.Windows.Double.Cairo is


    --  If FLTK has not been built with Cairo support then
    --  this will just be a duplicate of Double_Window and the
    --  callback set with Set_Cairo_Draw will never be triggered.

    --  Building with Cairo support requires either of
    --  1. CMake option FLTK_OPTION_CAIRO_WINDOW
    --  2. configure -enable-cairo
    --  when building FLTK itself.


    type Cairo_Window is new Double_Window with private;

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

    type Cairo_Callback is access procedure
           (This    : in out Cairo_Window;
            Context : in     System.Address);




    package Forge is

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

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

        function Create
               (W, H : in Integer)
            return Cairo_Window;

    end Forge;




    procedure Set_Cairo_Draw
           (This : in out Cairo_Window;
            Func : in     Cairo_Callback);




    procedure Draw
           (This : in out Cairo_Window);

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


private


    type Cairo_Window is new Double_Window with record
        My_Func : Cairo_Callback;
    end record;

    overriding procedure Finalize
           (This : in out Cairo_Window);

    procedure Extra_Init
           (This       : in out Cairo_Window;
            X, Y, W, H : in     Integer;
            Text       : in     String);

    procedure Extra_Final
           (This : in out Cairo_Window);


    pragma Inline (Set_Cairo_Draw);

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


end FLTK.Widgets.Groups.Windows.Double.Cairo;