summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/c_fl_menu_bar.cpp44
-rw-r--r--src/c_fl_menu_bar.h3
-rw-r--r--src/c_fl_menu_button.cpp48
-rw-r--r--src/c_fl_menu_button.h3
-rw-r--r--src/c_fl_text_display.cpp80
-rw-r--r--src/c_fl_text_display.h3
-rw-r--r--src/c_fl_text_editor.cpp56
-rw-r--r--src/c_fl_text_editor.h4
-rw-r--r--src/fltk-widgets-groups-text_displays-text_editors.adb33
-rw-r--r--src/fltk-widgets-groups-text_displays-text_editors.ads8
-rw-r--r--src/fltk-widgets-groups-text_displays.adb33
-rw-r--r--src/fltk-widgets-groups-text_displays.ads8
-rw-r--r--src/fltk-widgets-menus-menu_bars.adb33
-rw-r--r--src/fltk-widgets-menus-menu_bars.ads8
-rw-r--r--src/fltk-widgets-menus-menu_buttons.adb33
-rw-r--r--src/fltk-widgets-menus-menu_buttons.ads8
16 files changed, 373 insertions, 32 deletions
diff --git a/src/c_fl_menu_bar.cpp b/src/c_fl_menu_bar.cpp
index 3349008..3246a97 100644
--- a/src/c_fl_menu_bar.cpp
+++ b/src/c_fl_menu_bar.cpp
@@ -4,13 +4,53 @@
#include "c_fl_menu_bar.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Menu_Bar : public Fl_Menu_Bar {
+ public:
+ 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);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Menu_Bar::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Menu_Bar::real_draw() {
+ Fl_Menu_Bar::draw();
+}
+
+
+void menu_bar_set_draw_hook(MENUBAR m, void * d) {
+ reinterpret_cast<My_Menu_Bar*>(m)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_menu_bar_draw(MENUBAR m) {
+ reinterpret_cast<My_Menu_Bar*>(m)->real_draw();
+}
+
+
+
+
MENUBAR new_fl_menu_bar(int x, int y, int w, int h, char* label) {
- Fl_Menu_Bar *m = new Fl_Menu_Bar(x, y, w, h, label);
+ My_Menu_Bar *m = new My_Menu_Bar(x, y, w, h, label);
return m;
}
void free_fl_menu_bar(MENUBAR m) {
- delete reinterpret_cast<Fl_Menu_Bar*>(m);
+ delete reinterpret_cast<My_Menu_Bar*>(m);
}
diff --git a/src/c_fl_menu_bar.h b/src/c_fl_menu_bar.h
index a09d22b..872ce3d 100644
--- a/src/c_fl_menu_bar.h
+++ b/src/c_fl_menu_bar.h
@@ -7,6 +7,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" 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 864dd3e..b49d1aa 100644
--- a/src/c_fl_menu_button.cpp
+++ b/src/c_fl_menu_button.cpp
@@ -4,18 +4,60 @@
#include "c_fl_menu_button.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Menu_Button : public Fl_Menu_Button {
+ public:
+ 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);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Menu_Button::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Menu_Button::real_draw() {
+ Fl_Menu_Button::draw();
+}
+
+
+void menu_button_set_draw_hook(MENUBUTTON m, void * d) {
+ reinterpret_cast<My_Menu_Button*>(m)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_menu_button_draw(MENUBUTTON m) {
+ reinterpret_cast<My_Menu_Button*>(m)->real_draw();
+}
+
+
+
+
MENUBUTTON new_fl_menu_button(int x, int y, int w, int h, char* label) {
- Fl_Menu_Button *m = new Fl_Menu_Button(x, y, w, h, label);
+ My_Menu_Button *m = new My_Menu_Button(x, y, w, h, label);
return m;
}
void free_fl_menu_button(MENUBUTTON m) {
- delete reinterpret_cast<Fl_Menu_Button*>(m);
+ delete reinterpret_cast<My_Menu_Button*>(m);
}
+
+
void fl_menu_button_type(MENUBUTTON m, unsigned int t) {
- reinterpret_cast<Fl_Menu_Button*>(m)->type(t);
+ reinterpret_cast<My_Menu_Button*>(m)->type(t);
}
diff --git a/src/c_fl_menu_button.h b/src/c_fl_menu_button.h
index 8c089b6..be27476 100644
--- a/src/c_fl_menu_button.h
+++ b/src/c_fl_menu_button.h
@@ -7,6 +7,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" 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_text_display.cpp b/src/c_fl_text_display.cpp
index b9e59c6..694b8c9 100644
--- a/src/c_fl_text_display.cpp
+++ b/src/c_fl_text_display.cpp
@@ -6,100 +6,142 @@
#include "c_fl_text_buffer.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Text_Display : public Fl_Text_Display {
+ public:
+ using Fl_Text_Display::Fl_Text_Display;
+ friend void text_display_set_draw_hook(TEXTDISPLAY td, void * d);
+ friend void fl_text_display_draw(TEXTDISPLAY td);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Text_Display::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Text_Display::real_draw() {
+ Fl_Text_Display::draw();
+}
+
+
+void text_display_set_draw_hook(TEXTDISPLAY td, void * d) {
+ reinterpret_cast<My_Text_Display*>(td)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_text_display_draw(TEXTDISPLAY td) {
+ reinterpret_cast<My_Text_Display*>(td)->real_draw();
+}
+
+
+
+
TEXTDISPLAY new_fl_text_display(int x, int y, int w, int h, char* label) {
- Fl_Text_Display *td = new Fl_Text_Display(x, y, w, h, label);
+ My_Text_Display *td = new My_Text_Display(x, y, w, h, label);
return td;
}
void free_fl_text_display(TEXTDISPLAY td) {
- delete reinterpret_cast<Fl_Text_Display*>(td);
+ delete reinterpret_cast<My_Text_Display*>(td);
}
+
+
// this actually never gets called, since an access to the text_buffer
// object is stored on the Ada side of things
TEXTBUFFER fl_text_display_get_buffer(TEXTDISPLAY td) {
- return reinterpret_cast<Fl_Text_Display*>(td)->buffer();
+ return reinterpret_cast<My_Text_Display*>(td)->buffer();
}
void fl_text_display_set_buffer(TEXTDISPLAY td, TEXTBUFFER tb) {
- reinterpret_cast<Fl_Text_Display*>(td)->buffer(reinterpret_cast<Fl_Text_Buffer*>(tb));
+ reinterpret_cast<My_Text_Display*>(td)->buffer(reinterpret_cast<Fl_Text_Buffer*>(tb));
}
int fl_text_display_get_text_color(TEXTDISPLAY td) {
- return reinterpret_cast<Fl_Text_Display*>(td)->textcolor();
+ return reinterpret_cast<My_Text_Display*>(td)->textcolor();
}
void fl_text_display_set_text_color(TEXTDISPLAY td, int c) {
- reinterpret_cast<Fl_Text_Display*>(td)->textcolor(static_cast<Fl_Color>(c));
+ reinterpret_cast<My_Text_Display*>(td)->textcolor(static_cast<Fl_Color>(c));
}
int fl_text_display_get_text_font(TEXTDISPLAY td) {
- return reinterpret_cast<Fl_Text_Display*>(td)->textfont();
+ return reinterpret_cast<My_Text_Display*>(td)->textfont();
}
void fl_text_display_set_text_font(TEXTDISPLAY td, int f) {
- reinterpret_cast<Fl_Text_Display*>(td)->textfont(static_cast<Fl_Font>(f));
+ reinterpret_cast<My_Text_Display*>(td)->textfont(static_cast<Fl_Font>(f));
}
int fl_text_display_get_text_size(TEXTDISPLAY td) {
- return reinterpret_cast<Fl_Text_Display*>(td)->textsize();
+ return reinterpret_cast<My_Text_Display*>(td)->textsize();
}
void fl_text_display_set_text_size(TEXTDISPLAY td, int s) {
- reinterpret_cast<Fl_Text_Display*>(td)->textsize(static_cast<Fl_Fontsize>(s));
+ reinterpret_cast<My_Text_Display*>(td)->textsize(static_cast<Fl_Fontsize>(s));
}
int fl_text_display_get_insert_pos(TEXTDISPLAY td) {
- return reinterpret_cast<Fl_Text_Display*>(td)->insert_position();
+ return reinterpret_cast<My_Text_Display*>(td)->insert_position();
}
void fl_text_display_set_insert_pos(TEXTDISPLAY td, int p) {
- reinterpret_cast<Fl_Text_Display*>(td)->insert_position(p);
+ reinterpret_cast<My_Text_Display*>(td)->insert_position(p);
}
void fl_text_display_show_insert_pos(TEXTDISPLAY td) {
- reinterpret_cast<Fl_Text_Display*>(td)->show_insert_position();
+ reinterpret_cast<My_Text_Display*>(td)->show_insert_position();
}
void fl_text_display_next_word(TEXTDISPLAY td) {
- reinterpret_cast<Fl_Text_Display*>(td)->next_word();
+ reinterpret_cast<My_Text_Display*>(td)->next_word();
}
void fl_text_display_previous_word(TEXTDISPLAY td) {
- reinterpret_cast<Fl_Text_Display*>(td)->previous_word();
+ reinterpret_cast<My_Text_Display*>(td)->previous_word();
}
void fl_text_display_wrap_mode(TEXTDISPLAY td, int w, int m) {
- reinterpret_cast<Fl_Text_Display*>(td)->wrap_mode(w, m);
+ reinterpret_cast<My_Text_Display*>(td)->wrap_mode(w, m);
}
int fl_text_display_skip_lines(TEXTDISPLAY td, int s, int l, int p) {
- return reinterpret_cast<Fl_Text_Display*>(td)->skip_lines(s, l, p);
+ return reinterpret_cast<My_Text_Display*>(td)->skip_lines(s, l, p);
}
int fl_text_display_rewind_lines(TEXTDISPLAY td, int s, int l) {
- return reinterpret_cast<Fl_Text_Display*>(td)->rewind_lines(s, l);
+ return reinterpret_cast<My_Text_Display*>(td)->rewind_lines(s, l);
}
void fl_text_display_linenumber_width(TEXTDISPLAY td, int w) {
- reinterpret_cast<Fl_Text_Display*>(td)->linenumber_width(w);
+ reinterpret_cast<My_Text_Display*>(td)->linenumber_width(w);
}
diff --git a/src/c_fl_text_display.h b/src/c_fl_text_display.h
index dbd683f..adacfd1 100644
--- a/src/c_fl_text_display.h
+++ b/src/c_fl_text_display.h
@@ -9,6 +9,9 @@
typedef void* TEXTDISPLAY;
+extern "C" void text_display_set_draw_hook(TEXTDISPLAY td, void * d);
+extern "C" void fl_text_display_draw(TEXTDISPLAY td);
+
extern "C" TEXTDISPLAY new_fl_text_display(int x, int y, int w, int h, char* label);
extern "C" void free_fl_text_display(TEXTDISPLAY td);
diff --git a/src/c_fl_text_editor.cpp b/src/c_fl_text_editor.cpp
index c28f6fa..a99774f 100644
--- a/src/c_fl_text_editor.cpp
+++ b/src/c_fl_text_editor.cpp
@@ -4,45 +4,85 @@
#include "c_fl_text_editor.h"
+typedef void (hook)(void*);
+typedef hook* hook_p;
+
+
+
+
+class My_Text_Editor : public Fl_Text_Editor {
+ public:
+ using Fl_Text_Editor::Fl_Text_Editor;
+ friend void text_editor_set_draw_hook(TEXTEDITOR te, void * d);
+ friend void fl_text_editor_draw(TEXTEDITOR te);
+ protected:
+ void draw();
+ void real_draw();
+ hook_p draw_hook;
+};
+
+
+void My_Text_Editor::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+
+void My_Text_Editor::real_draw() {
+ Fl_Text_Editor::draw();
+}
+
+
+void text_editor_set_draw_hook(TEXTEDITOR te, void * d) {
+ reinterpret_cast<My_Text_Editor*>(te)->draw_hook = reinterpret_cast<hook_p>(d);
+}
+
+
+void fl_text_editor_draw(TEXTEDITOR te) {
+ reinterpret_cast<My_Text_Editor*>(te)->real_draw();
+}
+
+
+
+
TEXTEDITOR new_fl_text_editor(int x, int y, int w, int h, char* label) {
- Fl_Text_Editor *te = new Fl_Text_Editor(x, y, w, h, label);
+ My_Text_Editor *te = new My_Text_Editor(x, y, w, h, label);
return te;
}
void free_fl_text_editor(TEXTEDITOR te) {
- delete reinterpret_cast<Fl_Text_Editor*>(te);
+ delete reinterpret_cast<My_Text_Editor*>(te);
}
void fl_text_editor_undo(TEXTEDITOR te) {
- Fl_Text_Editor::kf_undo(0, reinterpret_cast<Fl_Text_Editor*>(te));
+ My_Text_Editor::kf_undo(0, reinterpret_cast<My_Text_Editor*>(te));
}
void fl_text_editor_cut(TEXTEDITOR te) {
- Fl_Text_Editor::kf_cut(0, reinterpret_cast<Fl_Text_Editor*>(te));
+ My_Text_Editor::kf_cut(0, reinterpret_cast<My_Text_Editor*>(te));
}
void fl_text_editor_copy(TEXTEDITOR te) {
- Fl_Text_Editor::kf_copy(0, reinterpret_cast<Fl_Text_Editor*>(te));
+ My_Text_Editor::kf_copy(0, reinterpret_cast<My_Text_Editor*>(te));
}
void fl_text_editor_paste(TEXTEDITOR te) {
- Fl_Text_Editor::kf_paste(0, reinterpret_cast<Fl_Text_Editor*>(te));
+ My_Text_Editor::kf_paste(0, reinterpret_cast<My_Text_Editor*>(te));
}
void fl_text_editor_delete(TEXTEDITOR te) {
- Fl_Text_Editor::kf_delete(0, reinterpret_cast<Fl_Text_Editor*>(te));
+ My_Text_Editor::kf_delete(0, reinterpret_cast<My_Text_Editor*>(te));
}
void fl_text_editor_remove_key_binding(TEXTEDITOR te, unsigned int k, unsigned long m) {
- reinterpret_cast<Fl_Text_Editor*>(te)->remove_key_binding(k, m);
+ reinterpret_cast<My_Text_Editor*>(te)->remove_key_binding(k, m);
}
diff --git a/src/c_fl_text_editor.h b/src/c_fl_text_editor.h
index ebaab0d..87a09ce 100644
--- a/src/c_fl_text_editor.h
+++ b/src/c_fl_text_editor.h
@@ -7,6 +7,10 @@
typedef void* TEXTEDITOR;
+extern "C" void text_editor_set_draw_hook(TEXTEDITOR te, void * d);
+extern "C" void fl_text_editor_draw(TEXTEDITOR te);
+
+
extern "C" TEXTEDITOR new_fl_text_editor(int x, int y, int w, int h, char* label);
extern "C" void free_fl_text_editor(TEXTEDITOR te);
diff --git a/src/fltk-widgets-groups-text_displays-text_editors.adb b/src/fltk-widgets-groups-text_displays-text_editors.adb
index 0172128..6555926 100644
--- a/src/fltk-widgets-groups-text_displays-text_editors.adb
+++ b/src/fltk-widgets-groups-text_displays-text_editors.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ procedure text_editor_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, text_editor_set_draw_hook, "text_editor_set_draw_hook");
+
+ procedure fl_text_editor_draw
+ (W : in System.Address);
+ pragma Import (C, fl_text_editor_draw, "fl_text_editor_draw");
+
function new_fl_text_editor
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -47,6 +55,30 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Text_Editor : access Text_Editor'Class :=
+ Text_Editor_Convert.To_Pointer (U);
+ begin
+ Ada_Text_Editor.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Text_Editor) is
+ begin
+ fl_text_editor_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Text_Editor) is
begin
@@ -77,6 +109,7 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ text_editor_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
end return;
end Create;
diff --git a/src/fltk-widgets-groups-text_displays-text_editors.ads b/src/fltk-widgets-groups-text_displays-text_editors.ads
index d4c9b85..0f84a7e 100644
--- a/src/fltk-widgets-groups-text_displays-text_editors.ads
+++ b/src/fltk-widgets-groups-text_displays-text_editors.ads
@@ -43,6 +43,10 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is
private
+ procedure Draw
+ (This : in out Text_Editor);
+
+
type Text_Editor is new Text_Display with null record;
@@ -50,5 +54,9 @@ private
(This : in out Text_Editor);
+ package Text_Editor_Convert is new System.Address_To_Access_Conversions
+ (Text_Editor'Class);
+
+
end FLTK.Widgets.Groups.Text_Displays.Text_Editors;
diff --git a/src/fltk-widgets-groups-text_displays.adb b/src/fltk-widgets-groups-text_displays.adb
index 1aa5962..155ff5c 100644
--- a/src/fltk-widgets-groups-text_displays.adb
+++ b/src/fltk-widgets-groups-text_displays.adb
@@ -9,6 +9,14 @@ use type System.Address;
package body FLTK.Widgets.Groups.Text_Displays is
+ procedure text_display_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, text_display_set_draw_hook, "text_display_set_draw_hook");
+
+ procedure fl_text_display_draw
+ (W : in System.Address);
+ pragma Import (C, fl_text_display_draw, "fl_text_display_draw");
+
function new_fl_text_display
(X, Y, W, H : in Interfaces.C.int;
Label : in Interfaces.C.char_array)
@@ -105,6 +113,30 @@ package body FLTK.Widgets.Groups.Text_Displays is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Text_Display : access Text_Display'Class :=
+ Text_Display_Convert.To_Pointer (U);
+ begin
+ Ada_Text_Display.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Text_Display) is
+ begin
+ fl_text_display_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Text_Display) is
begin
@@ -135,6 +167,7 @@ package body FLTK.Widgets.Groups.Text_Displays is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ text_display_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
end return;
end Create;
diff --git a/src/fltk-widgets-groups-text_displays.ads b/src/fltk-widgets-groups-text_displays.ads
index 0e136ff..15a3f27 100644
--- a/src/fltk-widgets-groups-text_displays.ads
+++ b/src/fltk-widgets-groups-text_displays.ads
@@ -110,6 +110,10 @@ package FLTK.Widgets.Groups.Text_Displays is
private
+ procedure Draw
+ (This : in out Text_Display);
+
+
type Text_Display is new Group with
record
Buffer : access FLTK.Text_Buffers.Text_Buffer;
@@ -120,5 +124,9 @@ private
(This : in out Text_Display);
+ package Text_Display_Convert is new System.Address_To_Access_Conversions
+ (Text_Display'Class);
+
+
end FLTK.Widgets.Groups.Text_Displays;
diff --git a/src/fltk-widgets-menus-menu_bars.adb b/src/fltk-widgets-menus-menu_bars.adb
index 19d44e0..b367c86 100644
--- a/src/fltk-widgets-menus-menu_bars.adb
+++ b/src/fltk-widgets-menus-menu_bars.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Menus.Menu_Bars is
+ procedure menu_bar_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, menu_bar_set_draw_hook, "menu_bar_set_draw_hook");
+
+ procedure fl_menu_bar_draw
+ (W : in System.Address);
+ pragma Import (C, fl_menu_bar_draw, "fl_menu_bar_draw");
+
function new_fl_menu_bar
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -21,6 +29,30 @@ package body FLTK.Widgets.Menus.Menu_Bars is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Menu_Bar : access Menu_Bar'Class :=
+ Menu_Bar_Convert.To_Pointer (U);
+ begin
+ Ada_Menu_Bar.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Menu_Bar) is
+ begin
+ fl_menu_bar_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Menu_Bar) is
begin
@@ -50,6 +82,7 @@ package body FLTK.Widgets.Menus.Menu_Bars is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ menu_bar_set_draw_hook (This.Void_Ptr, Draw_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 0f975b3..6175306 100644
--- a/src/fltk-widgets-menus-menu_bars.ads
+++ b/src/fltk-widgets-menus-menu_bars.ads
@@ -15,6 +15,10 @@ package FLTK.Widgets.Menus.Menu_Bars is
private
+ procedure Draw
+ (This : in out Menu_Bar);
+
+
type Menu_Bar is new Menu with null record;
@@ -22,5 +26,9 @@ private
(This : in out Menu_Bar);
+ package Menu_Bar_Convert is new System.Address_To_Access_Conversions
+ (Menu_Bar'Class);
+
+
end FLTK.Widgets.Menus.Menu_Bars;
diff --git a/src/fltk-widgets-menus-menu_buttons.adb b/src/fltk-widgets-menus-menu_buttons.adb
index 8347099..3054f63 100644
--- a/src/fltk-widgets-menus-menu_buttons.adb
+++ b/src/fltk-widgets-menus-menu_buttons.adb
@@ -8,6 +8,14 @@ use type System.Address;
package body FLTK.Widgets.Menus.Menu_Buttons is
+ procedure menu_button_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, menu_button_set_draw_hook, "menu_button_set_draw_hook");
+
+ procedure fl_menu_button_draw
+ (W : in System.Address);
+ pragma Import (C, fl_menu_button_draw, "fl_menu_button_draw");
+
function new_fl_menu_button
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -26,6 +34,30 @@ package body FLTK.Widgets.Menus.Menu_Buttons is
+ procedure Draw_Hook (U : in System.Address);
+ pragma Convention (C, Draw_Hook);
+
+ procedure Draw_Hook
+ (U : in System.Address)
+ is
+ Ada_Menu_Button : access Menu_Button'Class :=
+ Menu_Button_Convert.To_Pointer (U);
+ begin
+ Ada_Menu_Button.Draw;
+ end Draw_Hook;
+
+
+
+
+ procedure Draw
+ (This : in out Menu_Button) is
+ begin
+ fl_menu_button_draw (This.Void_Ptr);
+ end Draw;
+
+
+
+
procedure Finalize
(This : in out Menu_Button) is
begin
@@ -55,6 +87,7 @@ package body FLTK.Widgets.Menus.Menu_Buttons is
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
+ menu_button_set_draw_hook (This.Void_Ptr, Draw_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 5527abc..dff316d 100644
--- a/src/fltk-widgets-menus-menu_buttons.ads
+++ b/src/fltk-widgets-menus-menu_buttons.ads
@@ -24,6 +24,10 @@ package FLTK.Widgets.Menus.Menu_Buttons is
private
+ procedure Draw
+ (This : in out Menu_Button);
+
+
type Menu_Button is new Menu with null record;
@@ -31,5 +35,9 @@ private
(This : in out Menu_Button);
+ package Menu_Button_Convert is new System.Address_To_Access_Conversions
+ (Menu_Button'Class);
+
+
end FLTK.Widgets.Menus.Menu_Buttons;