summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--c_fl_menu_button.cpp21
-rw-r--r--c_fl_menu_button.h18
-rw-r--r--fltk-widgets-menus-menu_buttons.adb73
-rw-r--r--fltk-widgets-menus-menu_buttons.ads35
4 files changed, 147 insertions, 0 deletions
diff --git a/c_fl_menu_button.cpp b/c_fl_menu_button.cpp
new file mode 100644
index 0000000..864dd3e
--- /dev/null
+++ b/c_fl_menu_button.cpp
@@ -0,0 +1,21 @@
+
+
+#include <FL/Fl_Menu_Button.H>
+#include "c_fl_menu_button.h"
+
+
+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);
+ return m;
+}
+
+
+void free_fl_menu_button(MENUBUTTON m) {
+ delete reinterpret_cast<Fl_Menu_Button*>(m);
+}
+
+
+void fl_menu_button_type(MENUBUTTON m, unsigned int t) {
+ reinterpret_cast<Fl_Menu_Button*>(m)->type(t);
+}
+
diff --git a/c_fl_menu_button.h b/c_fl_menu_button.h
new file mode 100644
index 0000000..8c089b6
--- /dev/null
+++ b/c_fl_menu_button.h
@@ -0,0 +1,18 @@
+
+
+#ifndef FL_MENU_BUTTON_GUARD
+#define FL_MENU_BUTTON_GUARD
+
+
+typedef void* MENUBUTTON;
+
+
+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);
+
+
+extern "C" void fl_menu_button_type(MENUBUTTON m, unsigned int t);
+
+
+#endif
+
diff --git a/fltk-widgets-menus-menu_buttons.adb b/fltk-widgets-menus-menu_buttons.adb
new file mode 100644
index 0000000..8347099
--- /dev/null
+++ b/fltk-widgets-menus-menu_buttons.adb
@@ -0,0 +1,73 @@
+
+
+with Interfaces.C;
+with System;
+use type System.Address;
+
+
+package body FLTK.Widgets.Menus.Menu_Buttons is
+
+
+ function new_fl_menu_button
+ (X, Y, W, H : in Interfaces.C.int;
+ Text : in Interfaces.C.char_array)
+ return System.Address;
+ pragma Import (C, new_fl_menu_button, "new_fl_menu_button");
+
+ procedure free_fl_menu_button
+ (M : in System.Address);
+ pragma Import (C, free_fl_menu_button, "free_fl_menu_button");
+
+ procedure fl_menu_button_type
+ (M : in System.Address;
+ T : in Interfaces.C.unsigned);
+ pragma Import (C, fl_menu_button_type, "fl_menu_button_type");
+
+
+
+
+ procedure Finalize
+ (This : in out Menu_Button) is
+ begin
+ Finalize (Menu (This));
+ if This.Void_Ptr /= System.Null_Address then
+ if This in Menu_Button then
+ free_fl_menu_button (This.Void_Ptr);
+ end if;
+ end if;
+ end Finalize;
+
+
+
+
+ function Create
+ (X, Y, W, H : in Integer;
+ Text : in String)
+ return Menu_Button is
+ begin
+ return This : Menu_Button do
+ This.Void_Ptr := new_fl_menu_button
+ (Interfaces.C.int (X),
+ Interfaces.C.int (Y),
+ Interfaces.C.int (W),
+ Interfaces.C.int (H),
+ Interfaces.C.To_C (Text));
+ fl_widget_set_user_data
+ (This.Void_Ptr,
+ Widget_Convert.To_Address (This'Unchecked_Access));
+ end return;
+ end Create;
+
+
+
+
+ procedure Set_Popup_Kind
+ (This : in out Menu_Button;
+ Pop : in Popup_Buttons) is
+ begin
+ fl_menu_button_type (This.Void_Ptr, Popup_Buttons'Pos (Pop));
+ end Set_Popup_Kind;
+
+
+end FLTK.Widgets.Menus.Menu_Buttons;
+
diff --git a/fltk-widgets-menus-menu_buttons.ads b/fltk-widgets-menus-menu_buttons.ads
new file mode 100644
index 0000000..5527abc
--- /dev/null
+++ b/fltk-widgets-menus-menu_buttons.ads
@@ -0,0 +1,35 @@
+
+
+package FLTK.Widgets.Menus.Menu_Buttons is
+
+
+ type Menu_Button is new Menu with private;
+
+
+ -- signifies which mouse buttons cause the menu to appear
+ type Popup_Buttons is (No_Popup, Popup1, Popup2, Popup12, Popup3, Popup13, Popup23, Popup123);
+
+
+ function Create
+ (X, Y, W, H : in Integer;
+ Text : in String)
+ return Menu_Button;
+
+
+ procedure Set_Popup_Kind
+ (This : in out Menu_Button;
+ Pop : in Popup_Buttons);
+
+
+private
+
+
+ type Menu_Button is new Menu with null record;
+
+
+ overriding procedure Finalize
+ (This : in out Menu_Button);
+
+
+end FLTK.Widgets.Menus.Menu_Buttons;
+