diff options
44 files changed, 770 insertions, 98 deletions
diff --git a/src/c_fl_file_input.cpp b/src/c_fl_file_input.cpp index cc8c66f..49cb873 100644 --- a/src/c_fl_file_input.cpp +++ b/src/c_fl_file_input.cpp @@ -4,8 +4,14 @@ #include "c_fl_file_input.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; @@ -13,12 +19,17 @@ typedef hook* hook_p; class My_File_Input : public Fl_File_Input { public: using Fl_File_Input::Fl_File_Input; - friend void file_input_set_draw_hook(FILE_INPUT n, void * d); - friend void fl_file_input_draw(FILE_INPUT n); + friend void file_input_set_draw_hook(FILE_INPUT i, void * d); + friend void fl_file_input_draw(FILE_INPUT i); + friend void file_input_set_handle_hook(FILE_INPUT i, void * h); + friend int fl_file_input_handle(FILE_INPUT i, 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,13 +43,33 @@ void My_File_Input::real_draw() { } -void file_input_set_draw_hook(FILE_INPUT n, void * d) { - reinterpret_cast<My_File_Input*>(n)->draw_hook = reinterpret_cast<hook_p>(d); +int My_File_Input::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_File_Input::real_handle(int e) { + return Fl_File_Input::handle(e); +} + + +void file_input_set_draw_hook(FILE_INPUT i, void * d) { + reinterpret_cast<My_File_Input*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); +} + + +void fl_file_input_draw(FILE_INPUT i) { + reinterpret_cast<My_File_Input*>(i)->real_draw(); +} + + +void file_input_set_handle_hook(FILE_INPUT i, void * h) { + reinterpret_cast<My_File_Input*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } -void fl_file_input_draw(FILE_INPUT n) { - reinterpret_cast<My_File_Input*>(n)->real_draw(); +int fl_file_input_handle(FILE_INPUT i, int e) { + return reinterpret_cast<My_File_Input*>(i)->real_handle(e); } diff --git a/src/c_fl_file_input.h b/src/c_fl_file_input.h index a54a259..d771389 100644 --- a/src/c_fl_file_input.h +++ b/src/c_fl_file_input.h @@ -7,8 +7,11 @@ typedef void* FILE_INPUT; -extern "C" void file_input_set_draw_hook(FILE_INPUT n, void * d); -extern "C" void fl_file_input_draw(FILE_INPUT n); +extern "C" void file_input_set_draw_hook(FILE_INPUT i, void * d); +extern "C" void fl_file_input_draw(FILE_INPUT i); +extern "C" void file_input_set_handle_hook(FILE_INPUT i, void * h); +extern "C" int fl_file_input_handle(FILE_INPUT i, int e); + extern "C" FILE_INPUT new_fl_file_input(int x, int y, int w, int h, char* label); extern "C" void free_fl_file_input(FILE_INPUT i); diff --git a/src/c_fl_float_input.cpp b/src/c_fl_float_input.cpp index 1331e3c..7e9278a 100644 --- a/src/c_fl_float_input.cpp +++ b/src/c_fl_float_input.cpp @@ -4,8 +4,14 @@ #include "c_fl_float_input.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; @@ -13,12 +19,17 @@ typedef hook* hook_p; class My_Float_Input : public Fl_Float_Input { public: using Fl_Float_Input::Fl_Float_Input; - friend void float_input_set_draw_hook(FLOAT_INPUT n, void * d); - friend void fl_float_input_draw(FLOAT_INPUT n); + friend void float_input_set_draw_hook(FLOAT_INPUT i, void * d); + friend void fl_float_input_draw(FLOAT_INPUT i); + friend void float_input_set_handle_hook(FLOAT_INPUT i, void * h); + friend int fl_float_input_handle(FLOAT_INPUT i, 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,13 +43,33 @@ void My_Float_Input::real_draw() { } -void float_input_set_draw_hook(FLOAT_INPUT n, void * d) { - reinterpret_cast<My_Float_Input*>(n)->draw_hook = reinterpret_cast<hook_p>(d); +int My_Float_Input::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Float_Input::real_handle(int e) { + return Fl_Float_Input::handle(e); +} + + +void float_input_set_draw_hook(FLOAT_INPUT i, void * d) { + reinterpret_cast<My_Float_Input*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); +} + + +void fl_float_input_draw(FLOAT_INPUT i) { + reinterpret_cast<My_Float_Input*>(i)->real_draw(); +} + + +void float_input_set_handle_hook(FLOAT_INPUT i, void * h) { + reinterpret_cast<My_Float_Input*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } -void fl_float_input_draw(FLOAT_INPUT n) { - reinterpret_cast<My_Float_Input*>(n)->real_draw(); +int fl_float_input_handle(FLOAT_INPUT i, int e) { + return reinterpret_cast<My_Float_Input*>(i)->real_handle(e); } diff --git a/src/c_fl_float_input.h b/src/c_fl_float_input.h index ed71bac..caba3a1 100644 --- a/src/c_fl_float_input.h +++ b/src/c_fl_float_input.h @@ -7,8 +7,11 @@ typedef void* FLOAT_INPUT; -extern "C" void float_input_set_draw_hook(FLOAT_INPUT n, void * d); -extern "C" void fl_float_input_draw(FLOAT_INPUT n); +extern "C" void float_input_set_draw_hook(FLOAT_INPUT i, void * d); +extern "C" void fl_float_input_draw(FLOAT_INPUT i); +extern "C" void float_input_set_handle_hook(FLOAT_INPUT i, void * h); +extern "C" int fl_float_input_handle(FLOAT_INPUT i, int e); + extern "C" FLOAT_INPUT new_fl_float_input(int x, int y, int w, int h, char* label); extern "C" void free_fl_float_input(FLOAT_INPUT i); diff --git a/src/c_fl_input.cpp b/src/c_fl_input.cpp index 526dbd5..e215d38 100644 --- a/src/c_fl_input.cpp +++ b/src/c_fl_input.cpp @@ -4,8 +4,14 @@ #include "c_fl_input.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; @@ -13,12 +19,17 @@ typedef hook* hook_p; class My_Input : public Fl_Input { public: using Fl_Input::Fl_Input; - friend void input_set_draw_hook(INPUT n, void * d); - friend void fl_input_draw(INPUT n); + friend void input_set_draw_hook(INPUT i, void * d); + friend void fl_input_draw(INPUT i); + friend void input_set_handle_hook(INPUT i, void * h); + friend int fl_input_handle(INPUT i, 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,13 +43,33 @@ void My_Input::real_draw() { } -void input_set_draw_hook(INPUT n, void * d) { - reinterpret_cast<My_Input*>(n)->draw_hook = reinterpret_cast<hook_p>(d); +int My_Input::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Input::real_handle(int e) { + return Fl_Input::handle(e); +} + + +void input_set_draw_hook(INPUT i, void * d) { + reinterpret_cast<My_Input*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); +} + + +void fl_input_draw(INPUT i) { + reinterpret_cast<My_Input*>(i)->real_draw(); +} + + +void input_set_handle_hook(INPUT i, void * h) { + reinterpret_cast<My_Input*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } -void fl_input_draw(INPUT n) { - reinterpret_cast<My_Input*>(n)->real_draw(); +int fl_input_handle(INPUT i, int e) { + return reinterpret_cast<My_Input*>(i)->real_handle(e); } diff --git a/src/c_fl_input.h b/src/c_fl_input.h index 2262a2f..231d84e 100644 --- a/src/c_fl_input.h +++ b/src/c_fl_input.h @@ -9,6 +9,9 @@ typedef void* INPUT; extern "C" void input_set_draw_hook(INPUT n, void * d); extern "C" void fl_input_draw(INPUT n); +extern "C" void input_set_handle_hook(INPUT i, void * h); +extern "C" int fl_input_handle(INPUT i, int e); + extern "C" INPUT new_fl_input(int x, int y, int w, int h, char* label); extern "C" void free_fl_input(INPUT i); diff --git a/src/c_fl_int_input.cpp b/src/c_fl_int_input.cpp index cf038c7..c7db8ef 100644 --- a/src/c_fl_int_input.cpp +++ b/src/c_fl_int_input.cpp @@ -4,8 +4,14 @@ #include "c_fl_int_input.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; @@ -13,12 +19,17 @@ typedef hook* hook_p; class My_Int_Input : public Fl_Int_Input { public: using Fl_Int_Input::Fl_Int_Input; - friend void int_input_set_draw_hook(INT_INPUT n, void * d); - friend void fl_int_input_draw(INT_INPUT n); + friend void int_input_set_draw_hook(INT_INPUT i, void * d); + friend void fl_int_input_draw(INT_INPUT i); + friend void int_input_set_handle_hook(INT_INPUT i, void * h); + friend int fl_int_input_handle(INT_INPUT i, 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,13 +43,33 @@ void My_Int_Input::real_draw() { } -void int_input_set_draw_hook(INT_INPUT n, void * d) { - reinterpret_cast<My_Int_Input*>(n)->draw_hook = reinterpret_cast<hook_p>(d); +int My_Int_Input::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Int_Input::real_handle(int e) { + return Fl_Int_Input::handle(e); +} + + +void int_input_set_draw_hook(INT_INPUT i, void * d) { + reinterpret_cast<My_Int_Input*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); +} + + +void fl_int_input_draw(INT_INPUT i) { + reinterpret_cast<My_Int_Input*>(i)->real_draw(); +} + + +void int_input_set_handle_hook(INT_INPUT i, void * h) { + reinterpret_cast<My_Int_Input*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } -void fl_int_input_draw(INT_INPUT n) { - reinterpret_cast<My_Int_Input*>(n)->real_draw(); +int fl_int_input_handle(INT_INPUT i, int e) { + return reinterpret_cast<My_Int_Input*>(i)->real_handle(e); } diff --git a/src/c_fl_int_input.h b/src/c_fl_int_input.h index 125ed18..e9f4926 100644 --- a/src/c_fl_int_input.h +++ b/src/c_fl_int_input.h @@ -7,8 +7,11 @@ typedef void* INT_INPUT; -extern "C" void int_input_set_draw_hook(INT_INPUT n, void * d); -extern "C" void fl_int_input_draw(INT_INPUT n); +extern "C" void int_input_set_draw_hook(INT_INPUT i, void * d); +extern "C" void fl_int_input_draw(INT_INPUT i); +extern "C" void int_input_set_handle_hook(INT_INPUT i, void * h); +extern "C" int fl_int_input_handle(INT_INPUT i, int e); + extern "C" INT_INPUT new_fl_int_input(int x, int y, int w, int h, char* label); extern "C" void free_fl_int_input(INT_INPUT i); diff --git a/src/c_fl_menu.cpp b/src/c_fl_menu.cpp index daff92b..8a8b974 100644 --- a/src/c_fl_menu.cpp +++ b/src/c_fl_menu.cpp @@ -5,8 +5,14 @@ #include "c_fl_menu.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,9 +21,12 @@ class My_Menu : public Fl_Menu_ { public: using Fl_Menu_::Fl_Menu_; friend void menu_set_draw_hook(MENU m, void * d); + friend void menu_set_handle_hook(MENU m, void * h); protected: void draw(); - hook_p draw_hook; + int handle(int e); + d_hook_p draw_hook; + h_hook_p handle_hook; }; @@ -26,8 +35,18 @@ void My_Menu::draw() { } +int My_Menu::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + void menu_set_draw_hook(MENU m, void * d) { - reinterpret_cast<My_Menu*>(m)->draw_hook = reinterpret_cast<hook_p>(d); + reinterpret_cast<My_Menu*>(m)->draw_hook = reinterpret_cast<d_hook_p>(d); +} + + +void menu_set_handle_hook(MENU m, void * h) { + reinterpret_cast<My_Menu*>(m)->handle_hook = reinterpret_cast<h_hook_p>(h); } diff --git a/src/c_fl_menu.h b/src/c_fl_menu.h index 77dfb80..72d9e73 100644 --- a/src/c_fl_menu.h +++ b/src/c_fl_menu.h @@ -9,6 +9,7 @@ typedef void* MENU; extern "C" void menu_set_draw_hook(MENU m, void * d); +extern "C" void menu_set_handle_hook(MENU m, void * h); extern "C" MENU new_fl_menu(int x, int y, int w, int h, char* label); diff --git a/src/c_fl_menu_bar.cpp b/src/c_fl_menu_bar.cpp index 3246a97..947a6ce 100644 --- a/src/c_fl_menu_bar.cpp +++ b/src/c_fl_menu_bar.cpp @@ -4,8 +4,14 @@ #include "c_fl_menu_bar.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_Bar : public Fl_Menu_Bar { using Fl_Menu_Bar::Fl_Menu_Bar; friend void menu_bar_set_draw_hook(MENUBAR m, void * d); friend void fl_menu_bar_draw(MENUBAR m); + friend void menu_bar_set_handle_hook(MENUBAR m, void * h); + friend int fl_menu_bar_handle(MENUBAR m, 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_Bar::real_draw() { } +int My_Menu_Bar::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Menu_Bar::real_handle(int e) { + return Fl_Menu_Bar::handle(e); +} + + void menu_bar_set_draw_hook(MENUBAR m, void * d) { - reinterpret_cast<My_Menu_Bar*>(m)->draw_hook = reinterpret_cast<hook_p>(d); + reinterpret_cast<My_Menu_Bar*>(m)->draw_hook = reinterpret_cast<d_hook_p>(d); } @@ -42,6 +63,16 @@ void fl_menu_bar_draw(MENUBAR m) { } +void menu_bar_set_handle_hook(MENUBAR m, void * h) { + reinterpret_cast<My_Menu_Bar*>(m)->handle_hook = reinterpret_cast<h_hook_p>(h); +} + + +int fl_menu_bar_handle(MENUBAR m, int e) { + return reinterpret_cast<My_Menu_Bar*>(m)->real_handle(e); +} + + MENUBAR new_fl_menu_bar(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_menu_bar.h b/src/c_fl_menu_bar.h index 872ce3d..93b1220 100644 --- a/src/c_fl_menu_bar.h +++ b/src/c_fl_menu_bar.h @@ -9,6 +9,9 @@ typedef void* MENUBAR; extern "C" void menu_bar_set_draw_hook(MENUBAR m, void * d); extern "C" void fl_menu_bar_draw(MENUBAR m); +extern "C" void menu_bar_set_handle_hook(MENUBAR m, void * h); +extern "C" int fl_menu_bar_handle(MENUBAR m, int e); + extern "C" MENUBAR new_fl_menu_bar(int x, int y, int w, int h, char* label); extern "C" void free_fl_menu_bar(MENUBAR m); diff --git a/src/c_fl_menu_button.cpp b/src/c_fl_menu_button.cpp index e4b963c..bc782a4 100644 --- a/src/c_fl_menu_button.cpp +++ b/src/c_fl_menu_button.cpp @@ -4,8 +4,14 @@ #include "c_fl_menu_button.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_Button : public Fl_Menu_Button { using Fl_Menu_Button::Fl_Menu_Button; friend void menu_button_set_draw_hook(MENUBUTTON m, void * d); friend void fl_menu_button_draw(MENUBUTTON m); + friend void menu_button_set_handle_hook(MENUBUTTON m, void * h); + friend int fl_menu_button_handle(MENUBUTTON m, 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_Button::real_draw() { } +int My_Menu_Button::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Menu_Button::real_handle(int e) { + return Fl_Menu_Button::handle(e); +} + + void menu_button_set_draw_hook(MENUBUTTON m, void * d) { - reinterpret_cast<My_Menu_Button*>(m)->draw_hook = reinterpret_cast<hook_p>(d); + reinterpret_cast<My_Menu_Button*>(m)->draw_hook = reinterpret_cast<d_hook_p>(d); } @@ -42,6 +63,16 @@ void fl_menu_button_draw(MENUBUTTON m) { } +void menu_button_set_handle_hook(MENUBUTTON m, void * h) { + reinterpret_cast<My_Menu_Button*>(m)->handle_hook = reinterpret_cast<h_hook_p>(h); +} + + +int fl_menu_button_handle(MENUBUTTON m, int e) { + return reinterpret_cast<My_Menu_Button*>(m)->real_handle(e); +} + + MENUBUTTON new_fl_menu_button(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_menu_button.h b/src/c_fl_menu_button.h index be27476..2ccdb51 100644 --- a/src/c_fl_menu_button.h +++ b/src/c_fl_menu_button.h @@ -9,6 +9,9 @@ typedef void* MENUBUTTON; extern "C" void menu_button_set_draw_hook(MENUBUTTON m, void * d); extern "C" void fl_menu_button_draw(MENUBUTTON m); +extern "C" void menu_button_set_handle_hook(MENUBUTTON m, void * h); +extern "C" int fl_menu_button_handle(MENUBUTTON m, int e); + extern "C" MENUBUTTON new_fl_menu_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_menu_button(MENUBUTTON m); diff --git a/src/c_fl_multiline_input.cpp b/src/c_fl_multiline_input.cpp index c9bdfaa..3d6cb09 100644 --- a/src/c_fl_multiline_input.cpp +++ b/src/c_fl_multiline_input.cpp @@ -4,8 +4,14 @@ #include "c_fl_multiline_input.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; @@ -13,12 +19,17 @@ typedef hook* hook_p; class My_Multiline_Input : public Fl_Multiline_Input { public: using Fl_Multiline_Input::Fl_Multiline_Input; - friend void multiline_input_set_draw_hook(MULTILINE_INPUT n, void * d); - friend void fl_multiline_input_draw(MULTILINE_INPUT n); + friend void multiline_input_set_draw_hook(MULTILINE_INPUT i, void * d); + friend void fl_multiline_input_draw(MULTILINE_INPUT i); + friend void multiline_input_set_handle_hook(MULTILINE_INPUT i, void * h); + friend int fl_multiline_input_handle(MULTILINE_INPUT i, 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,13 +43,33 @@ void My_Multiline_Input::real_draw() { } -void multiline_input_set_draw_hook(MULTILINE_INPUT n, void * d) { - reinterpret_cast<My_Multiline_Input*>(n)->draw_hook = reinterpret_cast<hook_p>(d); +int My_Multiline_Input::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Multiline_Input::real_handle(int e) { + return Fl_Multiline_Input::handle(e); +} + + +void multiline_input_set_draw_hook(MULTILINE_INPUT i, void * d) { + reinterpret_cast<My_Multiline_Input*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); +} + + +void fl_multiline_input_draw(MULTILINE_INPUT i) { + reinterpret_cast<My_Multiline_Input*>(i)->real_draw(); +} + + +void multiline_input_set_handle_hook(MULTILINE_INPUT i, void * h) { + reinterpret_cast<My_Multiline_Input*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } -void fl_multiline_input_draw(MULTILINE_INPUT n) { - reinterpret_cast<My_Multiline_Input*>(n)->real_draw(); +int fl_multiline_input_handle(MULTILINE_INPUT i, int e) { + return reinterpret_cast<My_Multiline_Input*>(i)->real_handle(e); } diff --git a/src/c_fl_multiline_input.h b/src/c_fl_multiline_input.h index f0b6ea1..f6b3113 100644 --- a/src/c_fl_multiline_input.h +++ b/src/c_fl_multiline_input.h @@ -7,8 +7,11 @@ typedef void* MULTILINE_INPUT; -extern "C" void multiline_input_set_draw_hook(MULTILINE_INPUT n, void * d); -extern "C" void fl_multiline_input_draw(MULTILINE_INPUT n); +extern "C" void multiline_input_set_draw_hook(MULTILINE_INPUT i, void * d); +extern "C" void fl_multiline_input_draw(MULTILINE_INPUT i); +extern "C" void multiline_input_set_handle_hook(MULTILINE_INPUT i, void * h); +extern "C" int fl_multiline_input_handle(MULTILINE_INPUT i, int e); + extern "C" MULTILINE_INPUT new_fl_multiline_input(int x, int y, int w, int h, char* label); extern "C" void free_fl_multiline_input(MULTILINE_INPUT i); diff --git a/src/c_fl_multiline_output.cpp b/src/c_fl_multiline_output.cpp index eaf4274..a8d52e7 100644 --- a/src/c_fl_multiline_output.cpp +++ b/src/c_fl_multiline_output.cpp @@ -4,8 +4,14 @@ #include "c_fl_multiline_output.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; @@ -13,12 +19,17 @@ typedef hook* hook_p; class My_Multiline_Output : public Fl_Multiline_Output { public: using Fl_Multiline_Output::Fl_Multiline_Output; - friend void multiline_output_set_draw_hook(MULTILINE_OUTPUT n, void * d); - friend void fl_multiline_output_draw(MULTILINE_OUTPUT n); + friend void multiline_output_set_draw_hook(MULTILINE_OUTPUT i, void * d); + friend void fl_multiline_output_draw(MULTILINE_OUTPUT i); + friend void multiline_output_set_handle_hook(MULTILINE_OUTPUT i, void * h); + friend int fl_multiline_output_handle(MULTILINE_OUTPUT i, 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,13 +43,33 @@ void My_Multiline_Output::real_draw() { } -void multiline_output_set_draw_hook(MULTILINE_OUTPUT n, void * d) { - reinterpret_cast<My_Multiline_Output*>(n)->draw_hook = reinterpret_cast<hook_p>(d); +int My_Multiline_Output::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Multiline_Output::real_handle(int e) { + return Fl_Multiline_Output::handle(e); +} + + +void multiline_output_set_draw_hook(MULTILINE_OUTPUT i, void * d) { + reinterpret_cast<My_Multiline_Output*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); +} + + +void fl_multiline_output_draw(MULTILINE_OUTPUT i) { + reinterpret_cast<My_Multiline_Output*>(i)->real_draw(); +} + + +void multiline_output_set_handle_hook(MULTILINE_OUTPUT i, void * h) { + reinterpret_cast<My_Multiline_Output*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } -void fl_multiline_output_draw(MULTILINE_OUTPUT n) { - reinterpret_cast<My_Multiline_Output*>(n)->real_draw(); +int fl_multiline_output_handle(MULTILINE_OUTPUT i, int e) { + return reinterpret_cast<My_Multiline_Output*>(i)->real_handle(e); } diff --git a/src/c_fl_multiline_output.h b/src/c_fl_multiline_output.h index cc8eabd..a81c3e4 100644 --- a/src/c_fl_multiline_output.h +++ b/src/c_fl_multiline_output.h @@ -7,8 +7,11 @@ typedef void* MULTILINE_OUTPUT; -extern "C" void multiline_output_set_draw_hook(MULTILINE_OUTPUT n, void * d); -extern "C" void fl_multiline_output_draw(MULTILINE_OUTPUT n); +extern "C" void multiline_output_set_draw_hook(MULTILINE_OUTPUT i, void * d); +extern "C" void fl_multiline_output_draw(MULTILINE_OUTPUT i); +extern "C" void multiline_output_set_handle_hook(MULTILINE_OUTPUT i, void * h); +extern "C" int fl_multiline_output_handle(MULTILINE_OUTPUT i, int e); + extern "C" MULTILINE_OUTPUT new_fl_multiline_output(int x, int y, int w, int h, char* label); extern "C" void free_fl_multiline_output(MULTILINE_OUTPUT i); diff --git a/src/c_fl_output.cpp b/src/c_fl_output.cpp index de2ad49..bae40d6 100644 --- a/src/c_fl_output.cpp +++ b/src/c_fl_output.cpp @@ -4,8 +4,14 @@ #include "c_fl_output.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; @@ -13,12 +19,17 @@ typedef hook* hook_p; class My_Output : public Fl_Output { public: using Fl_Output::Fl_Output; - friend void output_set_draw_hook(OUTPUTT n, void * d); - friend void fl_output_draw(OUTPUTT n); + friend void output_set_draw_hook(OUTPUTT i, void * d); + friend void fl_output_draw(OUTPUTT i); + friend void output_set_handle_hook(OUTPUTT i, void * h); + friend int fl_output_handle(OUTPUTT i, 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,13 +43,33 @@ void My_Output::real_draw() { } -void output_set_draw_hook(OUTPUTT n, void * d) { - reinterpret_cast<My_Output*>(n)->draw_hook = reinterpret_cast<hook_p>(d); +int My_Output::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Output::real_handle(int e) { + return Fl_Output::handle(e); +} + + +void output_set_draw_hook(OUTPUTT i, void * d) { + reinterpret_cast<My_Output*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); +} + + +void fl_output_draw(OUTPUTT i) { + reinterpret_cast<My_Output*>(i)->real_draw(); +} + + +void output_set_handle_hook(OUTPUTT i, void * h) { + reinterpret_cast<My_Output*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } -void fl_output_draw(OUTPUTT n) { - reinterpret_cast<My_Output*>(n)->real_draw(); +int fl_output_handle(OUTPUTT i, int e) { + return reinterpret_cast<My_Output*>(i)->real_handle(e); } diff --git a/src/c_fl_output.h b/src/c_fl_output.h index da88cb1..8684d05 100644 --- a/src/c_fl_output.h +++ b/src/c_fl_output.h @@ -8,8 +8,11 @@ typedef void* OUTPUTT; -extern "C" void output_set_draw_hook(OUTPUTT n, void * d); -extern "C" void fl_output_draw(OUTPUTT n); +extern "C" void output_set_draw_hook(OUTPUTT i, void * d); +extern "C" void fl_output_draw(OUTPUTT i); +extern "C" void output_set_handle_hook(OUTPUTT i, void * h); +extern "C" int fl_output_handle(OUTPUTT i, int e); + extern "C" OUTPUTT new_fl_output(int x, int y, int w, int h, char* label); extern "C" void free_fl_output(OUTPUTT i); diff --git a/src/c_fl_secret_input.cpp b/src/c_fl_secret_input.cpp index 0c6c7b3..4fc524d 100644 --- a/src/c_fl_secret_input.cpp +++ b/src/c_fl_secret_input.cpp @@ -4,8 +4,14 @@ #include "c_fl_secret_input.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; @@ -13,12 +19,17 @@ typedef hook* hook_p; class My_Secret_Input : public Fl_Secret_Input { public: using Fl_Secret_Input::Fl_Secret_Input; - friend void secret_input_set_draw_hook(SECRET_INPUT n, void * d); - friend void fl_secret_input_draw(SECRET_INPUT n); + friend void secret_input_set_draw_hook(SECRET_INPUT i, void * d); + friend void fl_secret_input_draw(SECRET_INPUT i); + friend void secret_input_set_handle_hook(SECRET_INPUT i, void * h); + friend int fl_secret_input_handle(SECRET_INPUT i, 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,13 +43,33 @@ void My_Secret_Input::real_draw() { } -void secret_input_set_draw_hook(SECRET_INPUT n, void * d) { - reinterpret_cast<My_Secret_Input*>(n)->draw_hook = reinterpret_cast<hook_p>(d); +int My_Secret_Input::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Secret_Input::real_handle(int e) { + return Fl_Secret_Input::handle(e); +} + + +void secret_input_set_draw_hook(SECRET_INPUT i, void * d) { + reinterpret_cast<My_Secret_Input*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); +} + + +void fl_secret_input_draw(SECRET_INPUT i) { + reinterpret_cast<My_Secret_Input*>(i)->real_draw(); +} + + +void secret_input_set_handle_hook(SECRET_INPUT i, void * h) { + reinterpret_cast<My_Secret_Input*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } -void fl_secret_input_draw(SECRET_INPUT n) { - reinterpret_cast<My_Secret_Input*>(n)->real_draw(); +int fl_secret_input_handle(SECRET_INPUT i, int e) { + return reinterpret_cast<My_Secret_Input*>(i)->real_handle(e); } diff --git a/src/c_fl_secret_input.h b/src/c_fl_secret_input.h index 58b60a1..05a97fc 100644 --- a/src/c_fl_secret_input.h +++ b/src/c_fl_secret_input.h @@ -7,8 +7,11 @@ typedef void* SECRET_INPUT; -extern "C" void secret_input_set_draw_hook(SECRET_INPUT n, void * d); -extern "C" void fl_secret_input_draw(SECRET_INPUT n); +extern "C" void secret_input_set_draw_hook(SECRET_INPUT i, void * d); +extern "C" void fl_secret_input_draw(SECRET_INPUT i); +extern "C" void secret_input_set_handle_hook(SECRET_INPUT i, void * h); +extern "C" int fl_secret_input_handle(SECRET_INPUT i, int e); + extern "C" SECRET_INPUT new_fl_secret_input(int x, int y, int w, int h, char* label); extern "C" void free_fl_secret_input(SECRET_INPUT i); diff --git a/src/fltk-widgets-inputs-file.adb b/src/fltk-widgets-inputs-file.adb index 6ee0e84..cecc74e 100644 --- a/src/fltk-widgets-inputs-file.adb +++ b/src/fltk-widgets-inputs-file.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Inputs.File is (W, D : in System.Address); pragma Import (C, file_input_set_draw_hook, "file_input_set_draw_hook"); + procedure file_input_set_handle_hook + (W, H : in System.Address); + pragma Import (C, file_input_set_handle_hook, "file_input_set_handle_hook"); + procedure fl_file_input_draw (W : in System.Address); pragma Import (C, fl_file_input_draw, "fl_file_input_draw"); + function fl_file_input_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_file_input_handle, "fl_file_input_handle"); + function new_fl_file_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Inputs.File is + function Handle + (This : in out File_Input; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_file_input_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out File_Input) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Inputs.File is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); file_input_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + file_input_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-inputs-file.ads b/src/fltk-widgets-inputs-file.ads index d4ef568..9d7ef8a 100644 --- a/src/fltk-widgets-inputs-file.ads +++ b/src/fltk-widgets-inputs-file.ads @@ -16,6 +16,12 @@ package FLTK.Widgets.Inputs.File is (This : in out File_Input); + function Handle + (This : in out File_Input; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-inputs-float.adb b/src/fltk-widgets-inputs-float.adb index 4e0b489..782f8d9 100644 --- a/src/fltk-widgets-inputs-float.adb +++ b/src/fltk-widgets-inputs-float.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Inputs.Float is (W, D : in System.Address); pragma Import (C, float_input_set_draw_hook, "float_input_set_draw_hook"); + procedure float_input_set_handle_hook + (W, H : in System.Address); + pragma Import (C, float_input_set_handle_hook, "float_input_set_handle_hook"); + procedure fl_float_input_draw (W : in System.Address); pragma Import (C, fl_float_input_draw, "fl_float_input_draw"); + function fl_float_input_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_float_input_handle, "fl_float_input_handle"); + function new_fl_float_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Inputs.Float is + function Handle + (This : in out Float_Input; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_float_input_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Float_Input) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Inputs.Float is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); float_input_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + float_input_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-inputs-float.ads b/src/fltk-widgets-inputs-float.ads index 8d6abaa..09d3a0f 100644 --- a/src/fltk-widgets-inputs-float.ads +++ b/src/fltk-widgets-inputs-float.ads @@ -21,6 +21,12 @@ package FLTK.Widgets.Inputs.Float is (This : in out Float_Input); + function Handle + (This : in out Float_Input; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-inputs-integer.adb b/src/fltk-widgets-inputs-integer.adb index 92e95ec..5e2eb40 100644 --- a/src/fltk-widgets-inputs-integer.adb +++ b/src/fltk-widgets-inputs-integer.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Inputs.Integer is (W, D : in System.Address); pragma Import (C, int_input_set_draw_hook, "int_input_set_draw_hook"); + procedure int_input_set_handle_hook + (W, H : in System.Address); + pragma Import (C, int_input_set_handle_hook, "int_input_set_handle_hook"); + procedure fl_int_input_draw (W : in System.Address); pragma Import (C, fl_int_input_draw, "fl_int_input_draw"); + function fl_int_input_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_int_input_handle, "fl_int_input_handle"); + function new_fl_int_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Inputs.Integer is + function Handle + (This : in out Integer_Input; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_int_input_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Integer_Input) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Inputs.Integer is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); int_input_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + int_input_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-inputs-integer.ads b/src/fltk-widgets-inputs-integer.ads index 4699028..f8ed415 100644 --- a/src/fltk-widgets-inputs-integer.ads +++ b/src/fltk-widgets-inputs-integer.ads @@ -21,6 +21,12 @@ package FLTK.Widgets.Inputs.Integer is (This : in out Integer_Input); + function Handle + (This : in out Integer_Input; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-inputs-multiline.adb b/src/fltk-widgets-inputs-multiline.adb index a24a8f0..55bec80 100644 --- a/src/fltk-widgets-inputs-multiline.adb +++ b/src/fltk-widgets-inputs-multiline.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Inputs.Multiline is (W, D : in System.Address); pragma Import (C, multiline_input_set_draw_hook, "multiline_input_set_draw_hook"); + procedure multiline_input_set_handle_hook + (W, H : in System.Address); + pragma Import (C, multiline_input_set_handle_hook, "multiline_input_set_handle_hook"); + procedure fl_multiline_input_draw (W : in System.Address); pragma Import (C, fl_multiline_input_draw, "fl_multiline_input_draw"); + function fl_multiline_input_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_multiline_input_handle, "fl_multiline_input_handle"); + function new_fl_multiline_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Inputs.Multiline is + function Handle + (This : in out Multiline_Input; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_multiline_input_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Multiline_Input) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Inputs.Multiline is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); multiline_input_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + multiline_input_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-inputs-multiline.ads b/src/fltk-widgets-inputs-multiline.ads index 2d7b7d7..69382ca 100644 --- a/src/fltk-widgets-inputs-multiline.ads +++ b/src/fltk-widgets-inputs-multiline.ads @@ -16,6 +16,12 @@ package FLTK.Widgets.Inputs.Multiline is (This : in out Multiline_Input); + function Handle + (This : in out Multiline_Input; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-inputs-outputs-multiline.adb b/src/fltk-widgets-inputs-outputs-multiline.adb index 5edd67f..3629571 100644 --- a/src/fltk-widgets-inputs-outputs-multiline.adb +++ b/src/fltk-widgets-inputs-outputs-multiline.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Inputs.Outputs.Multiline is (W, D : in System.Address); pragma Import (C, multiline_output_set_draw_hook, "multiline_output_set_draw_hook"); + procedure multiline_output_set_handle_hook + (W, H : in System.Address); + pragma Import (C, multiline_output_set_handle_hook, "multiline_output_set_handle_hook"); + procedure fl_multiline_output_draw (W : in System.Address); pragma Import (C, fl_multiline_output_draw, "fl_multiline_output_draw"); + function fl_multiline_output_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_multiline_output_handle, "fl_multiline_output_handle"); + function new_fl_multiline_output (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Inputs.Outputs.Multiline is + function Handle + (This : in out Multiline_Output; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_multiline_output_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Multiline_Output) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Inputs.Outputs.Multiline is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); multiline_output_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + multiline_output_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-inputs-outputs-multiline.ads b/src/fltk-widgets-inputs-outputs-multiline.ads index 5f9f193..38f36e9 100644 --- a/src/fltk-widgets-inputs-outputs-multiline.ads +++ b/src/fltk-widgets-inputs-outputs-multiline.ads @@ -16,6 +16,12 @@ package FLTK.Widgets.Inputs.Outputs.Multiline is (This : in out Multiline_Output); + function Handle + (This : in out Multiline_Output; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-inputs-outputs.adb b/src/fltk-widgets-inputs-outputs.adb index 6e6ff95..5e623ac 100644 --- a/src/fltk-widgets-inputs-outputs.adb +++ b/src/fltk-widgets-inputs-outputs.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Inputs.Outputs is (W, D : in System.Address); pragma Import (C, output_set_draw_hook, "output_set_draw_hook"); + procedure output_set_handle_hook + (W, H : in System.Address); + pragma Import (C, output_set_handle_hook, "output_set_handle_hook"); + procedure fl_output_draw (W : in System.Address); pragma Import (C, fl_output_draw, "fl_output_draw"); + function fl_output_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_output_handle, "fl_output_handle"); + function new_fl_output (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Inputs.Outputs is + function Handle + (This : in out Output; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_output_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Output) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Inputs.Outputs is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); output_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + output_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-inputs-outputs.ads b/src/fltk-widgets-inputs-outputs.ads index 84c4a1f..13ef279 100644 --- a/src/fltk-widgets-inputs-outputs.ads +++ b/src/fltk-widgets-inputs-outputs.ads @@ -16,6 +16,12 @@ package FLTK.Widgets.Inputs.Outputs is (This : in out Output); + function Handle + (This : in out Output; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-inputs-secret.adb b/src/fltk-widgets-inputs-secret.adb index 64f0c7f..d4c6044 100644 --- a/src/fltk-widgets-inputs-secret.adb +++ b/src/fltk-widgets-inputs-secret.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Inputs.Secret is (W, D : in System.Address); pragma Import (C, secret_input_set_draw_hook, "secret_input_set_draw_hook"); + procedure secret_input_set_handle_hook + (W, H : in System.Address); + pragma Import (C, secret_input_set_handle_hook, "secret_input_set_handle_hook"); + procedure fl_secret_input_draw (W : in System.Address); pragma Import (C, fl_secret_input_draw, "fl_secret_input_draw"); + function fl_secret_input_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_secret_input_handle, "fl_secret_input_handle"); + function new_fl_secret_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Inputs.Secret is + function Handle + (This : in out Secret_Input; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_secret_input_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Secret_Input) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Inputs.Secret is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); secret_input_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + secret_input_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-inputs-secret.ads b/src/fltk-widgets-inputs-secret.ads index f45250b..3fe7ae1 100644 --- a/src/fltk-widgets-inputs-secret.ads +++ b/src/fltk-widgets-inputs-secret.ads @@ -16,6 +16,12 @@ package FLTK.Widgets.Inputs.Secret is (This : in out Secret_Input); + function Handle + (This : in out Secret_Input; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-inputs.adb b/src/fltk-widgets-inputs.adb index 572d11c..a6188cb 100644 --- a/src/fltk-widgets-inputs.adb +++ b/src/fltk-widgets-inputs.adb @@ -13,10 +13,20 @@ package body FLTK.Widgets.Inputs is (W, D : in System.Address); pragma Import (C, input_set_draw_hook, "input_set_draw_hook"); + procedure input_set_handle_hook + (W, H : in System.Address); + pragma Import (C, input_set_handle_hook, "input_set_handle_hook"); + procedure fl_input_draw (W : in System.Address); pragma Import (C, fl_input_draw, "fl_input_draw"); + function fl_input_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_input_handle, "fl_input_handle"); + function new_fl_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Inputs is + function Handle + (This : in out Input; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_input_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Input) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Inputs is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); input_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + input_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-inputs.ads b/src/fltk-widgets-inputs.ads index a461a89..90d6bb5 100644 --- a/src/fltk-widgets-inputs.ads +++ b/src/fltk-widgets-inputs.ads @@ -25,6 +25,12 @@ package FLTK.Widgets.Inputs is (This : in out Input); + function Handle + (This : in out Input; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-menus-menu_bars.adb b/src/fltk-widgets-menus-menu_bars.adb index 918ebe1..8281ec8 100644 --- a/src/fltk-widgets-menus-menu_bars.adb +++ b/src/fltk-widgets-menus-menu_bars.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Menus.Menu_Bars is (W, D : in System.Address); pragma Import (C, menu_bar_set_draw_hook, "menu_bar_set_draw_hook"); + procedure menu_bar_set_handle_hook + (W, H : in System.Address); + pragma Import (C, menu_bar_set_handle_hook, "menu_bar_set_handle_hook"); + procedure fl_menu_bar_draw (W : in System.Address); pragma Import (C, fl_menu_bar_draw, "fl_menu_bar_draw"); + function fl_menu_bar_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_menu_bar_handle, "fl_menu_bar_handle"); + function new_fl_menu_bar (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Menus.Menu_Bars is + function Handle + (This : in out Menu_Bar; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_menu_bar_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Menu_Bar) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Menus.Menu_Bars is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); menu_bar_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + menu_bar_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-menus-menu_bars.ads b/src/fltk-widgets-menus-menu_bars.ads index 5c5abcc..c5b20fe 100644 --- a/src/fltk-widgets-menus-menu_bars.ads +++ b/src/fltk-widgets-menus-menu_bars.ads @@ -16,6 +16,12 @@ package FLTK.Widgets.Menus.Menu_Bars is (This : in out Menu_Bar); + function Handle + (This : in out Menu_Bar; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-menus-menu_buttons.adb b/src/fltk-widgets-menus-menu_buttons.adb index b174db8..7758650 100644 --- a/src/fltk-widgets-menus-menu_buttons.adb +++ b/src/fltk-widgets-menus-menu_buttons.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Menus.Menu_Buttons is (W, D : in System.Address); pragma Import (C, menu_button_set_draw_hook, "menu_button_set_draw_hook"); + procedure menu_button_set_handle_hook + (W, H : in System.Address); + pragma Import (C, menu_button_set_handle_hook, "menu_button_set_handle_hook"); + procedure fl_menu_button_draw (W : in System.Address); pragma Import (C, fl_menu_button_draw, "fl_menu_button_draw"); + function fl_menu_button_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_menu_button_handle, "fl_menu_button_handle"); + function new_fl_menu_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -61,6 +71,18 @@ package body FLTK.Widgets.Menus.Menu_Buttons is + function Handle + (This : in out Menu_Button; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_menu_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Menu_Button) is begin @@ -92,6 +114,7 @@ package body FLTK.Widgets.Menus.Menu_Buttons is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); menu_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + menu_button_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-menus-menu_buttons.ads b/src/fltk-widgets-menus-menu_buttons.ads index 6501d34..174019a 100644 --- a/src/fltk-widgets-menus-menu_buttons.ads +++ b/src/fltk-widgets-menus-menu_buttons.ads @@ -25,6 +25,12 @@ package FLTK.Widgets.Menus.Menu_Buttons is (This : in out Menu_Button); + function Handle + (This : in out Menu_Button; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-menus.adb b/src/fltk-widgets-menus.adb index 1605ccd..140cc5b 100644 --- a/src/fltk-widgets-menus.adb +++ b/src/fltk-widgets-menus.adb @@ -25,6 +25,10 @@ package body FLTK.Widgets.Menus is (W, D : in System.Address); pragma Import (C, menu_set_draw_hook, "menu_set_draw_hook"); + procedure menu_set_handle_hook + (W, H : in System.Address); + pragma Import (C, menu_set_handle_hook, "menu_set_handle_hook"); + function new_fl_menu (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -88,6 +92,17 @@ package body FLTK.Widgets.Menus is + function Handle + (This : in out Menu; + Event : in Event_Kind) + return Event_Outcome is + begin + return Not_Handled; + end Handle; + + + + procedure Finalize (This : in out Menu) is begin @@ -119,6 +134,7 @@ package body FLTK.Widgets.Menus is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); menu_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + menu_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-menus.ads b/src/fltk-widgets-menus.ads index c33c180..c33b947 100644 --- a/src/fltk-widgets-menus.ads +++ b/src/fltk-widgets-menus.ads @@ -75,6 +75,12 @@ package FLTK.Widgets.Menus is (This : in out Menu) is null; + function Handle + (This : in out Menu; + Event : in Event_Kind) + return Event_Outcome; + + private |