From f4b68da1d14d39ab4140d8c5e7fbbf45525e7e77 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sat, 13 May 2017 23:05:47 +1000 Subject: Text_Editor, Text_Display, Double_Window, Single_Window, Menu_Window, Window, Group widgets all now have Handle methods --- src/c_fl_double_window.cpp | 39 +++++++++++++++++++--- src/c_fl_double_window.h | 4 +++ src/c_fl_group.cpp | 39 +++++++++++++++++++--- src/c_fl_group.h | 2 ++ src/c_fl_menu_window.cpp | 39 +++++++++++++++++++--- src/c_fl_menu_window.h | 4 +++ src/c_fl_single_window.cpp | 39 +++++++++++++++++++--- src/c_fl_single_window.h | 4 +++ src/c_fl_text_display.cpp | 39 +++++++++++++++++++--- src/c_fl_text_display.h | 4 +++ src/c_fl_text_editor.cpp | 39 +++++++++++++++++++--- src/c_fl_text_editor.h | 2 ++ src/c_fl_window.cpp | 37 +++++++++++++++++--- src/c_fl_window.h | 4 +++ ...k-widgets-groups-text_displays-text_editors.adb | 23 +++++++++++++ ...k-widgets-groups-text_displays-text_editors.ads | 6 ++++ src/fltk-widgets-groups-text_displays.adb | 23 +++++++++++++ src/fltk-widgets-groups-text_displays.ads | 6 ++++ src/fltk-widgets-groups-windows-double.adb | 23 +++++++++++++ src/fltk-widgets-groups-windows-double.ads | 6 ++++ src/fltk-widgets-groups-windows-single-menu.adb | 23 +++++++++++++ src/fltk-widgets-groups-windows-single-menu.ads | 6 ++++ src/fltk-widgets-groups-windows-single.adb | 23 +++++++++++++ src/fltk-widgets-groups-windows-single.ads | 6 ++++ src/fltk-widgets-groups-windows.adb | 23 +++++++++++++ src/fltk-widgets-groups-windows.ads | 6 ++++ src/fltk-widgets-groups.adb | 23 +++++++++++++ src/fltk-widgets-groups.ads | 6 ++++ 28 files changed, 470 insertions(+), 28 deletions(-) diff --git a/src/c_fl_double_window.cpp b/src/c_fl_double_window.cpp index d7cab71..b49010e 100644 --- a/src/c_fl_double_window.cpp +++ b/src/c_fl_double_window.cpp @@ -4,8 +4,14 @@ #include "c_fl_double_window.h" -typedef void (hook)(void*); -typedef hook* hook_p; + + +typedef void (d_hook)(void*); +typedef d_hook* d_hook_p; + + +typedef int (h_hook)(void*,int); +typedef h_hook* h_hook_p; @@ -15,10 +21,15 @@ class My_Double_Window : public Fl_Double_Window { using Fl_Double_Window::Fl_Double_Window; friend void double_window_set_draw_hook(DOUBLEWINDOW n, void * d); friend void fl_double_window_draw(DOUBLEWINDOW n); + friend void double_window_set_handle_hook(DOUBLEWINDOW n, void * h); + friend int fl_double_window_handle(DOUBLEWINDOW n, int e); protected: void draw(); void real_draw(); - hook_p draw_hook; + int handle(int e); + int real_handle(int e); + d_hook_p draw_hook; + h_hook_p handle_hook; }; @@ -32,8 +43,18 @@ void My_Double_Window::real_draw() { } +int My_Double_Window::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Double_Window::real_handle(int e) { + return Fl_Double_Window::handle(e); +} + + void double_window_set_draw_hook(DOUBLEWINDOW n, void * d) { - reinterpret_cast(n)->draw_hook = reinterpret_cast(d); + reinterpret_cast(n)->draw_hook = reinterpret_cast(d); } @@ -42,6 +63,16 @@ void fl_double_window_draw(DOUBLEWINDOW n) { } +void double_window_set_handle_hook(DOUBLEWINDOW n, void * h) { + reinterpret_cast(n)->handle_hook = reinterpret_cast(h); +} + + +int fl_double_window_handle(DOUBLEWINDOW n, int e) { + return reinterpret_cast(n)->real_handle(e); +} + + DOUBLEWINDOW new_fl_double_window(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_double_window.h b/src/c_fl_double_window.h index 7cadafb..d63b947 100644 --- a/src/c_fl_double_window.h +++ b/src/c_fl_double_window.h @@ -9,11 +9,15 @@ typedef void* DOUBLEWINDOW; extern "C" void double_window_set_draw_hook(DOUBLEWINDOW n, void * d); extern "C" void fl_double_window_draw(DOUBLEWINDOW n); +extern "C" void double_window_set_handle_hook(DOUBLEWINDOW n, void * h); +extern "C" int fl_double_window_handle(DOUBLEWINDOW n, int e); + extern "C" DOUBLEWINDOW new_fl_double_window(int x, int y, int w, int h, char* label); extern "C" DOUBLEWINDOW new_fl_double_window2(int w, int h); extern "C" void free_fl_double_window(DOUBLEWINDOW d); + extern "C" void fl_double_window_show(DOUBLEWINDOW d); extern "C" void fl_double_window_hide(DOUBLEWINDOW d); diff --git a/src/c_fl_group.cpp b/src/c_fl_group.cpp index d02476a..88fe477 100644 --- a/src/c_fl_group.cpp +++ b/src/c_fl_group.cpp @@ -6,8 +6,14 @@ #include "c_fl_widget.h" -typedef void (hook)(void*); -typedef hook* hook_p; + + +typedef void (d_hook)(void*); +typedef d_hook* d_hook_p; + + +typedef int (h_hook)(void*,int); +typedef h_hook* h_hook_p; @@ -17,10 +23,15 @@ class My_Group : public Fl_Group { using Fl_Group::Fl_Group; friend void group_set_draw_hook(GROUP g, void * d); friend void fl_group_draw(GROUP g); + friend void group_set_handle_hook(GROUP g, void * h); + friend int fl_group_handle(GROUP g, int e); protected: void draw(); void real_draw(); - hook_p draw_hook; + int handle(int e); + int real_handle(int e); + d_hook_p draw_hook; + h_hook_p handle_hook; }; @@ -34,8 +45,18 @@ void My_Group::real_draw() { } +int My_Group::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Group::real_handle(int e) { + return Fl_Group::handle(e); +} + + void group_set_draw_hook(GROUP g, void * d) { - reinterpret_cast(g)->draw_hook = reinterpret_cast(d); + reinterpret_cast(g)->draw_hook = reinterpret_cast(d); } @@ -44,6 +65,16 @@ void fl_group_draw(GROUP g) { } +void group_set_handle_hook(GROUP g, void * h) { + reinterpret_cast(g)->handle_hook = reinterpret_cast(h); +} + + +int fl_group_handle(GROUP g, int e) { + return reinterpret_cast(g)->real_handle(e); +} + + GROUP new_fl_group(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_group.h b/src/c_fl_group.h index b2db787..f98e691 100644 --- a/src/c_fl_group.h +++ b/src/c_fl_group.h @@ -11,6 +11,8 @@ typedef void* GROUP; extern "C" void group_set_draw_hook(GROUP g, void * d); extern "C" void fl_group_draw(GROUP g); +extern "C" void group_set_handle_hook(GROUP g, void * h); +extern "C" int fl_group_handle(GROUP g, int e); extern "C" GROUP new_fl_group(int x, int y, int w, int h, char* label); extern "C" void free_fl_group(GROUP g); diff --git a/src/c_fl_menu_window.cpp b/src/c_fl_menu_window.cpp index e488479..6a6c45d 100644 --- a/src/c_fl_menu_window.cpp +++ b/src/c_fl_menu_window.cpp @@ -4,8 +4,14 @@ #include "c_fl_menu_window.h" -typedef void (hook)(void*); -typedef hook* hook_p; + + +typedef void (d_hook)(void*); +typedef d_hook* d_hook_p; + + +typedef int (h_hook)(void*,int); +typedef h_hook* h_hook_p; @@ -15,10 +21,15 @@ class My_Menu_Window : public Fl_Menu_Window { using Fl_Menu_Window::Fl_Menu_Window; friend void menu_window_set_draw_hook(MENUWINDOW n, void * d); friend void fl_menu_window_draw(MENUWINDOW n); + friend void menu_window_set_handle_hook(MENUWINDOW n, void * h); + friend int fl_menu_window_handle(MENUWINDOW n, int e); protected: void draw(); void real_draw(); - hook_p draw_hook; + int handle(int e); + int real_handle(int e); + d_hook_p draw_hook; + h_hook_p handle_hook; }; @@ -32,8 +43,18 @@ void My_Menu_Window::real_draw() { } +int My_Menu_Window::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Menu_Window::real_handle(int e) { + return Fl_Menu_Window::handle(e); +} + + void menu_window_set_draw_hook(MENUWINDOW n, void * d) { - reinterpret_cast(n)->draw_hook = reinterpret_cast(d); + reinterpret_cast(n)->draw_hook = reinterpret_cast(d); } @@ -42,6 +63,16 @@ void fl_menu_window_draw(MENUWINDOW n) { } +void menu_window_set_handle_hook(MENUWINDOW n, void * h) { + reinterpret_cast(n)->handle_hook = reinterpret_cast(h); +} + + +int fl_menu_window_handle(MENUWINDOW n, int e) { + return reinterpret_cast(n)->real_handle(e); +} + + MENUWINDOW new_fl_menu_window(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_menu_window.h b/src/c_fl_menu_window.h index 89d02c3..5331a6c 100644 --- a/src/c_fl_menu_window.h +++ b/src/c_fl_menu_window.h @@ -9,11 +9,15 @@ typedef void* MENUWINDOW; extern "C" void menu_window_set_draw_hook(MENUWINDOW n, void * d); extern "C" void fl_menu_window_draw(MENUWINDOW n); +extern "C" void menu_window_set_handle_hook(MENUWINDOW n, void * h); +extern "C" int fl_menu_window_handle(MENUWINDOW n, int e); + extern "C" MENUWINDOW new_fl_menu_window(int x, int y, int w, int h, char* label); extern "C" MENUWINDOW new_fl_menu_window2(int w, int h); extern "C" void free_fl_menu_window(MENUWINDOW m); + extern "C" void fl_menu_window_show(MENUWINDOW m); extern "C" void fl_menu_window_hide(MENUWINDOW m); extern "C" void fl_menu_window_flush(MENUWINDOW m); diff --git a/src/c_fl_single_window.cpp b/src/c_fl_single_window.cpp index 71eecf5..e20bb80 100644 --- a/src/c_fl_single_window.cpp +++ b/src/c_fl_single_window.cpp @@ -4,8 +4,14 @@ #include "c_fl_single_window.h" -typedef void (hook)(void*); -typedef hook* hook_p; + + +typedef void (d_hook)(void*); +typedef d_hook* d_hook_p; + + +typedef int (h_hook)(void*,int); +typedef h_hook* h_hook_p; @@ -15,10 +21,15 @@ class My_Single_Window : public Fl_Single_Window { using Fl_Single_Window::Fl_Single_Window; friend void single_window_set_draw_hook(SINGLEWINDOW n, void * d); friend void fl_single_window_draw(SINGLEWINDOW n); + friend void single_window_set_handle_hook(SINGLEWINDOW n, void * h); + friend int fl_single_window_handle(SINGLEWINDOW n, int e); protected: void draw(); void real_draw(); - hook_p draw_hook; + int handle(int e); + int real_handle(int e); + d_hook_p draw_hook; + h_hook_p handle_hook; }; @@ -32,8 +43,18 @@ void My_Single_Window::real_draw() { } +int My_Single_Window::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Single_Window::real_handle(int e) { + return Fl_Single_Window::handle(e); +} + + void single_window_set_draw_hook(SINGLEWINDOW n, void * d) { - reinterpret_cast(n)->draw_hook = reinterpret_cast(d); + reinterpret_cast(n)->draw_hook = reinterpret_cast(d); } @@ -42,6 +63,16 @@ void fl_single_window_draw(SINGLEWINDOW n) { } +void single_window_set_handle_hook(SINGLEWINDOW n, void * h) { + reinterpret_cast(n)->handle_hook = reinterpret_cast(h); +} + + +int fl_single_window_handle(SINGLEWINDOW n, int e) { + return reinterpret_cast(n)->real_handle(e); +} + + SINGLEWINDOW new_fl_single_window(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_single_window.h b/src/c_fl_single_window.h index a0af35b..72db038 100644 --- a/src/c_fl_single_window.h +++ b/src/c_fl_single_window.h @@ -9,11 +9,15 @@ typedef void* SINGLEWINDOW; extern "C" void single_window_set_draw_hook(SINGLEWINDOW n, void * d); extern "C" void fl_single_window_draw(SINGLEWINDOW n); +extern "C" void single_window_set_handle_hook(SINGLEWINDOW n, void * h); +extern "C" int fl_single_window_handle(SINGLEWINDOW n, int e); + extern "C" SINGLEWINDOW new_fl_single_window(int x, int y, int w, int h, char* label); extern "C" SINGLEWINDOW new_fl_single_window2(int x, int y); extern "C" void free_fl_single_window(SINGLEWINDOW w); + extern "C" void fl_single_window_show(SINGLEWINDOW w); extern "C" void fl_single_window_flush(SINGLEWINDOW w); diff --git a/src/c_fl_text_display.cpp b/src/c_fl_text_display.cpp index dc283f7..0114d8d 100644 --- a/src/c_fl_text_display.cpp +++ b/src/c_fl_text_display.cpp @@ -6,8 +6,14 @@ #include "c_fl_text_buffer.h" -typedef void (hook)(void*); -typedef hook* hook_p; + + +typedef void (d_hook)(void*); +typedef d_hook* d_hook_p; + + +typedef int (h_hook)(void*,int); +typedef h_hook* h_hook_p; @@ -17,10 +23,15 @@ class My_Text_Display : public Fl_Text_Display { using Fl_Text_Display::Fl_Text_Display; friend void text_display_set_draw_hook(TEXTDISPLAY td, void * d); friend void fl_text_display_draw(TEXTDISPLAY td); + friend void text_display_set_handle_hook(TEXTDISPLAY td, void * h); + friend int fl_text_display_handle(TEXTDISPLAY td, int e); protected: void draw(); void real_draw(); - hook_p draw_hook; + int handle(int e); + int real_handle(int e); + d_hook_p draw_hook; + h_hook_p handle_hook; }; @@ -34,8 +45,18 @@ void My_Text_Display::real_draw() { } +int My_Text_Display::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Text_Display::real_handle(int e) { + return Fl_Text_Display::handle(e); +} + + void text_display_set_draw_hook(TEXTDISPLAY td, void * d) { - reinterpret_cast(td)->draw_hook = reinterpret_cast(d); + reinterpret_cast(td)->draw_hook = reinterpret_cast(d); } @@ -44,6 +65,16 @@ void fl_text_display_draw(TEXTDISPLAY td) { } +void text_display_set_handle_hook(TEXTDISPLAY td, void * h) { + reinterpret_cast(td)->handle_hook = reinterpret_cast(h); +} + + +int fl_text_display_handle(TEXTDISPLAY td, int e) { + return reinterpret_cast(td)->real_handle(e); +} + + TEXTDISPLAY new_fl_text_display(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_text_display.h b/src/c_fl_text_display.h index adacfd1..86c5f65 100644 --- a/src/c_fl_text_display.h +++ b/src/c_fl_text_display.h @@ -11,10 +11,14 @@ typedef void* TEXTDISPLAY; extern "C" void text_display_set_draw_hook(TEXTDISPLAY td, void * d); extern "C" void fl_text_display_draw(TEXTDISPLAY td); +extern "C" void text_display_set_handle_hook(TEXTDISPLAY td, void * h); +extern "C" int fl_text_display_handle(TEXTDISPLAY td, int e); + extern "C" TEXTDISPLAY new_fl_text_display(int x, int y, int w, int h, char* label); extern "C" void free_fl_text_display(TEXTDISPLAY td); + extern "C" TEXTBUFFER fl_text_display_get_buffer(TEXTDISPLAY td); extern "C" void fl_text_display_set_buffer(TEXTDISPLAY td, TEXTBUFFER tb); extern "C" int fl_text_display_get_text_color(TEXTDISPLAY td); diff --git a/src/c_fl_text_editor.cpp b/src/c_fl_text_editor.cpp index 156d439..6608af9 100644 --- a/src/c_fl_text_editor.cpp +++ b/src/c_fl_text_editor.cpp @@ -4,8 +4,14 @@ #include "c_fl_text_editor.h" -typedef void (hook)(void*); -typedef hook* hook_p; + + +typedef void (d_hook)(void*); +typedef d_hook* d_hook_p; + + +typedef int (h_hook)(void*,int); +typedef h_hook* h_hook_p; @@ -15,10 +21,15 @@ class My_Text_Editor : public Fl_Text_Editor { using Fl_Text_Editor::Fl_Text_Editor; friend void text_editor_set_draw_hook(TEXTEDITOR te, void * d); friend void fl_text_editor_draw(TEXTEDITOR te); + friend void text_editor_set_handle_hook(TEXTEDITOR te, void * h); + friend int fl_text_editor_handle(TEXTEDITOR te, int e); protected: void draw(); void real_draw(); - hook_p draw_hook; + int handle(int e); + int real_handle(int e); + d_hook_p draw_hook; + h_hook_p handle_hook; }; @@ -32,8 +43,18 @@ void My_Text_Editor::real_draw() { } +int My_Text_Editor::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Text_Editor::real_handle(int e) { + return Fl_Text_Editor::handle(e); +} + + void text_editor_set_draw_hook(TEXTEDITOR te, void * d) { - reinterpret_cast(te)->draw_hook = reinterpret_cast(d); + reinterpret_cast(te)->draw_hook = reinterpret_cast(d); } @@ -42,6 +63,16 @@ void fl_text_editor_draw(TEXTEDITOR te) { } +void text_editor_set_handle_hook(TEXTEDITOR te, void * h) { + reinterpret_cast(te)->handle_hook = reinterpret_cast(h); +} + + +int fl_text_editor_handle(TEXTEDITOR te, int e) { + return reinterpret_cast(te)->real_handle(e); +} + + TEXTEDITOR new_fl_text_editor(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_text_editor.h b/src/c_fl_text_editor.h index 87a09ce..f6abc6e 100644 --- a/src/c_fl_text_editor.h +++ b/src/c_fl_text_editor.h @@ -9,6 +9,8 @@ typedef void* TEXTEDITOR; extern "C" void text_editor_set_draw_hook(TEXTEDITOR te, void * d); extern "C" void fl_text_editor_draw(TEXTEDITOR te); +extern "C" void text_editor_set_handle_hook(TEXTEDITOR te, void * h); +extern "C" int fl_text_editor_handle(TEXTEDITOR te, int e); extern "C" TEXTEDITOR new_fl_text_editor(int x, int y, int w, int h, char* label); diff --git a/src/c_fl_window.cpp b/src/c_fl_window.cpp index 1413646..e6f0adb 100644 --- a/src/c_fl_window.cpp +++ b/src/c_fl_window.cpp @@ -7,8 +7,12 @@ -typedef void (hook)(void*); -typedef hook* hook_p; +typedef void (d_hook)(void*); +typedef d_hook* d_hook_p; + + +typedef int (h_hook)(void*,int); +typedef h_hook* h_hook_p; @@ -18,10 +22,15 @@ class My_Window : public Fl_Window { using Fl_Window::Fl_Window; friend void window_set_draw_hook(WINDOW n, void * d); friend void fl_window_draw(WINDOW n); + friend void window_set_handle_hook(WINDOW n, void * h); + friend int fl_window_handle(WINDOW n, int e); protected: void draw(); void real_draw(); - hook_p draw_hook; + int handle(int e); + int real_handle(int e); + d_hook_p draw_hook; + h_hook_p handle_hook; }; @@ -35,8 +44,18 @@ void My_Window::real_draw() { } +int My_Window::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Window::real_handle(int e) { + return Fl_Window::handle(e); +} + + void window_set_draw_hook(WINDOW n, void * d) { - reinterpret_cast(n)->draw_hook = reinterpret_cast(d); + reinterpret_cast(n)->draw_hook = reinterpret_cast(d); } @@ -45,6 +64,16 @@ void fl_window_draw(WINDOW n) { } +void window_set_handle_hook(WINDOW n, void * h) { + reinterpret_cast(n)->handle_hook = reinterpret_cast(h); +} + + +int fl_window_handle(WINDOW n, int e) { + return reinterpret_cast(n)->real_handle(e); +} + + WINDOW new_fl_window(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_window.h b/src/c_fl_window.h index 39bd0ac..6ac2e1a 100644 --- a/src/c_fl_window.h +++ b/src/c_fl_window.h @@ -9,11 +9,15 @@ typedef void* WINDOW; extern "C" void window_set_draw_hook(WINDOW n, void * d); extern "C" void fl_window_draw(WINDOW n); +extern "C" void window_set_handle_hook(WINDOW n, void * h); +extern "C" int fl_window_handle(WINDOW n, int e); + extern "C" WINDOW new_fl_window(int x, int y, int w, int h, char* label); extern "C" WINDOW new_fl_window2(int w, int h); extern "C" void free_fl_window(WINDOW n); + extern "C" void fl_window_show(WINDOW n); extern "C" void fl_window_hide(WINDOW n); extern "C" void fl_window_set_label(WINDOW n, char* text); diff --git a/src/fltk-widgets-groups-text_displays-text_editors.adb b/src/fltk-widgets-groups-text_displays-text_editors.adb index 06564ef..afe4dd4 100644 --- a/src/fltk-widgets-groups-text_displays-text_editors.adb +++ b/src/fltk-widgets-groups-text_displays-text_editors.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is (W, D : in System.Address); pragma Import (C, text_editor_set_draw_hook, "text_editor_set_draw_hook"); + procedure text_editor_set_handle_hook + (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; Text : in Interfaces.C.char_array) @@ -82,6 +92,18 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is + 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; + + + + procedure Finalize (This : in out Text_Editor) is begin @@ -115,6 +137,7 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); text_editor_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + text_editor_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-groups-text_displays-text_editors.ads b/src/fltk-widgets-groups-text_displays-text_editors.ads index 504de23..63d154f 100644 --- a/src/fltk-widgets-groups-text_displays-text_editors.ads +++ b/src/fltk-widgets-groups-text_displays-text_editors.ads @@ -44,6 +44,12 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is (This : in out Text_Editor); + function Handle + (This : in out Text_Editor; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-groups-text_displays.adb b/src/fltk-widgets-groups-text_displays.adb index 9c571d3..e805ff5 100644 --- a/src/fltk-widgets-groups-text_displays.adb +++ b/src/fltk-widgets-groups-text_displays.adb @@ -13,10 +13,20 @@ package body FLTK.Widgets.Groups.Text_Displays is (W, D : in System.Address); pragma Import (C, text_display_set_draw_hook, "text_display_set_draw_hook"); + procedure text_display_set_handle_hook + (W, H : in System.Address); + pragma Import (C, text_display_set_handle_hook, "text_display_set_handle_hook"); + procedure fl_text_display_draw (W : in System.Address); pragma Import (C, fl_text_display_draw, "fl_text_display_draw"); + function fl_text_display_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_text_display_handle, "fl_text_display_handle"); + function new_fl_text_display (X, Y, W, H : in Interfaces.C.int; Label : in Interfaces.C.char_array) @@ -140,6 +150,18 @@ package body FLTK.Widgets.Groups.Text_Displays is + function Handle + (This : in out Text_Display; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_text_display_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Text_Display) is begin @@ -173,6 +195,7 @@ package body FLTK.Widgets.Groups.Text_Displays is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); text_display_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + text_display_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-groups-text_displays.ads b/src/fltk-widgets-groups-text_displays.ads index 66d69de..0d05c2e 100644 --- a/src/fltk-widgets-groups-text_displays.ads +++ b/src/fltk-widgets-groups-text_displays.ads @@ -111,6 +111,12 @@ package FLTK.Widgets.Groups.Text_Displays is (This : in out Text_Display); + function Handle + (This : in out Text_Display; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-groups-windows-double.adb b/src/fltk-widgets-groups-windows-double.adb index da48471..c81ffc9 100644 --- a/src/fltk-widgets-groups-windows-double.adb +++ b/src/fltk-widgets-groups-windows-double.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Groups.Windows.Double is (W, D : in System.Address); pragma Import (C, double_window_set_draw_hook, "double_window_set_draw_hook"); + procedure double_window_set_handle_hook + (W, H : in System.Address); + pragma Import (C, double_window_set_handle_hook, "double_window_set_handle_hook"); + procedure fl_double_window_draw (W : in System.Address); pragma Import (C, fl_double_window_draw, "fl_double_window_draw"); + function fl_double_window_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_double_window_handle, "fl_double_window_handle"); + function new_fl_double_window (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -69,6 +79,18 @@ package body FLTK.Widgets.Groups.Windows.Double is + function Handle + (This : in out Double_Window; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_double_window_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Double_Window) is begin @@ -102,6 +124,7 @@ package body FLTK.Widgets.Groups.Windows.Double is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); double_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + double_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-groups-windows-double.ads b/src/fltk-widgets-groups-windows-double.ads index 6b7cbb8..9d6da7b 100644 --- a/src/fltk-widgets-groups-windows-double.ads +++ b/src/fltk-widgets-groups-windows-double.ads @@ -29,6 +29,12 @@ package FLTK.Widgets.Groups.Windows.Double is (This : in out Double_Window); + function Handle + (This : in out Double_Window; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-groups-windows-single-menu.adb b/src/fltk-widgets-groups-windows-single-menu.adb index 4f62763..6c0a5ef 100644 --- a/src/fltk-widgets-groups-windows-single-menu.adb +++ b/src/fltk-widgets-groups-windows-single-menu.adb @@ -13,10 +13,20 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is (W, D : in System.Address); pragma Import (C, menu_window_set_draw_hook, "menu_window_set_draw_hook"); + procedure menu_window_set_handle_hook + (W, H : in System.Address); + pragma Import (C, menu_window_set_handle_hook, "menu_window_set_handle_hook"); + procedure fl_menu_window_draw (W : in System.Address); pragma Import (C, fl_menu_window_draw, "fl_menu_window_draw"); + function fl_menu_window_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_menu_window_handle, "fl_menu_window_handle"); + function new_fl_menu_window (X, Y, W, H : in Interfaces.C.int; Label : in Interfaces.C.char_array) @@ -87,6 +97,18 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is + function Handle + (This : in out Menu_Window; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_menu_window_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Menu_Window) is begin @@ -120,6 +142,7 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); menu_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + menu_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-groups-windows-single-menu.ads b/src/fltk-widgets-groups-windows-single-menu.ads index 693bf72..80f72ed 100644 --- a/src/fltk-widgets-groups-windows-single-menu.ads +++ b/src/fltk-widgets-groups-windows-single-menu.ads @@ -43,6 +43,12 @@ package FLTK.Widgets.Groups.Windows.Single.Menu is (This : in out Menu_Window); + function Handle + (This : in out Menu_Window; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-groups-windows-single.adb b/src/fltk-widgets-groups-windows-single.adb index bc89b10..76d6dac 100644 --- a/src/fltk-widgets-groups-windows-single.adb +++ b/src/fltk-widgets-groups-windows-single.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Groups.Windows.Single is (W, D : in System.Address); pragma Import (C, single_window_set_draw_hook, "single_window_set_draw_hook"); + procedure single_window_set_handle_hook + (W, H : in System.Address); + pragma Import (C, single_window_set_handle_hook, "single_window_set_handle_hook"); + procedure fl_single_window_draw (W : in System.Address); pragma Import (C, fl_single_window_draw, "fl_single_window_draw"); + function fl_single_window_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_single_window_handle, "fl_single_window_handle"); + function new_fl_single_window (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -69,6 +79,18 @@ package body FLTK.Widgets.Groups.Windows.Single is + function Handle + (This : in out Single_Window; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_single_window_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Single_Window) is begin @@ -102,6 +124,7 @@ package body FLTK.Widgets.Groups.Windows.Single is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); single_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + single_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-groups-windows-single.ads b/src/fltk-widgets-groups-windows-single.ads index 22b9b3c..2593ee5 100644 --- a/src/fltk-widgets-groups-windows-single.ads +++ b/src/fltk-widgets-groups-windows-single.ads @@ -29,6 +29,12 @@ package FLTK.Widgets.Groups.Windows.Single is (This : in out Single_Window); + function Handle + (This : in out Single_Window; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-groups-windows.adb b/src/fltk-widgets-groups-windows.adb index 866d502..f92a3a5 100644 --- a/src/fltk-widgets-groups-windows.adb +++ b/src/fltk-widgets-groups-windows.adb @@ -13,10 +13,20 @@ package body FLTK.Widgets.Groups.Windows is (W, D : in System.Address); pragma Import (C, window_set_draw_hook, "window_set_draw_hook"); + procedure window_set_handle_hook + (W, H : in System.Address); + pragma Import (C, window_set_handle_hook, "window_set_handle_hook"); + procedure fl_window_draw (W : in System.Address); pragma Import (C, fl_window_draw, "fl_window_draw"); + function fl_window_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_window_handle, "fl_window_handle"); + function new_fl_window (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -91,6 +101,18 @@ package body FLTK.Widgets.Groups.Windows is + function Handle + (This : in out Window; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_window_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Window) is begin @@ -124,6 +146,7 @@ package body FLTK.Widgets.Groups.Windows is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-groups-windows.ads b/src/fltk-widgets-groups-windows.ads index 79df6f2..2963c4e 100644 --- a/src/fltk-widgets-groups-windows.ads +++ b/src/fltk-widgets-groups-windows.ads @@ -57,6 +57,12 @@ package FLTK.Widgets.Groups.Windows is (This : in out Window); + function Handle + (This : in out Window; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-groups.adb b/src/fltk-widgets-groups.adb index 3b82d03..b61b5be 100644 --- a/src/fltk-widgets-groups.adb +++ b/src/fltk-widgets-groups.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Groups is (W, D : in System.Address); pragma Import (C, group_set_draw_hook, "group_set_draw_hook"); + procedure group_set_handle_hook + (W, H : in System.Address); + pragma Import (C, group_set_handle_hook, "group_set_handle_hook"); + procedure fl_group_draw (W : in System.Address); pragma Import (C, fl_group_draw, "fl_group_draw"); + function fl_group_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_group_handle, "fl_group_handle"); + function new_fl_group (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -93,6 +103,18 @@ package body FLTK.Widgets.Groups is + function Handle + (This : in out Group; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_group_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Group) is begin @@ -126,6 +148,7 @@ package body FLTK.Widgets.Groups is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); group_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + group_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-groups.ads b/src/fltk-widgets-groups.ads index 506843a..e631b7e 100644 --- a/src/fltk-widgets-groups.ads +++ b/src/fltk-widgets-groups.ads @@ -67,6 +67,12 @@ package FLTK.Widgets.Groups is (This : in out Group); + function Handle + (This : in out Group; + Event : in Event_Kind) + return Event_Outcome; + + private -- cgit