summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/c_fl_button.cpp52
-rw-r--r--src/c_fl_button.h3
-rw-r--r--src/c_fl_check_button.cpp44
-rw-r--r--src/c_fl_check_button.h3
-rw-r--r--src/c_fl_light_button.cpp44
-rw-r--r--src/c_fl_light_button.h3
-rw-r--r--src/c_fl_radio_button.cpp44
-rw-r--r--src/c_fl_radio_button.h3
-rw-r--r--src/c_fl_radio_light_button.cpp44
-rw-r--r--src/c_fl_radio_light_button.h3
-rw-r--r--src/c_fl_radio_round_button.cpp44
-rw-r--r--src/c_fl_radio_round_button.h3
-rw-r--r--src/c_fl_repeat_button.cpp44
-rw-r--r--src/c_fl_repeat_button.h3
-rw-r--r--src/c_fl_return_button.cpp44
-rw-r--r--src/c_fl_return_button.h3
-rw-r--r--src/c_fl_round_button.cpp44
-rw-r--r--src/c_fl_round_button.h3
-rw-r--r--src/c_fl_toggle_button.cpp44
-rw-r--r--src/c_fl_toggle_button.h3
-rw-r--r--src/fltk-widgets-buttons-enter.adb33
-rw-r--r--src/fltk-widgets-buttons-enter.ads8
-rw-r--r--src/fltk-widgets-buttons-light-check.adb33
-rw-r--r--src/fltk-widgets-buttons-light-check.ads8
-rw-r--r--src/fltk-widgets-buttons-light-radio.adb33
-rw-r--r--src/fltk-widgets-buttons-light-radio.ads8
-rw-r--r--src/fltk-widgets-buttons-light-round-radio.adb33
-rw-r--r--src/fltk-widgets-buttons-light-round-radio.ads8
-rw-r--r--src/fltk-widgets-buttons-light-round.adb33
-rw-r--r--src/fltk-widgets-buttons-light-round.ads8
-rw-r--r--src/fltk-widgets-buttons-light.adb33
-rw-r--r--src/fltk-widgets-buttons-light.ads8
-rw-r--r--src/fltk-widgets-buttons-radio.adb33
-rw-r--r--src/fltk-widgets-buttons-radio.ads8
-rw-r--r--src/fltk-widgets-buttons-repeat.adb33
-rw-r--r--src/fltk-widgets-buttons-repeat.ads8
-rw-r--r--src/fltk-widgets-buttons-toggle.adb33
-rw-r--r--src/fltk-widgets-buttons-toggle.ads8
-rw-r--r--src/fltk-widgets-buttons.adb33
-rw-r--r--src/fltk-widgets-buttons.ads7
40 files changed, 864 insertions, 23 deletions
diff --git a/src/c_fl_button.cpp b/src/c_fl_button.cpp
index 621656c..233e4ab 100644
--- a/src/c_fl_button.cpp
+++ b/src/c_fl_button.cpp
@@ -4,28 +4,70 @@
#include "c_fl_button.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Button : public Fl_Button {
+ public:
+ using Fl_Button::Fl_Button;
+ friend void button_set_draw_hook(BUTTON b, void * d);
+ friend void fl_button_draw(BUTTON b);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Button::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Button::real_draw() {
+ Fl_Button::draw();
+}
+
+
+void button_set_draw_hook(BUTTON b, void * d) {
+ reinterpret_cast<My_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_button_draw(BUTTON b) {
+ reinterpret_cast<My_Button*>(b)->real_draw();
+}
+
+
+
+
BUTTON new_fl_button(int x, int y, int w, int h, char* label) {
- Fl_Button *b = new Fl_Button(x, y, w, h, label);
+ My_Button *b = new My_Button(x, y, w, h, label);
return b;
}
void free_fl_button(BUTTON b) {
- delete reinterpret_cast<Fl_Button*>(b);
+ delete reinterpret_cast<My_Button*>(b);
}
+
+
int fl_button_get_state(BUTTON b) {
- return reinterpret_cast<Fl_Button*>(b)->value();
+ return reinterpret_cast<My_Button*>(b)->value();
}
void fl_button_set_state(BUTTON b, int s) {
- reinterpret_cast<Fl_Button*>(b)->value(s);
+ reinterpret_cast<My_Button*>(b)->value(s);
}
void fl_button_set_only(BUTTON b) {
- reinterpret_cast<Fl_Button*>(b)->setonly();
+ reinterpret_cast<My_Button*>(b)->setonly();
}
diff --git a/src/c_fl_button.h b/src/c_fl_button.h
index 239689a..14faa2b 100644
--- a/src/c_fl_button.h
+++ b/src/c_fl_button.h
@@ -7,6 +7,9 @@
typedef void* BUTTON;
+extern "C" void button_set_draw_hook(BUTTON b, void * d);
+extern "C" void fl_button_draw(BUTTON b);
+
extern "C" BUTTON new_fl_button(int x, int y, int w, int h, char* label);
extern "C" void free_fl_button(BUTTON b);
diff --git a/src/c_fl_check_button.cpp b/src/c_fl_check_button.cpp
index e737942..665571d 100644
--- a/src/c_fl_check_button.cpp
+++ b/src/c_fl_check_button.cpp
@@ -4,13 +4,53 @@
#include "c_fl_check_button.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Check_Button : public Fl_Check_Button {
+ public:
+ 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);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Check_Button::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Check_Button::real_draw() {
+ Fl_Check_Button::draw();
+}
+
+
+void check_button_set_draw_hook(CHECKBUTTON b, void * d) {
+ reinterpret_cast<My_Check_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_check_button_draw(CHECKBUTTON b) {
+ reinterpret_cast<My_Check_Button*>(b)->real_draw();
+}
+
+
+
+
CHECKBUTTON new_fl_check_button(int x, int y, int w, int h, char* label) {
- Fl_Check_Button *b = new Fl_Check_Button(x, y, w, h, label);
+ My_Check_Button *b = new My_Check_Button(x, y, w, h, label);
return b;
}
void free_fl_check_button(CHECKBUTTON b) {
- delete reinterpret_cast<Fl_Check_Button*>(b);
+ delete reinterpret_cast<My_Check_Button*>(b);
}
diff --git a/src/c_fl_check_button.h b/src/c_fl_check_button.h
index f44b5ec..ee7b5bd 100644
--- a/src/c_fl_check_button.h
+++ b/src/c_fl_check_button.h
@@ -7,6 +7,9 @@
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" 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 daa99ef..5ef173e 100644
--- a/src/c_fl_light_button.cpp
+++ b/src/c_fl_light_button.cpp
@@ -4,13 +4,53 @@
#include "c_fl_light_button.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Light_Button : public Fl_Light_Button {
+ public:
+ 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);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Light_Button::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Light_Button::real_draw() {
+ Fl_Light_Button::draw();
+}
+
+
+void light_button_set_draw_hook(LIGHTBUTTON b, void * d) {
+ reinterpret_cast<My_Light_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_light_button_draw(LIGHTBUTTON b) {
+ reinterpret_cast<My_Light_Button*>(b)->real_draw();
+}
+
+
+
+
LIGHTBUTTON new_fl_light_button(int x, int y, int w, int h, char* label) {
- Fl_Light_Button *b = new Fl_Light_Button(x, y, w, h, label);
+ My_Light_Button *b = new My_Light_Button(x, y, w, h, label);
return b;
}
void free_fl_light_button(LIGHTBUTTON b) {
- delete reinterpret_cast<Fl_Light_Button*>(b);
+ delete reinterpret_cast<My_Light_Button*>(b);
}
diff --git a/src/c_fl_light_button.h b/src/c_fl_light_button.h
index f8c005d..6530c7c 100644
--- a/src/c_fl_light_button.h
+++ b/src/c_fl_light_button.h
@@ -7,6 +7,9 @@
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" 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_button.cpp b/src/c_fl_radio_button.cpp
index 1cac323..9eb55cb 100644
--- a/src/c_fl_radio_button.cpp
+++ b/src/c_fl_radio_button.cpp
@@ -4,13 +4,53 @@
#include "c_fl_radio_button.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Radio_Button : public Fl_Radio_Button {
+ public:
+ 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);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Radio_Button::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Radio_Button::real_draw() {
+ Fl_Radio_Button::draw();
+}
+
+
+void radio_button_set_draw_hook(RADIOBUTTON b, void * d) {
+ reinterpret_cast<My_Radio_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_radio_button_draw(RADIOBUTTON b) {
+ reinterpret_cast<My_Radio_Button*>(b)->real_draw();
+}
+
+
+
+
RADIOBUTTON new_fl_radio_button(int x, int y, int w, int h, char* label) {
- Fl_Radio_Button *b = new Fl_Radio_Button(x, y, w, h, label);
+ My_Radio_Button *b = new My_Radio_Button(x, y, w, h, label);
return b;
}
void free_fl_radio_button(RADIOBUTTON b) {
- delete reinterpret_cast<Fl_Radio_Button*>(b);
+ delete reinterpret_cast<My_Radio_Button*>(b);
}
diff --git a/src/c_fl_radio_button.h b/src/c_fl_radio_button.h
index d9ea819..ef8a992 100644
--- a/src/c_fl_radio_button.h
+++ b/src/c_fl_radio_button.h
@@ -7,6 +7,9 @@
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" 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_light_button.cpp b/src/c_fl_radio_light_button.cpp
index 7dd4a5f..c865480 100644
--- a/src/c_fl_radio_light_button.cpp
+++ b/src/c_fl_radio_light_button.cpp
@@ -4,13 +4,53 @@
#include "c_fl_radio_light_button.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Radio_Light_Button : public Fl_Radio_Light_Button {
+ public:
+ 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);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Radio_Light_Button::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Radio_Light_Button::real_draw() {
+ Fl_Radio_Light_Button::draw();
+}
+
+
+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);
+}
+
+
+void fl_radio_light_button_draw(RADIOLIGHTBUTTON b) {
+ reinterpret_cast<My_Radio_Light_Button*>(b)->real_draw();
+}
+
+
+
+
RADIOLIGHTBUTTON new_fl_radio_light_button(int x, int y, int w, int h, char* label) {
- Fl_Radio_Light_Button *b = new Fl_Radio_Light_Button(x, y, w, h, label);
+ My_Radio_Light_Button *b = new My_Radio_Light_Button(x, y, w, h, label);
return b;
}
void free_fl_radio_light_button(RADIOLIGHTBUTTON b) {
- delete reinterpret_cast<Fl_Radio_Light_Button*>(b);
+ delete reinterpret_cast<My_Radio_Light_Button*>(b);
}
diff --git a/src/c_fl_radio_light_button.h b/src/c_fl_radio_light_button.h
index ee5f2a1..6675d4a 100644
--- a/src/c_fl_radio_light_button.h
+++ b/src/c_fl_radio_light_button.h
@@ -7,6 +7,9 @@
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" 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_radio_round_button.cpp b/src/c_fl_radio_round_button.cpp
index 9e94244..de9e928 100644
--- a/src/c_fl_radio_round_button.cpp
+++ b/src/c_fl_radio_round_button.cpp
@@ -4,13 +4,53 @@
#include "c_fl_radio_round_button.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Radio_Round_Button : public Fl_Radio_Round_Button {
+ public:
+ 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);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Radio_Round_Button::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Radio_Round_Button::real_draw() {
+ Fl_Radio_Round_Button::draw();
+}
+
+
+void radio_round_button_set_draw_hook(RADIOROUNDBUTTON b, void * d) {
+ reinterpret_cast<My_Radio_Round_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_radio_round_button_draw(RADIOROUNDBUTTON b) {
+ reinterpret_cast<My_Radio_Round_Button*>(b)->real_draw();
+}
+
+
+
+
RADIOROUNDBUTTON new_fl_radio_round_button(int x, int y, int w, int h, char* label) {
- Fl_Radio_Round_Button *b = new Fl_Radio_Round_Button(x, y, w, h, label);
+ My_Radio_Round_Button *b = new My_Radio_Round_Button(x, y, w, h, label);
return b;
}
void free_fl_radio_round_button(RADIOROUNDBUTTON b) {
- delete reinterpret_cast<Fl_Radio_Round_Button*>(b);
+ delete reinterpret_cast<My_Radio_Round_Button*>(b);
}
diff --git a/src/c_fl_radio_round_button.h b/src/c_fl_radio_round_button.h
index 34f1189..b4a6645 100644
--- a/src/c_fl_radio_round_button.h
+++ b/src/c_fl_radio_round_button.h
@@ -7,6 +7,9 @@
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" 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 eafefde..b1f557d 100644
--- a/src/c_fl_repeat_button.cpp
+++ b/src/c_fl_repeat_button.cpp
@@ -4,13 +4,53 @@
#include "c_fl_repeat_button.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Repeat_Button : public Fl_Repeat_Button {
+ public:
+ 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);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Repeat_Button::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Repeat_Button::real_draw() {
+ Fl_Repeat_Button::draw();
+}
+
+
+void repeat_button_set_draw_hook(REPEATBUTTON b, void * d) {
+ reinterpret_cast<My_Repeat_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_repeat_button_draw(REPEATBUTTON b) {
+ reinterpret_cast<My_Repeat_Button*>(b)->real_draw();
+}
+
+
+
+
REPEATBUTTON new_fl_repeat_button(int x, int y, int w, int h, char* label) {
- Fl_Repeat_Button *b = new Fl_Repeat_Button(x, y, w, h, label);
+ My_Repeat_Button *b = new My_Repeat_Button(x, y, w, h, label);
return b;
}
void free_fl_repeat_button(REPEATBUTTON b) {
- delete reinterpret_cast<Fl_Repeat_Button*>(b);
+ delete reinterpret_cast<My_Repeat_Button*>(b);
}
diff --git a/src/c_fl_repeat_button.h b/src/c_fl_repeat_button.h
index d899730..85f62c7 100644
--- a/src/c_fl_repeat_button.h
+++ b/src/c_fl_repeat_button.h
@@ -7,6 +7,9 @@
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" 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_return_button.cpp b/src/c_fl_return_button.cpp
index 5f87fb3..77939a7 100644
--- a/src/c_fl_return_button.cpp
+++ b/src/c_fl_return_button.cpp
@@ -4,13 +4,53 @@
#include "c_fl_return_button.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Return_Button : public Fl_Return_Button {
+ public:
+ 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);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Return_Button::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Return_Button::real_draw() {
+ Fl_Return_Button::draw();
+}
+
+
+void return_button_set_draw_hook(RETURNBUTTON b, void * d) {
+ reinterpret_cast<My_Return_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_return_button_draw(RETURNBUTTON b) {
+ reinterpret_cast<My_Return_Button*>(b)->real_draw();
+}
+
+
+
+
RETURNBUTTON new_fl_return_button(int x, int y, int w, int h, char* label) {
- Fl_Return_Button *b = new Fl_Return_Button(x, y, w, h, label);
+ My_Return_Button *b = new My_Return_Button(x, y, w, h, label);
return b;
}
void free_fl_return_button(RETURNBUTTON b) {
- delete reinterpret_cast<Fl_Return_Button*>(b);
+ delete reinterpret_cast<My_Return_Button*>(b);
}
diff --git a/src/c_fl_return_button.h b/src/c_fl_return_button.h
index 558e9dc..7578ff8 100644
--- a/src/c_fl_return_button.h
+++ b/src/c_fl_return_button.h
@@ -7,6 +7,9 @@
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" 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/c_fl_round_button.cpp b/src/c_fl_round_button.cpp
index b33448f..2d6a158 100644
--- a/src/c_fl_round_button.cpp
+++ b/src/c_fl_round_button.cpp
@@ -4,13 +4,53 @@
#include "c_fl_round_button.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Round_Button : public Fl_Round_Button {
+ public:
+ 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);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Round_Button::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Round_Button::real_draw() {
+ Fl_Round_Button::draw();
+}
+
+
+void round_button_set_draw_hook(ROUNDBUTTON b, void * d) {
+ reinterpret_cast<My_Round_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_round_button_draw(ROUNDBUTTON b) {
+ reinterpret_cast<My_Round_Button*>(b)->real_draw();
+}
+
+
+
+
ROUNDBUTTON new_fl_round_button(int x, int y, int w, int h, char* label) {
- Fl_Round_Button *b = new Fl_Round_Button(x, y, w, h, label);
+ My_Round_Button *b = new My_Round_Button(x, y, w, h, label);
return b;
}
void free_fl_round_button(ROUNDBUTTON b) {
- delete reinterpret_cast<Fl_Round_Button*>(b);
+ delete reinterpret_cast<My_Round_Button*>(b);
}
diff --git a/src/c_fl_round_button.h b/src/c_fl_round_button.h
index 36113a4..d725cd9 100644
--- a/src/c_fl_round_button.h
+++ b/src/c_fl_round_button.h
@@ -7,6 +7,9 @@
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" 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 d52e72e..d1dd0c0 100644
--- a/src/c_fl_toggle_button.cpp
+++ b/src/c_fl_toggle_button.cpp
@@ -4,13 +4,53 @@
#include "c_fl_toggle_button.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Toggle_Button : public Fl_Toggle_Button {
+ public:
+ 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);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Toggle_Button::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Toggle_Button::real_draw() {
+ Fl_Toggle_Button::draw();
+}
+
+
+void toggle_button_set_draw_hook(TOGGLEBUTTON b, void * d) {
+ reinterpret_cast<My_Toggle_Button*>(b)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_toggle_button_draw(TOGGLEBUTTON b) {
+ reinterpret_cast<My_Toggle_Button*>(b)->real_draw();
+}
+
+
+
+
TOGGLEBUTTON new_fl_toggle_button(int x, int y, int w, int h, char* label) {
- Fl_Toggle_Button *b = new Fl_Toggle_Button(x, y, w, h, label);
+ My_Toggle_Button *b = new My_Toggle_Button(x, y, w, h, label);
return b;
}
void free_fl_toggle_button(TOGGLEBUTTON b) {
- delete reinterpret_cast<Fl_Toggle_Button*>(b);
+ delete reinterpret_cast<My_Toggle_Button*>(b);
}
diff --git a/src/c_fl_toggle_button.h b/src/c_fl_toggle_button.h
index ed86ed4..d69039b 100644
--- a/src/c_fl_toggle_button.h
+++ b/src/c_fl_toggle_button.h
@@ -7,6 +7,9 @@
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" 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-enter.adb b/src/fltk-widgets-buttons-enter.adb
index bbef830..9a441f1 100644
--- a/src/fltk-widgets-buttons-enter.adb
+++ b/src/fltk-widgets-buttons-enter.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Buttons.Enter is
+ procedure return_button_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, return_button_set_draw_hook, "return_button_set_draw_hook");
+
+ procedure fl_return_button_draw
+ (W : in System.Address);
+ pragma Import (C, fl_return_button_draw, "fl_return_button_draw");
+
function new_fl_return_button
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -21,6 +29,30 @@ package body FLTK.Widgets.Buttons.Enter is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Enter_Button : access Enter_Button'Class :=
+ Enter_Button_Convert.To_Pointer (U);
+ begin
+ Ada_Enter_Button.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Enter_Button) is
+ begin
+ fl_return_button_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Enter_Button) is
begin
@@ -50,6 +82,7 @@ package body FLTK.Widgets.Buttons.Enter is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ return_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
end return;
end Create;
diff --git a/src/fltk-widgets-buttons-enter.ads b/src/fltk-widgets-buttons-enter.ads
index 1db7308..a341698 100644
--- a/src/fltk-widgets-buttons-enter.ads
+++ b/src/fltk-widgets-buttons-enter.ads
@@ -18,6 +18,10 @@ package FLTK.Widgets.Buttons.Enter is
private
+ procedure Draw
+ (This : in out Enter_Button);
+
+
type Enter_Button is new Button with null record;
@@ -25,5 +29,9 @@ private
(This : in out Enter_Button);
+ package Enter_Button_Convert is new System.Address_To_Access_Conversions
+ (Enter_Button'Class);
+
+
end FLTK.Widgets.Buttons.Enter;
diff --git a/src/fltk-widgets-buttons-light-check.adb b/src/fltk-widgets-buttons-light-check.adb
index 7f16c9d..1d72d47 100644
--- a/src/fltk-widgets-buttons-light-check.adb
+++ b/src/fltk-widgets-buttons-light-check.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Buttons.Light.Check is
+ procedure check_button_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, check_button_set_draw_hook, "check_button_set_draw_hook");
+
+ procedure fl_check_button_draw
+ (W : in System.Address);
+ pragma Import (C, fl_check_button_draw, "fl_check_button_draw");
+
function new_fl_check_button
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -21,6 +29,30 @@ package body FLTK.Widgets.Buttons.Light.Check is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Check_Button : access Check_Button'Class :=
+ Check_Button_Convert.To_Pointer (U);
+ begin
+ Ada_Check_Button.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Check_Button) is
+ begin
+ fl_check_button_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Check_Button) is
begin
@@ -50,6 +82,7 @@ package body FLTK.Widgets.Buttons.Light.Check is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ check_button_set_draw_hook (This.Void_Ptr, Draw_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 1ab34f0..f1c0c90 100644
--- a/src/fltk-widgets-buttons-light-check.ads
+++ b/src/fltk-widgets-buttons-light-check.ads
@@ -15,6 +15,10 @@ package FLTK.Widgets.Buttons.Light.Check is
private
+ procedure Draw
+ (This : in out Check_Button);
+
+
type Check_Button is new Light_Button with null record;
@@ -22,5 +26,9 @@ private
(This : in out Check_Button);
+ package Check_Button_Convert is new System.Address_To_Access_Conversions
+ (Check_Button'Class);
+
+
end FLTK.Widgets.Buttons.Light.Check;
diff --git a/src/fltk-widgets-buttons-light-radio.adb b/src/fltk-widgets-buttons-light-radio.adb
index 1a741b9..83783b7 100644
--- a/src/fltk-widgets-buttons-light-radio.adb
+++ b/src/fltk-widgets-buttons-light-radio.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Buttons.Light.Radio is
+ procedure radio_light_button_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, radio_light_button_set_draw_hook, "radio_light_button_set_draw_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 new_fl_radio_light_button
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -21,6 +29,30 @@ package body FLTK.Widgets.Buttons.Light.Radio is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Radio_Light_Button : access Radio_Light_Button'Class :=
+ Radio_Light_Button_Convert.To_Pointer (U);
+ begin
+ Ada_Radio_Light_Button.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Radio_Light_Button) is
+ begin
+ fl_radio_light_button_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Radio_Light_Button) is
begin
@@ -50,6 +82,7 @@ package body FLTK.Widgets.Buttons.Light.Radio is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ radio_light_button_set_draw_hook (This.Void_Ptr, Draw_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 bad0a92..25f5fc0 100644
--- a/src/fltk-widgets-buttons-light-radio.ads
+++ b/src/fltk-widgets-buttons-light-radio.ads
@@ -15,6 +15,10 @@ package FLTK.Widgets.Buttons.Light.Radio is
private
+ procedure Draw
+ (This : in out Radio_Light_Button);
+
+
type Radio_Light_Button is new Light_Button with null record;
@@ -22,5 +26,9 @@ private
(This : in out Radio_Light_Button);
+ package Radio_Light_Button_Convert is new System.Address_To_Access_Conversions
+ (Radio_Light_Button'Class);
+
+
end FLTK.Widgets.Buttons.Light.Radio;
diff --git a/src/fltk-widgets-buttons-light-round-radio.adb b/src/fltk-widgets-buttons-light-round-radio.adb
index c61430f..75e3fcf 100644
--- a/src/fltk-widgets-buttons-light-round-radio.adb
+++ b/src/fltk-widgets-buttons-light-round-radio.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Buttons.Light.Round.Radio is
+ procedure radio_round_button_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, radio_round_button_set_draw_hook, "radio_round_button_set_draw_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 new_fl_radio_round_button
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -21,6 +29,30 @@ package body FLTK.Widgets.Buttons.Light.Round.Radio is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Radio_Round_Button : access Radio_Round_Button'Class :=
+ Radio_Round_Button_Convert.To_Pointer (U);
+ begin
+ Ada_Radio_Round_Button.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Radio_Round_Button) is
+ begin
+ fl_radio_round_button_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Radio_Round_Button) is
begin
@@ -50,6 +82,7 @@ package body FLTK.Widgets.Buttons.Light.Round.Radio is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ radio_round_button_set_draw_hook (This.Void_Ptr, Draw_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 ad1eec7..c71638f 100644
--- a/src/fltk-widgets-buttons-light-round-radio.ads
+++ b/src/fltk-widgets-buttons-light-round-radio.ads
@@ -15,6 +15,10 @@ package FLTK.Widgets.Buttons.Light.Round.Radio is
private
+ procedure Draw
+ (This : in out Radio_Round_Button);
+
+
type Radio_Round_Button is new Round_Button with null record;
@@ -22,5 +26,9 @@ private
(This : in out Radio_Round_Button);
+ package Radio_Round_Button_Convert is new System.Address_To_Access_Conversions
+ (Radio_Round_Button'Class);
+
+
end FLTK.Widgets.Buttons.Light.Round.Radio;
diff --git a/src/fltk-widgets-buttons-light-round.adb b/src/fltk-widgets-buttons-light-round.adb
index 8be6a4e..941d416 100644
--- a/src/fltk-widgets-buttons-light-round.adb
+++ b/src/fltk-widgets-buttons-light-round.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Buttons.Light.Round is
+ procedure round_button_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, round_button_set_draw_hook, "round_button_set_draw_hook");
+
+ procedure fl_round_button_draw
+ (W : in System.Address);
+ pragma Import (C, fl_round_button_draw, "fl_round_button_draw");
+
function new_fl_round_button
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -21,6 +29,30 @@ package body FLTK.Widgets.Buttons.Light.Round is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Round_Button : access Round_Button'Class :=
+ Round_Button_Convert.To_Pointer (U);
+ begin
+ Ada_Round_Button.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Round_Button) is
+ begin
+ fl_round_button_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Round_Button) is
begin
@@ -50,6 +82,7 @@ package body FLTK.Widgets.Buttons.Light.Round is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ round_button_set_draw_hook (This.Void_Ptr, Draw_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 7cb99b8..9693915 100644
--- a/src/fltk-widgets-buttons-light-round.ads
+++ b/src/fltk-widgets-buttons-light-round.ads
@@ -15,6 +15,10 @@ package FLTK.Widgets.Buttons.Light.Round is
private
+ procedure Draw
+ (This : in out Round_Button);
+
+
type Round_Button is new Light_Button with null record;
@@ -22,5 +26,9 @@ private
(This : in out Round_Button);
+ package Round_Button_Convert is new System.Address_To_Access_Conversions
+ (Round_Button'Class);
+
+
end FLTK.Widgets.Buttons.Light.Round;
diff --git a/src/fltk-widgets-buttons-light.adb b/src/fltk-widgets-buttons-light.adb
index cefc9ef..88fa147 100644
--- a/src/fltk-widgets-buttons-light.adb
+++ b/src/fltk-widgets-buttons-light.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Buttons.Light is
+ procedure light_button_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, light_button_set_draw_hook, "light_button_set_draw_hook");
+
+ procedure fl_light_button_draw
+ (W : in System.Address);
+ pragma Import (C, fl_light_button_draw, "fl_light_button_draw");
+
function new_fl_light_button
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -21,6 +29,30 @@ package body FLTK.Widgets.Buttons.Light is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Light_Button : access Light_Button'Class :=
+ Light_Button_Convert.To_Pointer (U);
+ begin
+ Ada_Light_Button.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Light_Button) is
+ begin
+ fl_light_button_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Light_Button) is
begin
@@ -50,6 +82,7 @@ package body FLTK.Widgets.Buttons.Light is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ light_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
end return;
end Create;
diff --git a/src/fltk-widgets-buttons-light.ads b/src/fltk-widgets-buttons-light.ads
index 6fe7a76..5454b76 100644
--- a/src/fltk-widgets-buttons-light.ads
+++ b/src/fltk-widgets-buttons-light.ads
@@ -15,6 +15,10 @@ package FLTK.Widgets.Buttons.Light is
private
+ procedure Draw
+ (This : in out Light_Button);
+
+
type Light_Button is new Button with null record;
@@ -22,5 +26,9 @@ private
(This : in out Light_Button);
+ package Light_Button_Convert is new System.Address_To_Access_Conversions
+ (Light_Button'Class);
+
+
end FLTK.Widgets.Buttons.Light;
diff --git a/src/fltk-widgets-buttons-radio.adb b/src/fltk-widgets-buttons-radio.adb
index d3fd405..8f0b6eb 100644
--- a/src/fltk-widgets-buttons-radio.adb
+++ b/src/fltk-widgets-buttons-radio.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Buttons.Radio is
+ procedure radio_button_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, radio_button_set_draw_hook, "radio_button_set_draw_hook");
+
+ procedure fl_radio_button_draw
+ (W : in System.Address);
+ pragma Import (C, fl_radio_button_draw, "fl_radio_button_draw");
+
function new_fl_radio_button
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -21,6 +29,30 @@ package body FLTK.Widgets.Buttons.Radio is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Radio_Button : access Radio_Button'Class :=
+ Radio_Button_Convert.To_Pointer (U);
+ begin
+ Ada_Radio_Button.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Radio_Button) is
+ begin
+ fl_radio_button_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Radio_Button) is
begin
@@ -50,6 +82,7 @@ package body FLTK.Widgets.Buttons.Radio is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ radio_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
end return;
end Create;
diff --git a/src/fltk-widgets-buttons-radio.ads b/src/fltk-widgets-buttons-radio.ads
index cf14eeb..eb0dd4a 100644
--- a/src/fltk-widgets-buttons-radio.ads
+++ b/src/fltk-widgets-buttons-radio.ads
@@ -15,6 +15,10 @@ package FLTK.Widgets.Buttons.Radio is
private
+ procedure Draw
+ (This : in out Radio_Button);
+
+
type Radio_Button is new Button with null record;
@@ -22,5 +26,9 @@ private
(This : in out Radio_Button);
+ package Radio_Button_Convert is new System.Address_To_Access_Conversions
+ (Radio_Button'Class);
+
+
end FLTK.Widgets.Buttons.Radio;
diff --git a/src/fltk-widgets-buttons-repeat.adb b/src/fltk-widgets-buttons-repeat.adb
index 8e81a8e..dd7d0fd 100644
--- a/src/fltk-widgets-buttons-repeat.adb
+++ b/src/fltk-widgets-buttons-repeat.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Buttons.Repeat is
+ procedure repeat_button_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, repeat_button_set_draw_hook, "repeat_button_set_draw_hook");
+
+ procedure fl_repeat_button_draw
+ (W : in System.Address);
+ pragma Import (C, fl_repeat_button_draw, "fl_repeat_button_draw");
+
function new_fl_repeat_button
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -21,6 +29,30 @@ package body FLTK.Widgets.Buttons.Repeat is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Repeat_Button : access Repeat_Button'Class :=
+ Repeat_Button_Convert.To_Pointer (U);
+ begin
+ Ada_Repeat_Button.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Repeat_Button) is
+ begin
+ fl_repeat_button_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Repeat_Button) is
begin
@@ -50,6 +82,7 @@ package body FLTK.Widgets.Buttons.Repeat is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ repeat_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
end return;
end Create;
diff --git a/src/fltk-widgets-buttons-repeat.ads b/src/fltk-widgets-buttons-repeat.ads
index 5c27b40..f0cd8c3 100644
--- a/src/fltk-widgets-buttons-repeat.ads
+++ b/src/fltk-widgets-buttons-repeat.ads
@@ -15,6 +15,10 @@ package FLTK.Widgets.Buttons.Repeat is
private
+ procedure Draw
+ (This : in out Repeat_Button);
+
+
type Repeat_Button is new Button with null record;
@@ -22,5 +26,9 @@ private
(This : in out Repeat_Button);
+ package Repeat_Button_Convert is new System.Address_To_Access_Conversions
+ (Repeat_Button'Class);
+
+
end FLTK.Widgets.Buttons.Repeat;
diff --git a/src/fltk-widgets-buttons-toggle.adb b/src/fltk-widgets-buttons-toggle.adb
index 9b8ce83..287a5d4 100644
--- a/src/fltk-widgets-buttons-toggle.adb
+++ b/src/fltk-widgets-buttons-toggle.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Buttons.Toggle is
+ procedure toggle_button_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, toggle_button_set_draw_hook, "toggle_button_set_draw_hook");
+
+ procedure fl_toggle_button_draw
+ (W : in System.Address);
+ pragma Import (C, fl_toggle_button_draw, "fl_toggle_button_draw");
+
function new_fl_toggle_button
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -21,6 +29,30 @@ package body FLTK.Widgets.Buttons.Toggle is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Toggle_Button : access Toggle_Button'Class :=
+ Toggle_Button_Convert.To_Pointer (U);
+ begin
+ Ada_Toggle_Button.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Toggle_Button) is
+ begin
+ fl_toggle_button_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Toggle_Button) is
begin
@@ -50,6 +82,7 @@ package body FLTK.Widgets.Buttons.Toggle is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ toggle_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
end return;
end Create;
diff --git a/src/fltk-widgets-buttons-toggle.ads b/src/fltk-widgets-buttons-toggle.ads
index a8f4181..e486c06 100644
--- a/src/fltk-widgets-buttons-toggle.ads
+++ b/src/fltk-widgets-buttons-toggle.ads
@@ -15,6 +15,10 @@ package FLTK.Widgets.Buttons.Toggle is
private
+ procedure Draw
+ (This : in out Toggle_Button);
+
+
type Toggle_Button is new Button with null record;
@@ -22,5 +26,9 @@ private
(This : in out Toggle_Button);
+ package Toggle_Button_Convert is new System.Address_To_Access_Conversions
+ (Toggle_Button'Class);
+
+
end FLTK.Widgets.Buttons.Toggle;
diff --git a/src/fltk-widgets-buttons.adb b/src/fltk-widgets-buttons.adb
index bc79b9c..b1f9d2a 100644
--- a/src/fltk-widgets-buttons.adb
+++ b/src/fltk-widgets-buttons.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Buttons is
+ procedure button_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, button_set_draw_hook, "button_set_draw_hook");
+
+ procedure fl_button_draw
+ (W : in System.Address);
+ pragma Import (C, fl_button_draw, "fl_button_draw");
+
function new_fl_button
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -35,6 +43,30 @@ package body FLTK.Widgets.Buttons is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Button : access Button'Class :=
+ Button_Convert.To_Pointer (U);
+ begin
+ Ada_Button.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Button) is
+ begin
+ fl_button_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Button) is
begin
@@ -64,6 +96,7 @@ package body FLTK.Widgets.Buttons is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
end return;
end Create;
diff --git a/src/fltk-widgets-buttons.ads b/src/fltk-widgets-buttons.ads
index 403ad1a..f207e09 100644
--- a/src/fltk-widgets-buttons.ads
+++ b/src/fltk-widgets-buttons.ads
@@ -32,6 +32,10 @@ package FLTK.Widgets.Buttons is
private
+ procedure Draw
+ (This : in out Button);
+
+
type Button is new Widget with null record;
@@ -39,5 +43,8 @@ private
(This : in out Button);
+ package Button_Convert is new System.Address_To_Access_Conversions (Button'Class);
+
+
end FLTK.Widgets.Buttons;