summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/c_fl_check_button.cpp39
-rw-r--r--src/c_fl_check_button.h2
-rw-r--r--src/c_fl_light_button.cpp39
-rw-r--r--src/c_fl_light_button.h2
-rw-r--r--src/c_fl_radio_light_button.cpp39
-rw-r--r--src/c_fl_radio_light_button.h2
-rw-r--r--src/c_fl_return_button.cpp39
-rw-r--r--src/c_fl_return_button.h2
-rw-r--r--src/fltk-widgets-buttons-enter.adb23
-rw-r--r--src/fltk-widgets-buttons-enter.ads6
-rw-r--r--src/fltk-widgets-buttons-light-check.adb23
-rw-r--r--src/fltk-widgets-buttons-light-check.ads6
-rw-r--r--src/fltk-widgets-buttons-light-radio.adb23
-rw-r--r--src/fltk-widgets-buttons-light-radio.ads6
-rw-r--r--src/fltk-widgets-buttons-light.adb23
-rw-r--r--src/fltk-widgets-buttons-light.ads6
16 files changed, 264 insertions, 16 deletions
diff --git a/src/c_fl_check_button.cpp b/src/c_fl_check_button.cpp
index 665571d..23e81ed 100644
--- a/src/c_fl_check_button.cpp
+++ b/src/c_fl_check_button.cpp
@@ -4,8 +4,14 @@
#include "c_fl_check_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_Check_Button : public Fl_Check_Button {
using Fl_Check_Button::Fl_Check_Button;
friend void check_button_set_draw_hook(CHECKBUTTON b, void * d);
friend void fl_check_button_draw(CHECKBUTTON b);
+ friend void check_button_set_handle_hook(CHECKBUTTON b, void * h);
+ friend int fl_check_button_handle(CHECKBUTTON 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_Check_Button::real_draw() {
}
+int My_Check_Button::handle(int e) {
+ return (*handle_hook)(this->user_data(), e);
+}
+
+
+int My_Check_Button::real_handle(int e) {
+ return Fl_Check_Button::handle(e);
+}
+
+
void check_button_set_draw_hook(CHECKBUTTON b, void * d) {
- reinterpret_cast<My_Check_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+ reinterpret_cast<My_Check_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d);
}
@@ -42,6 +63,16 @@ void fl_check_button_draw(CHECKBUTTON b) {
}
+void check_button_set_handle_hook(CHECKBUTTON b, void * h) {
+ reinterpret_cast<My_Check_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h);
+}
+
+
+int fl_check_button_handle(CHECKBUTTON b, int e) {
+ return reinterpret_cast<My_Check_Button*>(b)->real_handle(e);
+}
+
+
CHECKBUTTON new_fl_check_button(int x, int y, int w, int h, char* label) {
diff --git a/src/c_fl_check_button.h b/src/c_fl_check_button.h
index ee7b5bd..2d6e5da 100644
--- a/src/c_fl_check_button.h
+++ b/src/c_fl_check_button.h
@@ -9,6 +9,8 @@ typedef void* CHECKBUTTON;
extern "C" void check_button_set_draw_hook(CHECKBUTTON b, void * d);
extern "C" void fl_check_button_draw(CHECKBUTTON b);
+extern "C" void check_button_set_handle_hook(CHECKBUTTON b, void * h);
+extern "C" int fl_check_button_handle(CHECKBUTTON b, int e);
extern "C" CHECKBUTTON new_fl_check_button(int x, int y, int w, int h, char* label);
extern "C" void free_fl_check_button(CHECKBUTTON b);
diff --git a/src/c_fl_light_button.cpp b/src/c_fl_light_button.cpp
index 5ef173e..4dfa893 100644
--- a/src/c_fl_light_button.cpp
+++ b/src/c_fl_light_button.cpp
@@ -4,8 +4,14 @@
#include "c_fl_light_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_Light_Button : public Fl_Light_Button {
using Fl_Light_Button::Fl_Light_Button;
friend void light_button_set_draw_hook(LIGHTBUTTON b, void * d);
friend void fl_light_button_draw(LIGHTBUTTON b);
+ friend void light_button_set_handle_hook(LIGHTBUTTON b, void * h);
+ friend int fl_light_button_handle(LIGHTBUTTON 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_Light_Button::real_draw() {
}
+int My_Light_Button::handle(int e) {
+ return (*handle_hook)(this->user_data(), e);
+}
+
+
+int My_Light_Button::real_handle(int e) {
+ return Fl_Light_Button::handle(e);
+}
+
+
void light_button_set_draw_hook(LIGHTBUTTON b, void * d) {
- reinterpret_cast<My_Light_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+ reinterpret_cast<My_Light_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d);
}
@@ -42,6 +63,16 @@ void fl_light_button_draw(LIGHTBUTTON b) {
}
+void light_button_set_handle_hook(LIGHTBUTTON b, void * h) {
+ reinterpret_cast<My_Light_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h);
+}
+
+
+int fl_light_button_handle(LIGHTBUTTON b, int e) {
+ return reinterpret_cast<My_Light_Button*>(b)->real_handle(e);
+}
+
+
LIGHTBUTTON new_fl_light_button(int x, int y, int w, int h, char* label) {
diff --git a/src/c_fl_light_button.h b/src/c_fl_light_button.h
index 6530c7c..4faa9e9 100644
--- a/src/c_fl_light_button.h
+++ b/src/c_fl_light_button.h
@@ -9,6 +9,8 @@ typedef void* LIGHTBUTTON;
extern "C" void light_button_set_draw_hook(LIGHTBUTTON b, void * d);
extern "C" void fl_light_button_draw(LIGHTBUTTON b);
+extern "C" void light_button_set_handle_hook(LIGHTBUTTON b, void * h);
+extern "C" int fl_light_button_handle(LIGHTBUTTON b, int e);
extern "C" LIGHTBUTTON new_fl_light_button(int x, int y, int w, int h, char* label);
extern "C" void free_fl_light_button(LIGHTBUTTON b);
diff --git a/src/c_fl_radio_light_button.cpp b/src/c_fl_radio_light_button.cpp
index c865480..3ffea4f 100644
--- a/src/c_fl_radio_light_button.cpp
+++ b/src/c_fl_radio_light_button.cpp
@@ -4,8 +4,14 @@
#include "c_fl_radio_light_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_Light_Button : public Fl_Radio_Light_Button {
using Fl_Radio_Light_Button::Fl_Radio_Light_Button;
friend void radio_light_button_set_draw_hook(RADIOLIGHTBUTTON b, void * d);
friend void fl_radio_light_button_draw(RADIOLIGHTBUTTON b);
+ friend void radio_light_button_set_handle_hook(RADIOLIGHTBUTTON b, void * h);
+ friend int fl_radio_light_button_handle(RADIOLIGHTBUTTON 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_Light_Button::real_draw() {
}
+int My_Radio_Light_Button::handle(int e) {
+ return (*handle_hook)(this->user_data(), e);
+}
+
+
+int My_Radio_Light_Button::real_handle(int e) {
+ return Fl_Radio_Light_Button::handle(e);
+}
+
+
void radio_light_button_set_draw_hook(RADIOLIGHTBUTTON b, void * d) {
- reinterpret_cast<My_Radio_Light_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+ reinterpret_cast<My_Radio_Light_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d);
}
@@ -42,6 +63,16 @@ void fl_radio_light_button_draw(RADIOLIGHTBUTTON b) {
}
+void radio_light_button_set_handle_hook(RADIOLIGHTBUTTON b, void * h) {
+ reinterpret_cast<My_Radio_Light_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h);
+}
+
+
+int fl_radio_light_button_handle(RADIOLIGHTBUTTON b, int e) {
+ return reinterpret_cast<My_Radio_Light_Button*>(b)->real_handle(e);
+}
+
+
RADIOLIGHTBUTTON new_fl_radio_light_button(int x, int y, int w, int h, char* label) {
diff --git a/src/c_fl_radio_light_button.h b/src/c_fl_radio_light_button.h
index 6675d4a..6947ce6 100644
--- a/src/c_fl_radio_light_button.h
+++ b/src/c_fl_radio_light_button.h
@@ -9,6 +9,8 @@ typedef void* RADIOLIGHTBUTTON;
extern "C" void radio_light_button_set_draw_hook(RADIOLIGHTBUTTON b, void * d);
extern "C" void fl_radio_light_button_draw(RADIOLIGHTBUTTON b);
+extern "C" void radio_light_button_set_handle_hook(RADIOLIGHTBUTTON b, void * h);
+extern "C" int fl_radio_light_button_handle(RADIOLIGHTBUTTON b, int e);
extern "C" RADIOLIGHTBUTTON new_fl_radio_light_button(int x, int y, int w, int h, char* label);
extern "C" void free_fl_radio_light_button(RADIOLIGHTBUTTON b);
diff --git a/src/c_fl_return_button.cpp b/src/c_fl_return_button.cpp
index 77939a7..11a7a9b 100644
--- a/src/c_fl_return_button.cpp
+++ b/src/c_fl_return_button.cpp
@@ -4,8 +4,14 @@
#include "c_fl_return_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_Return_Button : public Fl_Return_Button {
using Fl_Return_Button::Fl_Return_Button;
friend void return_button_set_draw_hook(RETURNBUTTON b, void * d);
friend void fl_return_button_draw(RETURNBUTTON b);
+ friend void return_button_set_handle_hook(RETURNBUTTON b, void * h);
+ friend int fl_return_button_handle(RETURNBUTTON 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_Return_Button::real_draw() {
}
+int My_Return_Button::handle(int e) {
+ return (*handle_hook)(this->user_data(), e);
+}
+
+
+int My_Return_Button::real_handle(int e) {
+ return Fl_Return_Button::handle(e);
+}
+
+
void return_button_set_draw_hook(RETURNBUTTON b, void * d) {
- reinterpret_cast<My_Return_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+ reinterpret_cast<My_Return_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d);
}
@@ -42,6 +63,16 @@ void fl_return_button_draw(RETURNBUTTON b) {
}
+void return_button_set_handle_hook(RETURNBUTTON b, void * h) {
+ reinterpret_cast<My_Return_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h);
+}
+
+
+int fl_return_button_handle(RETURNBUTTON b, int e) {
+ return reinterpret_cast<My_Return_Button*>(b)->real_handle(e);
+}
+
+
RETURNBUTTON new_fl_return_button(int x, int y, int w, int h, char* label) {
diff --git a/src/c_fl_return_button.h b/src/c_fl_return_button.h
index 7578ff8..a688eb0 100644
--- a/src/c_fl_return_button.h
+++ b/src/c_fl_return_button.h
@@ -9,6 +9,8 @@ typedef void* RETURNBUTTON;
extern "C" void return_button_set_draw_hook(RETURNBUTTON b, void * d);
extern "C" void fl_return_button_draw(RETURNBUTTON b);
+extern "C" void return_button_set_handle_hook(RETURNBUTTON b, void * h);
+extern "C" int fl_return_button_handle(RETURNBUTTON b, int e);
extern "C" RETURNBUTTON new_fl_return_button(int x, int y, int w, int h, char* label);
extern "C" void free_fl_return_button(RETURNBUTTON b);
diff --git a/src/fltk-widgets-buttons-enter.adb b/src/fltk-widgets-buttons-enter.adb
index 6d8e796..a1f36f6 100644
--- a/src/fltk-widgets-buttons-enter.adb
+++ b/src/fltk-widgets-buttons-enter.adb
@@ -12,10 +12,20 @@ package body FLTK.Widgets.Buttons.Enter is
(W, D : in System.Address);
pragma Import (C, return_button_set_draw_hook, "return_button_set_draw_hook");
+ procedure return_button_set_handle_hook
+ (W, H : in System.Address);
+ pragma Import (C, return_button_set_handle_hook, "return_button_set_handle_hook");
+
procedure fl_return_button_draw
(W : in System.Address);
pragma Import (C, fl_return_button_draw, "fl_return_button_draw");
+ function fl_return_button_handle
+ (W : in System.Address;
+ E : in Interfaces.C.int)
+ return Interfaces.C.int;
+ pragma Import (C, fl_return_button_handle, "fl_return_button_handle");
+
function new_fl_return_button
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -56,6 +66,18 @@ package body FLTK.Widgets.Buttons.Enter is
+ function Handle
+ (This : in out Enter_Button;
+ Event : in Event_Kind)
+ return Event_Outcome is
+ begin
+ return Event_Outcome'Val
+ (fl_return_button_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
+ end Handle;
+
+
+
+
procedure Finalize
(This : in out Enter_Button) is
begin
@@ -87,6 +109,7 @@ package body FLTK.Widgets.Buttons.Enter is
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
return_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
+ return_button_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
end return;
end Create;
diff --git a/src/fltk-widgets-buttons-enter.ads b/src/fltk-widgets-buttons-enter.ads
index d6c42ac..73e2c01 100644
--- a/src/fltk-widgets-buttons-enter.ads
+++ b/src/fltk-widgets-buttons-enter.ads
@@ -19,6 +19,12 @@ package FLTK.Widgets.Buttons.Enter is
(This : in out Enter_Button);
+ function Handle
+ (This : in out Enter_Button;
+ Event : in Event_Kind)
+ return Event_Outcome;
+
+
private
diff --git a/src/fltk-widgets-buttons-light-check.adb b/src/fltk-widgets-buttons-light-check.adb
index 4a1bcdb..8db7533 100644
--- a/src/fltk-widgets-buttons-light-check.adb
+++ b/src/fltk-widgets-buttons-light-check.adb
@@ -12,10 +12,20 @@ package body FLTK.Widgets.Buttons.Light.Check is
(W, D : in System.Address);
pragma Import (C, check_button_set_draw_hook, "check_button_set_draw_hook");
+ procedure check_button_set_handle_hook
+ (W, H : in System.Address);
+ pragma Import (C, check_button_set_handle_hook, "check_button_set_handle_hook");
+
procedure fl_check_button_draw
(W : in System.Address);
pragma Import (C, fl_check_button_draw, "fl_check_button_draw");
+ function fl_check_button_handle
+ (W : in System.Address;
+ E : in Interfaces.C.int)
+ return Interfaces.C.int;
+ pragma Import (C, fl_check_button_handle, "fl_check_button_handle");
+
function new_fl_check_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.Check is
+ function Handle
+ (This : in out Check_Button;
+ Event : in Event_Kind)
+ return Event_Outcome is
+ begin
+ return Event_Outcome'Val
+ (fl_check_button_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
+ end Handle;
+
+
+
+
procedure Finalize
(This : in out Check_Button) is
begin
@@ -87,6 +109,7 @@ package body FLTK.Widgets.Buttons.Light.Check is
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
check_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
+ check_button_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
end return;
end Create;
diff --git a/src/fltk-widgets-buttons-light-check.ads b/src/fltk-widgets-buttons-light-check.ads
index e5fe5bc..f6d63d7 100644
--- a/src/fltk-widgets-buttons-light-check.ads
+++ b/src/fltk-widgets-buttons-light-check.ads
@@ -16,6 +16,12 @@ package FLTK.Widgets.Buttons.Light.Check is
(This : in out Check_Button);
+ function Handle
+ (This : in out Check_Button;
+ Event : in Event_Kind)
+ return Event_Outcome;
+
+
private
diff --git a/src/fltk-widgets-buttons-light-radio.adb b/src/fltk-widgets-buttons-light-radio.adb
index 11c2b35..7ff4e43 100644
--- a/src/fltk-widgets-buttons-light-radio.adb
+++ b/src/fltk-widgets-buttons-light-radio.adb
@@ -12,10 +12,20 @@ package body FLTK.Widgets.Buttons.Light.Radio is
(W, D : in System.Address);
pragma Import (C, radio_light_button_set_draw_hook, "radio_light_button_set_draw_hook");
+ procedure radio_light_button_set_handle_hook
+ (W, H : in System.Address);
+ pragma Import (C, radio_light_button_set_handle_hook, "radio_light_button_set_handle_hook");
+
procedure fl_radio_light_button_draw
(W : in System.Address);
pragma Import (C, fl_radio_light_button_draw, "fl_radio_light_button_draw");
+ function fl_radio_light_button_handle
+ (W : in System.Address;
+ E : in Interfaces.C.int)
+ return Interfaces.C.int;
+ pragma Import (C, fl_radio_light_button_handle, "fl_radio_light_button_handle");
+
function new_fl_radio_light_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.Radio is
+ function Handle
+ (This : in out Radio_Light_Button;
+ Event : in Event_Kind)
+ return Event_Outcome is
+ begin
+ return Event_Outcome'Val
+ (fl_radio_light_button_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
+ end Handle;
+
+
+
+
procedure Finalize
(This : in out Radio_Light_Button) is
begin
@@ -87,6 +109,7 @@ package body FLTK.Widgets.Buttons.Light.Radio is
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
radio_light_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
+ radio_light_button_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
end return;
end Create;
diff --git a/src/fltk-widgets-buttons-light-radio.ads b/src/fltk-widgets-buttons-light-radio.ads
index 0854b57..46e4e3b 100644
--- a/src/fltk-widgets-buttons-light-radio.ads
+++ b/src/fltk-widgets-buttons-light-radio.ads
@@ -16,6 +16,12 @@ package FLTK.Widgets.Buttons.Light.Radio is
(This : in out Radio_Light_Button);
+ function Handle
+ (This : in out Radio_Light_Button;
+ Event : in Event_Kind)
+ return Event_Outcome;
+
+
private
diff --git a/src/fltk-widgets-buttons-light.adb b/src/fltk-widgets-buttons-light.adb
index 77b8ee1..e8adf8b 100644
--- a/src/fltk-widgets-buttons-light.adb
+++ b/src/fltk-widgets-buttons-light.adb
@@ -12,10 +12,20 @@ package body FLTK.Widgets.Buttons.Light is
(W, D : in System.Address);
pragma Import (C, light_button_set_draw_hook, "light_button_set_draw_hook");
+ procedure light_button_set_handle_hook
+ (W, H : in System.Address);
+ pragma Import (C, light_button_set_handle_hook, "light_button_set_handle_hook");
+
procedure fl_light_button_draw
(W : in System.Address);
pragma Import (C, fl_light_button_draw, "fl_light_button_draw");
+ function fl_light_button_handle
+ (W : in System.Address;
+ E : in Interfaces.C.int)
+ return Interfaces.C.int;
+ pragma Import (C, fl_light_button_handle, "fl_light_button_handle");
+
function new_fl_light_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 is
+ function Handle
+ (This : in out Light_Button;
+ Event : in Event_Kind)
+ return Event_Outcome is
+ begin
+ return Event_Outcome'Val
+ (fl_light_button_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
+ end Handle;
+
+
+
+
procedure Finalize
(This : in out Light_Button) is
begin
@@ -87,6 +109,7 @@ package body FLTK.Widgets.Buttons.Light is
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
light_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
+ light_button_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
end return;
end Create;
diff --git a/src/fltk-widgets-buttons-light.ads b/src/fltk-widgets-buttons-light.ads
index 8d6e83f..77d8186 100644
--- a/src/fltk-widgets-buttons-light.ads
+++ b/src/fltk-widgets-buttons-light.ads
@@ -16,6 +16,12 @@ package FLTK.Widgets.Buttons.Light is
(This : in out Light_Button);
+ function Handle
+ (This : in out Light_Button;
+ Event : in Event_Kind)
+ return Event_Outcome;
+
+
private