From b870f2a1e8fcb956ce316e6a600d7d0625604830 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Sun, 29 Dec 2024 23:51:07 +1300 Subject: Revised FLTK.Devices.Surface subhierarchy --- src/fltk-devices-surface-paged.ads | 74 +++++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 5 deletions(-) (limited to 'src/fltk-devices-surface-paged.ads') diff --git a/src/fltk-devices-surface-paged.ads b/src/fltk-devices-surface-paged.ads index 1a3c13c..b445c62 100644 --- a/src/fltk-devices-surface-paged.ads +++ b/src/fltk-devices-surface-paged.ads @@ -8,25 +8,55 @@ with FLTK.Widgets.Groups.Windows; +private with + + Ada.Strings.Unbounded; + package FLTK.Devices.Surface.Paged is + pragma Elaborate_Body (FLTK.Devices.Surface.Paged); + + type Paged_Device is new Surface_Device with private; type Paged_Device_Reference (Data : not null access Paged_Device'Class) is limited null record with Implicit_Dereference => Data; + type Page_Format is (A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, C5E, DLE, Executive, Folio, Ledger, - Legal, Letter, Tabloid, Envelope); + Legal, Letter, Tabloid, Envelope, Media); + + + -- Note that the Name in the format information may not quite + -- correspond to the 'Image of the indexing Page_Format enumeration! + type Page_Format_Info is tagged private; + + function Name + (This : in Page_Format_Info) + return String; + + function Width + (This : in Page_Format_Info) + return Natural; + + function Height + (This : in Page_Format_Info) + return Natural; + + type Page_Format_Info_Array is array (Page_Format range <>) of Page_Format_Info; + type Page_Layout is - (Potrait, Landscape, Reversed, Orientation); + (Portrait, Landscape, Reversed, Orientation); + -- Information for everything except for Media + Page_Formats : constant Page_Format_Info_Array (A0 .. Envelope); Page_Error : exception; @@ -36,6 +66,7 @@ package FLTK.Devices.Surface.Paged is package Forge is + -- Docs say there should be no reason to use this but it's here anyway. function Create return Paged_Device; @@ -46,12 +77,12 @@ package FLTK.Devices.Surface.Paged is procedure Start_Job (This : in out Paged_Device; - Count : in Natural); + Count : in Natural := 0); procedure Start_Job (This : in out Paged_Device; - Count : in Natural; - From, To : in Positive); + Count : in Natural := 0; + From, To : out Positive); procedure End_Job (This : in out Paged_Device); @@ -129,6 +160,39 @@ private (This : in out Paged_Device); + function To_Cint + (Value : in Page_Format) + return Interfaces.C.int; + + function To_Page_Format + (Value : in Interfaces.C.int) + return Page_Format; + + function To_Cint + (Value : in Page_Layout) + return Interfaces.C.int; + + function To_Page_Layout + (Value : in Interfaces.C.int) + return Page_Layout; + + + type Page_Format_Info is tagged record + My_Name : Ada.Strings.Unbounded.Unbounded_String; + My_Width : Natural; + My_Height : Natural; + end record; + + function Get_Page_Formats + return Page_Format_Info_Array; + + Page_Formats : constant Page_Format_Info_Array (A0 .. Envelope) := Get_Page_Formats; + + + pragma Inline (Name); + pragma Inline (Width); + pragma Inline (Height); + pragma Inline (Start_Job); pragma Inline (End_Job); pragma Inline (Start_Page); -- cgit