From 6f1e7c19776d10878db0eb674339cf656972811f Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Wed, 27 Nov 2024 12:32:46 +1300 Subject: Fl_Cairo_Window binding added --- src/fltk-widgets-groups-windows-double-cairo.ads | 101 +++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 src/fltk-widgets-groups-windows-double-cairo.ads (limited to 'src/fltk-widgets-groups-windows-double-cairo.ads') diff --git a/src/fltk-widgets-groups-windows-double-cairo.ads b/src/fltk-widgets-groups-windows-double-cairo.ads new file mode 100644 index 0000000..111f7ac --- /dev/null +++ b/src/fltk-widgets-groups-windows-double-cairo.ads @@ -0,0 +1,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; + + -- cgit