diff options
author | Jed Barber <jjbarber@y7mail.com> | 2017-05-14 13:33:27 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2017-05-14 13:33:27 +1000 |
commit | f3638a598d55629bf130c648416ca75f5edae1f1 (patch) | |
tree | bef111db3ab51c3233b60380ecc3ab6d25441eae /src/fltk-widgets-groups-text_displays-text_editors.adb | |
parent | 371cccdf78fa9aaf49158ea57e598abcd5ff56f0 (diff) |
Cleaned up Draw/Handle code on Ada side
Diffstat (limited to 'src/fltk-widgets-groups-text_displays-text_editors.adb')
-rw-r--r-- | src/fltk-widgets-groups-text_displays-text_editors.adb | 76 |
1 files changed, 30 insertions, 46 deletions
diff --git a/src/fltk-widgets-groups-text_displays-text_editors.adb b/src/fltk-widgets-groups-text_displays-text_editors.adb index afe4dd4..a541833 100644 --- a/src/fltk-widgets-groups-text_displays-text_editors.adb +++ b/src/fltk-widgets-groups-text_displays-text_editors.adb @@ -16,15 +16,6 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is (W, H : in System.Address); pragma Import (C, text_editor_set_handle_hook, "text_editor_set_handle_hook"); - procedure fl_text_editor_draw - (W : in System.Address); - pragma Import (C, fl_text_editor_draw, "fl_text_editor_draw"); - - function fl_text_editor_handle - (W : in System.Address; - E : in Interfaces.C.int) - return Interfaces.C.int; - pragma Import (C, fl_text_editor_handle, "fl_text_editor_handle"); function new_fl_text_editor (X, Y, W, H : in Interfaces.C.int; @@ -36,6 +27,7 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is (TE : in System.Address); pragma Import (C, free_fl_text_editor, "free_fl_text_editor"); + procedure fl_text_editor_undo (TE : in System.Address); pragma Import (C, fl_text_editor_undo, "fl_text_editor_undo"); @@ -62,44 +54,15 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is M : in Interfaces.C.unsigned_long); pragma Import (C, fl_text_editor_remove_key_binding, "fl_text_editor_remove_key_binding"); + procedure fl_text_editor_draw + (W : in System.Address); + pragma Import (C, fl_text_editor_draw, "fl_text_editor_draw"); - - - procedure Draw_Hook (U : in System.Address); - pragma Convention (C, Draw_Hook); - - procedure Draw_Hook - (U : in System.Address) - is - package Text_Editor_Convert is new - System.Address_To_Access_Conversions (Text_Editor'Class); - - Ada_Text_Editor : access Text_Editor'Class := - Text_Editor_Convert.To_Pointer (U); - begin - Ada_Text_Editor.Draw; - end Draw_Hook; - - - - - procedure Draw - (This : in out Text_Editor) is - begin - fl_text_editor_draw (This.Void_Ptr); - end Draw; - - - - - function Handle - (This : in out Text_Editor; - Event : in Event_Kind) - return Event_Outcome is - begin - return Event_Outcome'Val - (fl_text_editor_handle (This.Void_Ptr, Event_Kind'Pos (Event))); - end Handle; + function fl_text_editor_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_text_editor_handle, "fl_text_editor_handle"); @@ -202,5 +165,26 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is end Remove_Key_Binding; + + + procedure Draw + (This : in out Text_Editor) is + begin + fl_text_editor_draw (This.Void_Ptr); + end Draw; + + + + + function Handle + (This : in out Text_Editor; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_text_editor_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + end FLTK.Widgets.Groups.Text_Displays.Text_Editors; |