summaryrefslogtreecommitdiff
path: root/src/displays.ads
blob: 22f3bed40216ad3632d54a62343b8c3bff206414 (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


with

    FLTK.Widgets.Groups.Windows.Double,
    Grids;

private with

    FLTK.Widgets.Boxes,
    FLTK.Images.RGB.PNG,
    Misc;


package Displays is


    type Display is new FLTK.Widgets.Groups.Windows.Double.Double_Window with private;




    type Keyboard_Callback is access function
           (Key : in FLTK.Key_Combo)
        return FLTK.Event_Outcome;

    type Mouse_Callback is access function
           (X, Y : in Integer)
        return FLTK.Event_Outcome;




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

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

    function Create
        return Display;




    procedure Set_Grid
           (This : in out Display;
            To   : in out Grids.Grid);

    procedure Adjust_Grid
           (This       : in out Display;
            Cols, Rows : in     Natural);

    procedure Ensure_Correct_Size
           (This : in out Display);

    procedure Centre_On_Screen
           (This : in out Display);




    procedure Set_Message
           (This : in out Display;
            Msg  : in     String);

    procedure Set_Level_Number
           (This : in out Display;
            To   : in     Natural);

    procedure Set_Move_Number
           (This : in out Display;
            To   : in     Natural);




    procedure Set_Keyboard_Callback
           (This : in out Display;
            Func : in     Keyboard_Callback);

    procedure Set_Mouse_Callback
           (This : in out Display;
            Func : in     Mouse_Callback);




    function Handle
           (This  : in out Display;
            Event : in     FLTK.Event_Kind)
        return FLTK.Event_Outcome;


private


    type Display is new FLTK.Widgets.Groups.Windows.Double.Double_Window with record
        Message_Box  : FLTK.Widgets.Boxes.Box;
        Level_Box    : FLTK.Widgets.Boxes.Box;
        Move_Box     : FLTK.Widgets.Boxes.Box;
        Current_Grid : access Grids.Grid;
        Key_Func     : Keyboard_Callback;
        Mouse_Func   : Mouse_Callback;
    end record;


    Logo : FLTK.Images.RGB.PNG.PNG_Image :=
        FLTK.Images.RGB.PNG.Forge.Create (Misc.Origin & "/../share/sokoban/img/man.png");


    Text_Size : constant FLTK.Font_Size := 12;
    Message_Box_Width  : constant Integer := 440;
    Message_Box_Height : constant Integer := 80;


    Stat_Box_Width  : constant Integer := Message_Box_Width / 2;
    Stat_Box_Height : constant Integer := 20;


end Displays;