From dc8e0bf275d2b0cc044022b13e5139d1cbc6fd86 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sun, 30 Jul 2017 12:51:47 +1000 Subject: Added some FLTK global screen functions --- src/fltk-screen.adb | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/fltk-screen.ads | 33 ++++++++++++++++++++ src/fltk.ads | 4 +-- 3 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 src/fltk-screen.adb create mode 100644 src/fltk-screen.ads diff --git a/src/fltk-screen.adb b/src/fltk-screen.adb new file mode 100644 index 0000000..042cbfd --- /dev/null +++ b/src/fltk-screen.adb @@ -0,0 +1,87 @@ + + +with + + Interfaces.C; + +use type + + Interfaces.C.int; + + +package body FLTK.Screen is + + + function screen_x return Interfaces.C.int; + pragma Import (C, screen_x, "screen_x"); + + function screen_y return Interfaces.C.int; + pragma Import (C, screen_y, "screen_y"); + + function screen_w return Interfaces.C.int; + pragma Import (C, screen_w, "screen_w"); + + function screen_h return Interfaces.C.int; + pragma Import (C, screen_h, "screen_h"); + + + + + function screen_count return Interfaces.C.int; + pragma Import (C, screen_count, "screen_count"); + + procedure screen_dpi + (H, V : out Interfaces.C.C_float; + N : in Interfaces.C.int); + pragma Import (C, screen_dpi, "screen_dpi"); + + + + + function Get_X return Integer is + begin + return Integer (screen_x); + end Get_X; + + + function Get_Y return Integer is + begin + return Integer (screen_y); + end Get_Y; + + + function Get_W return Integer is + begin + return Integer (screen_w); + end Get_W; + + + function Get_H return Integer is + begin + return Integer (screen_h); + end Get_H; + + + + + function Get_Count return Integer is + begin + return Integer (screen_count); + end Get_Count; + + + -- Screen numbers in the range 1 .. Get_Count + procedure Get_DPI + (Horizontal, Vertical : out Float; + Screen_Number : in Integer := 1) + is + H, V : Interfaces.C.C_float; + begin + screen_dpi (H, V, Interfaces.C.int (Screen_Number) - 1); + Horizontal := Float (H); + Vertical := Float (V); + end Get_DPI; + + +end FLTK.Screen; + diff --git a/src/fltk-screen.ads b/src/fltk-screen.ads new file mode 100644 index 0000000..10060d4 --- /dev/null +++ b/src/fltk-screen.ads @@ -0,0 +1,33 @@ + + +package FLTK.Screen is + + + function Get_X return Integer; + function Get_Y return Integer; + function Get_W return Integer; + function Get_H return Integer; + + + function Get_Count return Integer; + + + -- Screen numbers in the range 1 .. Get_Count + procedure Get_DPI + (Horizontal, Vertical : out Float; + Screen_Number : in Integer := 1); + + +private + + + pragma Inline (Get_X); + pragma Inline (Get_Y); + pragma Inline (Get_W); + pragma Inline (Get_H); + pragma Inline (Get_Count); + pragma Inline (Get_DPI); + + +end FLTK.Screen; + diff --git a/src/fltk.ads b/src/fltk.ads index 203ee5e..d07435e 100644 --- a/src/fltk.ads +++ b/src/fltk.ads @@ -138,8 +138,8 @@ package FLTK is Times_Italic, Times_Bold_Italic, Symbol, - Screen, - Screen_Bold, + Monospace, + Monospace_Bold, Zapf_Dingbats, Free_Font); -- cgit