From 3c1e9610ac0e503787678cea31d79e3126813a2c Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sat, 13 May 2017 18:37:11 +1000 Subject: Radio_Round_Button, Round_Button, Radio_Button, Repeat_Button, Toggle_Button widgets all now have Handle methods --- src/c_fl_radio_button.cpp | 39 +++++++++++++++++++++++--- src/c_fl_radio_button.h | 2 ++ src/c_fl_radio_round_button.cpp | 39 +++++++++++++++++++++++--- src/c_fl_radio_round_button.h | 2 ++ src/c_fl_repeat_button.cpp | 39 +++++++++++++++++++++++--- src/c_fl_repeat_button.h | 2 ++ src/c_fl_round_button.cpp | 39 +++++++++++++++++++++++--- src/c_fl_round_button.h | 2 ++ src/c_fl_toggle_button.cpp | 39 +++++++++++++++++++++++--- src/c_fl_toggle_button.h | 2 ++ src/fltk-widgets-buttons-light-round-radio.adb | 23 +++++++++++++++ src/fltk-widgets-buttons-light-round-radio.ads | 6 ++++ src/fltk-widgets-buttons-light-round.adb | 23 +++++++++++++++ src/fltk-widgets-buttons-light-round.ads | 6 ++++ src/fltk-widgets-buttons-radio.adb | 23 +++++++++++++++ src/fltk-widgets-buttons-radio.ads | 6 ++++ src/fltk-widgets-buttons-repeat.adb | 23 +++++++++++++++ src/fltk-widgets-buttons-repeat.ads | 6 ++++ src/fltk-widgets-buttons-toggle.adb | 23 +++++++++++++++ src/fltk-widgets-buttons-toggle.ads | 6 ++++ 20 files changed, 330 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/c_fl_radio_button.cpp b/src/c_fl_radio_button.cpp index 9eb55cb..45f07b9 100644 --- a/src/c_fl_radio_button.cpp +++ b/src/c_fl_radio_button.cpp @@ -4,8 +4,14 @@ #include "c_fl_radio_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_Radio_Button : public Fl_Radio_Button { using Fl_Radio_Button::Fl_Radio_Button; friend void radio_button_set_draw_hook(RADIOBUTTON b, void * d); friend void fl_radio_button_draw(RADIOBUTTON b); + friend void radio_button_set_handle_hook(RADIOBUTTON b, void * h); + friend int fl_radio_button_handle(RADIOBUTTON b, 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_Radio_Button::real_draw() { } +int My_Radio_Button::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Radio_Button::real_handle(int e) { + return Fl_Radio_Button::handle(e); +} + + void radio_button_set_draw_hook(RADIOBUTTON b, void * d) { - reinterpret_cast(b)->draw_hook = reinterpret_cast(d); + reinterpret_cast(b)->draw_hook = reinterpret_cast(d); } @@ -42,6 +63,16 @@ void fl_radio_button_draw(RADIOBUTTON b) { } +void radio_button_set_handle_hook(RADIOBUTTON b, void * h) { + reinterpret_cast(b)->handle_hook = reinterpret_cast(h); +} + + +int fl_radio_button_handle(RADIOBUTTON b, int e) { + return reinterpret_cast(b)->real_handle(e); +} + + RADIOBUTTON new_fl_radio_button(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_radio_button.h b/src/c_fl_radio_button.h index ef8a992..7c6ed35 100644 --- a/src/c_fl_radio_button.h +++ b/src/c_fl_radio_button.h @@ -9,6 +9,8 @@ typedef void* RADIOBUTTON; extern "C" void radio_button_set_draw_hook(RADIOBUTTON b, void * d); extern "C" void fl_radio_button_draw(RADIOBUTTON b); +extern "C" void radio_button_set_handle_hook(RADIOBUTTON b, void * h); +extern "C" int fl_radio_button_handle(RADIOBUTTON b, int e); extern "C" RADIOBUTTON new_fl_radio_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_radio_button(RADIOBUTTON b); diff --git a/src/c_fl_radio_round_button.cpp b/src/c_fl_radio_round_button.cpp index de9e928..12d043f 100644 --- a/src/c_fl_radio_round_button.cpp +++ b/src/c_fl_radio_round_button.cpp @@ -4,8 +4,14 @@ #include "c_fl_radio_round_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_Radio_Round_Button : public Fl_Radio_Round_Button { using Fl_Radio_Round_Button::Fl_Radio_Round_Button; friend void radio_round_button_set_draw_hook(RADIOROUNDBUTTON b, void * d); friend void fl_radio_round_button_draw(RADIOROUNDBUTTON b); + friend void radio_round_button_set_handle_hook(RADIOROUNDBUTTON b, void * h); + friend int fl_radio_round_button_handle(RADIOROUNDBUTTON b, 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_Radio_Round_Button::real_draw() { } +int My_Radio_Round_Button::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Radio_Round_Button::real_handle(int e) { + return Fl_Radio_Round_Button::handle(e); +} + + void radio_round_button_set_draw_hook(RADIOROUNDBUTTON b, void * d) { - reinterpret_cast(b)->draw_hook = reinterpret_cast(d); + reinterpret_cast(b)->draw_hook = reinterpret_cast(d); } @@ -42,6 +63,16 @@ void fl_radio_round_button_draw(RADIOROUNDBUTTON b) { } +void radio_round_button_set_handle_hook(RADIOROUNDBUTTON b, void * h) { + reinterpret_cast(b)->handle_hook = reinterpret_cast(h); +} + + +int fl_radio_round_button_handle(RADIOROUNDBUTTON b, int e) { + return reinterpret_cast(b)->real_handle(e); +} + + RADIOROUNDBUTTON new_fl_radio_round_button(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_radio_round_button.h b/src/c_fl_radio_round_button.h index b4a6645..2b220f5 100644 --- a/src/c_fl_radio_round_button.h +++ b/src/c_fl_radio_round_button.h @@ -9,6 +9,8 @@ typedef void* RADIOROUNDBUTTON; extern "C" void radio_round_button_set_draw_hook(RADIOROUNDBUTTON b, void * d); extern "C" void fl_radio_round_button_draw(RADIOROUNDBUTTON b); +extern "C" void radio_round_button_set_handle_hook(RADIOROUNDBUTTON b, void * h); +extern "C" int fl_radio_round_button_handle(RADIOROUNDBUTTON b, int e); extern "C" RADIOROUNDBUTTON new_fl_radio_round_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_radio_round_button(RADIOROUNDBUTTON b); diff --git a/src/c_fl_repeat_button.cpp b/src/c_fl_repeat_button.cpp index b1f557d..645f911 100644 --- a/src/c_fl_repeat_button.cpp +++ b/src/c_fl_repeat_button.cpp @@ -4,8 +4,14 @@ #include "c_fl_repeat_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_Repeat_Button : public Fl_Repeat_Button { using Fl_Repeat_Button::Fl_Repeat_Button; friend void repeat_button_set_draw_hook(REPEATBUTTON b, void * d); friend void fl_repeat_button_draw(REPEATBUTTON b); + friend void repeat_button_set_handle_hook(REPEATBUTTON b, void * h); + friend int fl_repeat_button_handle(REPEATBUTTON b, 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_Repeat_Button::real_draw() { } +int My_Repeat_Button::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Repeat_Button::real_handle(int e) { + return Fl_Repeat_Button::handle(e); +} + + void repeat_button_set_draw_hook(REPEATBUTTON b, void * d) { - reinterpret_cast(b)->draw_hook = reinterpret_cast(d); + reinterpret_cast(b)->draw_hook = reinterpret_cast(d); } @@ -42,6 +63,16 @@ void fl_repeat_button_draw(REPEATBUTTON b) { } +void repeat_button_set_handle_hook(REPEATBUTTON b, void * h) { + reinterpret_cast(b)->handle_hook = reinterpret_cast(h); +} + + +int fl_repeat_button_handle(REPEATBUTTON b, int e) { + return reinterpret_cast(b)->real_handle(e); +} + + REPEATBUTTON new_fl_repeat_button(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_repeat_button.h b/src/c_fl_repeat_button.h index 85f62c7..2aa44c7 100644 --- a/src/c_fl_repeat_button.h +++ b/src/c_fl_repeat_button.h @@ -9,6 +9,8 @@ typedef void* REPEATBUTTON; extern "C" void repeat_button_set_draw_hook(REPEATBUTTON b, void * d); extern "C" void fl_repeat_button_draw(REPEATBUTTON b); +extern "C" void repeat_button_set_handle_hook(REPEATBUTTON b, void * h); +extern "C" int fl_repeat_button_handle(REPEATBUTTON b, int e); extern "C" REPEATBUTTON new_fl_repeat_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_repeat_button(REPEATBUTTON b); diff --git a/src/c_fl_round_button.cpp b/src/c_fl_round_button.cpp index 2d6a158..02d6330 100644 --- a/src/c_fl_round_button.cpp +++ b/src/c_fl_round_button.cpp @@ -4,8 +4,14 @@ #include "c_fl_round_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_Round_Button : public Fl_Round_Button { using Fl_Round_Button::Fl_Round_Button; friend void round_button_set_draw_hook(ROUNDBUTTON b, void * d); friend void fl_round_button_draw(ROUNDBUTTON b); + friend void round_button_set_handle_hook(ROUNDBUTTON b, void * h); + friend int fl_round_button_handle(ROUNDBUTTON b, 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_Round_Button::real_draw() { } +int My_Round_Button::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Round_Button::real_handle(int e) { + return Fl_Round_Button::handle(e); +} + + void round_button_set_draw_hook(ROUNDBUTTON b, void * d) { - reinterpret_cast(b)->draw_hook = reinterpret_cast(d); + reinterpret_cast(b)->draw_hook = reinterpret_cast(d); } @@ -42,6 +63,16 @@ void fl_round_button_draw(ROUNDBUTTON b) { } +void round_button_set_handle_hook(ROUNDBUTTON b, void * h) { + reinterpret_cast(b)->handle_hook = reinterpret_cast(h); +} + + +int fl_round_button_handle(ROUNDBUTTON b, int e) { + return reinterpret_cast(b)->real_handle(e); +} + + ROUNDBUTTON new_fl_round_button(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_round_button.h b/src/c_fl_round_button.h index d725cd9..55fc691 100644 --- a/src/c_fl_round_button.h +++ b/src/c_fl_round_button.h @@ -9,6 +9,8 @@ typedef void* ROUNDBUTTON; extern "C" void round_button_set_draw_hook(ROUNDBUTTON b, void * d); extern "C" void fl_round_button_draw(ROUNDBUTTON b); +extern "C" void round_button_set_handle_hook(ROUNDBUTTON b, void * h); +extern "C" int fl_round_button_handle(ROUNDBUTTON b, int e); extern "C" ROUNDBUTTON new_fl_round_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_round_button(ROUNDBUTTON b); diff --git a/src/c_fl_toggle_button.cpp b/src/c_fl_toggle_button.cpp index d1dd0c0..c4da149 100644 --- a/src/c_fl_toggle_button.cpp +++ b/src/c_fl_toggle_button.cpp @@ -4,8 +4,14 @@ #include "c_fl_toggle_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_Toggle_Button : public Fl_Toggle_Button { using Fl_Toggle_Button::Fl_Toggle_Button; friend void toggle_button_set_draw_hook(TOGGLEBUTTON b, void * d); friend void fl_toggle_button_draw(TOGGLEBUTTON b); + friend void toggle_button_set_handle_hook(TOGGLEBUTTON b, void * h); + friend int fl_toggle_button_handle(TOGGLEBUTTON b, 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_Toggle_Button::real_draw() { } +int My_Toggle_Button::handle(int e) { + return (*handle_hook)(this->user_data(), e); +} + + +int My_Toggle_Button::real_handle(int e) { + return Fl_Toggle_Button::handle(e); +} + + void toggle_button_set_draw_hook(TOGGLEBUTTON b, void * d) { - reinterpret_cast(b)->draw_hook = reinterpret_cast(d); + reinterpret_cast(b)->draw_hook = reinterpret_cast(d); } @@ -42,6 +63,16 @@ void fl_toggle_button_draw(TOGGLEBUTTON b) { } +void toggle_button_set_handle_hook(TOGGLEBUTTON b, void * h) { + reinterpret_cast(b)->handle_hook = reinterpret_cast(h); +} + + +int fl_toggle_button_handle(TOGGLEBUTTON b, int e) { + return reinterpret_cast(b)->real_handle(e); +} + + TOGGLEBUTTON new_fl_toggle_button(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_toggle_button.h b/src/c_fl_toggle_button.h index d69039b..28ad4ec 100644 --- a/src/c_fl_toggle_button.h +++ b/src/c_fl_toggle_button.h @@ -9,6 +9,8 @@ typedef void* TOGGLEBUTTON; extern "C" void toggle_button_set_draw_hook(TOGGLEBUTTON b, void * d); extern "C" void fl_toggle_button_draw(TOGGLEBUTTON b); +extern "C" void toggle_button_set_handle_hook(TOGGLEBUTTON b, void * h); +extern "C" int fl_toggle_button_handle(TOGGLEBUTTON b, int e); extern "C" TOGGLEBUTTON new_fl_toggle_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_toggle_button(TOGGLEBUTTON b); diff --git a/src/fltk-widgets-buttons-light-round-radio.adb b/src/fltk-widgets-buttons-light-round-radio.adb index 1e9b854..eeaee2b 100644 --- a/src/fltk-widgets-buttons-light-round-radio.adb +++ b/src/fltk-widgets-buttons-light-round-radio.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Buttons.Light.Round.Radio is (W, D : in System.Address); pragma Import (C, radio_round_button_set_draw_hook, "radio_round_button_set_draw_hook"); + procedure radio_round_button_set_handle_hook + (W, H : in System.Address); + pragma Import (C, radio_round_button_set_handle_hook, "radio_round_button_set_handle_hook"); + procedure fl_radio_round_button_draw (W : in System.Address); pragma Import (C, fl_radio_round_button_draw, "fl_radio_round_button_draw"); + function fl_radio_round_button_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_radio_round_button_handle, "fl_radio_round_button_handle"); + function new_fl_radio_round_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Buttons.Light.Round.Radio is + function Handle + (This : in out Radio_Round_Button; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_radio_round_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Radio_Round_Button) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Buttons.Light.Round.Radio is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); radio_round_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + radio_round_button_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-buttons-light-round-radio.ads b/src/fltk-widgets-buttons-light-round-radio.ads index 9d8ea69..9bdb669 100644 --- a/src/fltk-widgets-buttons-light-round-radio.ads +++ b/src/fltk-widgets-buttons-light-round-radio.ads @@ -16,6 +16,12 @@ package FLTK.Widgets.Buttons.Light.Round.Radio is (This : in out Radio_Round_Button); + function Handle + (This : in out Radio_Round_Button; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-buttons-light-round.adb b/src/fltk-widgets-buttons-light-round.adb index 6e66b2c..c13bb43 100644 --- a/src/fltk-widgets-buttons-light-round.adb +++ b/src/fltk-widgets-buttons-light-round.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Buttons.Light.Round is (W, D : in System.Address); pragma Import (C, round_button_set_draw_hook, "round_button_set_draw_hook"); + procedure round_button_set_handle_hook + (W, H : in System.Address); + pragma Import (C, round_button_set_handle_hook, "round_button_set_handle_hook"); + procedure fl_round_button_draw (W : in System.Address); pragma Import (C, fl_round_button_draw, "fl_round_button_draw"); + function fl_round_button_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_round_button_handle, "fl_round_button_handle"); + function new_fl_round_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Buttons.Light.Round is + function Handle + (This : in out Round_Button; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_round_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Round_Button) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Buttons.Light.Round is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); round_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + round_button_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-buttons-light-round.ads b/src/fltk-widgets-buttons-light-round.ads index 28034ed..7e993a2 100644 --- a/src/fltk-widgets-buttons-light-round.ads +++ b/src/fltk-widgets-buttons-light-round.ads @@ -16,6 +16,12 @@ package FLTK.Widgets.Buttons.Light.Round is (This : in out Round_Button); + function Handle + (This : in out Round_Button; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-buttons-radio.adb b/src/fltk-widgets-buttons-radio.adb index 25fedc0..a60ce19 100644 --- a/src/fltk-widgets-buttons-radio.adb +++ b/src/fltk-widgets-buttons-radio.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Buttons.Radio is (W, D : in System.Address); pragma Import (C, radio_button_set_draw_hook, "radio_button_set_draw_hook"); + procedure radio_button_set_handle_hook + (W, H : in System.Address); + pragma Import (C, radio_button_set_handle_hook, "radio_button_set_handle_hook"); + procedure fl_radio_button_draw (W : in System.Address); pragma Import (C, fl_radio_button_draw, "fl_radio_button_draw"); + function fl_radio_button_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_radio_button_handle, "fl_radio_button_handle"); + function new_fl_radio_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Buttons.Radio is + function Handle + (This : in out Radio_Button; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_radio_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Radio_Button) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Buttons.Radio is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); radio_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + radio_button_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-buttons-radio.ads b/src/fltk-widgets-buttons-radio.ads index fcdb47a..08e007c 100644 --- a/src/fltk-widgets-buttons-radio.ads +++ b/src/fltk-widgets-buttons-radio.ads @@ -16,6 +16,12 @@ package FLTK.Widgets.Buttons.Radio is (This : in out Radio_Button); + function Handle + (This : in out Radio_Button; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-buttons-repeat.adb b/src/fltk-widgets-buttons-repeat.adb index 8e7c9f3..cbc3594 100644 --- a/src/fltk-widgets-buttons-repeat.adb +++ b/src/fltk-widgets-buttons-repeat.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Buttons.Repeat is (W, D : in System.Address); pragma Import (C, repeat_button_set_draw_hook, "repeat_button_set_draw_hook"); + procedure repeat_button_set_handle_hook + (W, H : in System.Address); + pragma Import (C, repeat_button_set_handle_hook, "repeat_button_set_handle_hook"); + procedure fl_repeat_button_draw (W : in System.Address); pragma Import (C, fl_repeat_button_draw, "fl_repeat_button_draw"); + function fl_repeat_button_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_repeat_button_handle, "fl_repeat_button_handle"); + function new_fl_repeat_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Buttons.Repeat is + function Handle + (This : in out Repeat_Button; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_repeat_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Repeat_Button) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Buttons.Repeat is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); repeat_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + repeat_button_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-buttons-repeat.ads b/src/fltk-widgets-buttons-repeat.ads index e05d85a..55f3b78 100644 --- a/src/fltk-widgets-buttons-repeat.ads +++ b/src/fltk-widgets-buttons-repeat.ads @@ -16,6 +16,12 @@ package FLTK.Widgets.Buttons.Repeat is (This : in out Repeat_Button); + function Handle + (This : in out Repeat_Button; + Event : in Event_Kind) + return Event_Outcome; + + private diff --git a/src/fltk-widgets-buttons-toggle.adb b/src/fltk-widgets-buttons-toggle.adb index e03d2ab..0c2cf69 100644 --- a/src/fltk-widgets-buttons-toggle.adb +++ b/src/fltk-widgets-buttons-toggle.adb @@ -12,10 +12,20 @@ package body FLTK.Widgets.Buttons.Toggle is (W, D : in System.Address); pragma Import (C, toggle_button_set_draw_hook, "toggle_button_set_draw_hook"); + procedure toggle_button_set_handle_hook + (W, H : in System.Address); + pragma Import (C, toggle_button_set_handle_hook, "toggle_button_set_handle_hook"); + procedure fl_toggle_button_draw (W : in System.Address); pragma Import (C, fl_toggle_button_draw, "fl_toggle_button_draw"); + function fl_toggle_button_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_toggle_button_handle, "fl_toggle_button_handle"); + function new_fl_toggle_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -56,6 +66,18 @@ package body FLTK.Widgets.Buttons.Toggle is + function Handle + (This : in out Toggle_Button; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_toggle_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + + + procedure Finalize (This : in out Toggle_Button) is begin @@ -87,6 +109,7 @@ package body FLTK.Widgets.Buttons.Toggle is (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); toggle_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); + toggle_button_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; diff --git a/src/fltk-widgets-buttons-toggle.ads b/src/fltk-widgets-buttons-toggle.ads index 256a7f7..f916df0 100644 --- a/src/fltk-widgets-buttons-toggle.ads +++ b/src/fltk-widgets-buttons-toggle.ads @@ -16,6 +16,12 @@ package FLTK.Widgets.Buttons.Toggle is (This : in out Toggle_Button); + function Handle + (This : in out Toggle_Button; + Event : in Event_Kind) + return Event_Outcome; + + private -- cgit