summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-groups-windows.adb
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-04-29 23:45:04 +1000
committerJed Barber <jjbarber@y7mail.com>2017-04-29 23:45:04 +1000
commitf37664163c9dfa33416845ddd78695c33e6fdaef (patch)
treefbdf7c88650c46fec20b836db880f14f667b6cde /src/fltk-widgets-groups-windows.adb
parent19811edce192b7bc0d8462a20d86123c612c89e0 (diff)
Can now override Draw method from Ada side for Window widgets
Diffstat (limited to 'src/fltk-widgets-groups-windows.adb')
-rw-r--r--src/fltk-widgets-groups-windows.adb34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/fltk-widgets-groups-windows.adb b/src/fltk-widgets-groups-windows.adb
index 2d93bdd..f217403 100644
--- a/src/fltk-widgets-groups-windows.adb
+++ b/src/fltk-widgets-groups-windows.adb
@@ -9,6 +9,14 @@ use type System.Address;
package body FLTK.Widgets.Groups.Windows is
+ procedure window_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, window_set_draw_hook, "window_set_draw_hook");
+
+ procedure fl_window_draw
+ (W : in System.Address);
+ pragma Import (C, fl_window_draw, "fl_window_draw");
+
function new_fl_window
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -57,6 +65,30 @@ package body FLTK.Widgets.Groups.Windows is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Window : access Window'Class :=
+ Window_Convert.To_Pointer (U);
+ begin
+ Ada_Window.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Window) is
+ begin
+ fl_window_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Window) is
begin
@@ -87,6 +119,7 @@ package body FLTK.Widgets.Groups.Windows is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
end return;
end Create;
@@ -105,6 +138,7 @@ package body FLTK.Widgets.Groups.Windows is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
end return;
end Create;