diff options
Diffstat (limited to 'src/fltk-widgets-groups-windows-double-overlay.adb')
-rw-r--r-- | src/fltk-widgets-groups-windows-double-overlay.adb | 262 |
1 files changed, 262 insertions, 0 deletions
diff --git a/src/fltk-widgets-groups-windows-double-overlay.adb b/src/fltk-widgets-groups-windows-double-overlay.adb new file mode 100644 index 0000000..e61782a --- /dev/null +++ b/src/fltk-widgets-groups-windows-double-overlay.adb @@ -0,0 +1,262 @@ + + +with + + Interfaces.C, + System.Address_To_Access_Conversions; + +use type + + Interfaces.C.int, + System.Address; + + +package body FLTK.Widgets.Groups.Windows.Double.Overlay is + + + procedure overlay_window_set_draw_hook + (W, D : in System.Address); + pragma Import (C, overlay_window_set_draw_hook, "overlay_window_set_draw_hook"); + pragma Inline (overlay_window_set_draw_hook); + + procedure overlay_window_set_draw_overlay_hook + (W, D : in System.Address); + pragma Import (C, overlay_window_set_draw_overlay_hook, + "overlay_window_set_draw_overlay_hook"); + pragma Inline (overlay_window_set_draw_overlay_hook); + + procedure overlay_window_set_handle_hook + (W, H : in System.Address); + pragma Import (C, overlay_window_set_handle_hook, "overlay_window_set_handle_hook"); + pragma Inline (overlay_window_set_handle_hook); + + + + + function new_fl_overlay_window + (X, Y, W, H : in Interfaces.C.int; + Text : in Interfaces.C.char_array) + return System.Address; + pragma Import (C, new_fl_overlay_window, "new_fl_overlay_window"); + pragma Inline (new_fl_overlay_window); + + function new_fl_overlay_window2 + (W, H : in Interfaces.C.int; + Text : in Interfaces.C.char_array) + return System.Address; + pragma Import (C, new_fl_overlay_window2, "new_fl_overlay_window2"); + pragma Inline (new_fl_overlay_window2); + + procedure free_fl_overlay_window + (S : in System.Address); + pragma Import (C, free_fl_overlay_window, "free_fl_overlay_window"); + pragma Inline (free_fl_overlay_window); + + + + + procedure fl_overlay_window_show + (W : in System.Address); + pragma Import (C, fl_overlay_window_show, "fl_overlay_window_show"); + pragma Inline (fl_overlay_window_show); + + procedure fl_overlay_window_hide + (W : in System.Address); + pragma Import (C, fl_overlay_window_hide, "fl_overlay_window_hide"); + pragma Inline (fl_overlay_window_hide); + + procedure fl_overlay_window_flush + (W : in System.Address); + pragma Import (C, fl_overlay_window_flush, "fl_overlay_window_flush"); + pragma Inline (fl_overlay_window_flush); + + + + + function fl_overlay_window_can_do_overlay + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_overlay_window_can_do_overlay, "fl_overlay_window_can_do_overlay"); + pragma Inline (fl_overlay_window_can_do_overlay); + + + + + procedure fl_overlay_window_draw + (W : in System.Address); + pragma Import (C, fl_overlay_window_draw, "fl_overlay_window_draw"); + pragma Inline (fl_overlay_window_draw); + + procedure fl_overlay_window_redraw_overlay + (W : in System.Address); + pragma Import (C, fl_overlay_window_redraw_overlay, "fl_overlay_window_redraw_overlay"); + pragma Inline (fl_overlay_window_redraw_overlay); + + function fl_overlay_window_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_overlay_window_handle, "fl_overlay_window_handle"); + pragma Inline (fl_overlay_window_handle); + + + + + package Over_Convert is new System.Address_To_Access_Conversions (Overlay_Window'Class); + + + procedure Draw_Overlay_Hook + (U : in System.Address) + is + Overlay_Widget : access Overlay_Window'Class := + Over_Convert.To_Pointer (U); + begin + Overlay_Widget.Draw_Overlay; + end Draw_Overlay_Hook; + + + + + procedure Finalize + (This : in out Overlay_Window) is + begin + if This.Void_Ptr /= System.Null_Address and then + This in Overlay_Window'Class + then + This.Clear; + free_fl_overlay_window (This.Void_Ptr); + This.Void_Ptr := System.Null_Address; + end if; + Finalize (Double_Window (This)); + end Finalize; + + + + + -------------------- + -- Constructors -- + -------------------- + + package body Forge is + + function Create + (X, Y, W, H : in Integer; + Text : in String := "") + return Overlay_Window is + begin + return This : Overlay_Window do + This.Void_Ptr := new_fl_overlay_window + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.To_C (Text)); + fl_group_end (This.Void_Ptr); + fl_widget_set_user_data + (This.Void_Ptr, + Widget_Convert.To_Address (This'Unchecked_Access)); + overlay_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + overlay_window_set_draw_overlay_hook (This.Void_Ptr, Draw_Overlay_Hook'Address); + overlay_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); + fl_widget_set_label (This.Void_Ptr, Interfaces.C.To_C (Text)); + end return; + end Create; + + + function Create + (W, H : in Integer; + Text : in String := "") + return Overlay_Window is + begin + return This : Overlay_Window do + This.Void_Ptr := new_fl_overlay_window2 + (Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.To_C (Text)); + fl_group_end (This.Void_Ptr); + fl_widget_set_user_data + (This.Void_Ptr, + Widget_Convert.To_Address (This'Unchecked_Access)); + overlay_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + overlay_window_set_draw_overlay_hook (This.Void_Ptr, Draw_Overlay_Hook'Address); + overlay_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); + fl_widget_set_label (This.Void_Ptr, Interfaces.C.To_C (Text)); + end return; + end Create; + + end Forge; + + + + + --------------- + -- Display -- + --------------- + + procedure Show + (This : in out Overlay_Window) is + begin + fl_overlay_window_show (This.Void_Ptr); + end Show; + + + procedure Hide + (This : in out Overlay_Window) is + begin + fl_overlay_window_hide (This.Void_Ptr); + end Hide; + + + procedure Flush + (This : in out Overlay_Window) is + begin + fl_overlay_window_flush (This.Void_Ptr); + end Flush; + + + + + ------------- + -- Other -- + ------------- + + function Can_Do_Overlay + (This : in Overlay_Window) + return Boolean is + begin + return fl_overlay_window_can_do_overlay (This.Void_Ptr) /= 0; + end Can_Do_Overlay; + + + + + ---------------------------------- + -- Drawing and Event Handling -- + ---------------------------------- + + procedure Draw + (This : in out Overlay_Window) is + begin + fl_overlay_window_draw (This.Void_Ptr); + end Draw; + + + procedure Redraw_Overlay + (This : in out Overlay_Window) is + begin + fl_overlay_window_redraw_overlay (This.Void_Ptr); + end Redraw_Overlay; + + + function Handle + (This : in out Overlay_Window; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_overlay_window_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + +end FLTK.Widgets.Groups.Windows.Double.Overlay; + |