openglada_glfw_0.9.0_fc25165c/src/glfw-monitors.ads

 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
--  part of OpenGLAda, (c) 2017 Felix Krause
--  released under the terms of the MIT license, see the file "COPYING"

with System;

package Glfw.Monitors is

   type Event is (Connected, Disconnected);

   type Video_Mode is record
      Width, Height : Interfaces.C.int;
      Red_Bits, Green_Bits, Blue_Bits : Interfaces.C.int;
      Refresh_Rate : Interfaces.C.int;
   end record;

   type Gamma_Value_Array is array (Positive range <>) of aliased
     Interfaces.C.unsigned_short;

   type Gamma_Ramp (Size : Positive) is record
      Red, Green, Blue : Gamma_Value_Array (1 .. Size);
   end record;

   type Monitor is tagged private;

   No_Monitor : constant Monitor;

   type Monitor_List is array (Positive range <>) of Monitor;
   type Video_Mode_List is array (Positive range <>) of aliased Video_Mode;

   pragma Convention (C, Video_Mode);
   pragma Convention (C, Video_Mode_List);

   function Monitors return Monitor_List;
   function Primary_Monitor return Monitor;

   procedure Get_Position (Object : Monitor; X, Y : out Integer);
   procedure Get_Physical_Size (Object : Monitor; Width, Height : out Integer);
   function Name (Object : Monitor) return String;
   function Video_Modes (Object : Monitor) return Video_Mode_List;
   function Current_Video_Mode (Object : Monitor) return Video_Mode;
   procedure Set_Gamma (Object : Monitor; Gamma : Float);
   function Current_Gamma_Ramp (Object : Monitor) return Gamma_Ramp;
   procedure Set_Gamma_Ramp (Object : Monitor; Value : Gamma_Ramp);

   -- used internally
   function Raw_Pointer (Object : Monitor) return System.Address;
private
   type Monitor is tagged record
      Handle : System.Address;
   end record;

   No_Monitor : constant Monitor := (Handle => System.Null_Address);

   for Event use (Connected    => 16#00040001#,
                  Disconnected => 16#00040002#);
   for Event'Size use Interfaces.C.int'Size;


end Glfw.Monitors;