From c53eec6b06e8a30a8e718d3955892a245f89a2f6 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Tue, 20 Mar 2018 14:21:51 +1100 Subject: Progress updated, Buttons and Menu_Buttons finished --- progress.txt | 28 ++++++++++++++-- src/c_fl_button.cpp | 20 ++++++++++++ src/c_fl_button.h | 6 ++++ src/c_fl_menu_button.cpp | 5 +++ src/c_fl_menu_button.h | 1 + src/fltk-widgets-buttons.adb | 57 +++++++++++++++++++++++++++++++++ src/fltk-widgets-buttons.ads | 19 +++++++++++ src/fltk-widgets-menus-menu_buttons.adb | 15 +++++++++ src/fltk-widgets-menus-menu_buttons.ads | 9 ++++++ 9 files changed, 158 insertions(+), 2 deletions(-) diff --git a/progress.txt b/progress.txt index 9325713..ffeb212 100644 --- a/progress.txt +++ b/progress.txt @@ -26,6 +26,7 @@ FLTK.Images.RGB.JPEG FLTK.Images.RGB.PNG FLTK.Images.RGB.PNM FLTK.Widgets.Boxes +FLTK.Widgets.Buttons FLTK.Widgets.Buttons.Enter FLTK.Widgets.Buttons.Light FLTK.Widgets.Buttons.Light.Check @@ -59,6 +60,7 @@ FLTK.Widgets.Inputs.Outputs FLTK.Widgets.Inputs.Outputs.Multiline FLTK.Widgets.Inputs.Secret FLTK.Widgets.Menus.Menu_Bars +FLTK.Widgets.Menus.Menu_Buttons FLTK.Widgets.Progress_Bars FLTK.Widgets.Valuators FLTK.Widgets.Valuators.Adjusters @@ -89,13 +91,11 @@ FLTK.Menu_Items FLTK.Screen FLTK.Text_Buffers; FLTK.Widgets -FLTK.Widgets.Buttons (70%) FLTK.Widgets.Groups FLTK.Widgets.Groups.Text_Displays (94%) FLTK.Widgets.Groups.Windows FLTK.Widgets.Inputs FLTK.Widgets.Menus -FLTK.Widgets.Menus.Menu_Buttons @@ -117,6 +117,16 @@ FL_Help_View (several methods have ABI_VERSION bugs) FL_Table FL_Table_Row FL_Tree +FL_Device +FL_Graphics_Driver +FL_Surface_Device +FL_Copy_Surface +FL_Image_Surface +FL_Paged_Device +FL_Printer +FL_Tooltip +FL_Preferences +FL_Label - mark all methods as inline - make sure all C++ reinterpret_cast for methods is to the Fl object, not the My object, because inheriting @@ -133,6 +143,20 @@ FL_Free FL_Sys_Menu_Bar FL_Positioner FL_Timer +FL_Postscript_File_Device +FL_Postscript_Printer +FL_System_Printer +FL_GDI_Graphics_Driver +FL_Postscript_Graphics_Driver +FL_Quartz_Graphics_Driver +FL_Xlib_Graphics_Driver +FL_Plugin +FL_Plugin_Manager +FL_Device_Plugin +FL_Overlay_Window +FL_GL_Window +FL_Glut_Window +FL_Cairo_Window diff --git a/src/c_fl_button.cpp b/src/c_fl_button.cpp index 5aa06c4..bdd3eb3 100644 --- a/src/c_fl_button.cpp +++ b/src/c_fl_button.cpp @@ -82,3 +82,23 @@ void fl_button_set_only(BUTTON b) { reinterpret_cast(b)->setonly(); } + + + +int fl_button_get_down_box(BUTTON b) { + return reinterpret_cast(b)->down_box(); +} + +void fl_button_set_down_box(BUTTON b, int t) { + reinterpret_cast(b)->down_box(static_cast(t)); +} + +int fl_button_get_shortcut(BUTTON b) { + return reinterpret_cast(b)->shortcut(); +} + +void fl_button_set_shortcut(BUTTON b, int k) { + reinterpret_cast(b)->shortcut(k); +} + + diff --git a/src/c_fl_button.h b/src/c_fl_button.h index 7209ab6..33120ad 100644 --- a/src/c_fl_button.h +++ b/src/c_fl_button.h @@ -30,5 +30,11 @@ extern "C" void fl_button_set_state(BUTTON b, int s); extern "C" void fl_button_set_only(BUTTON b); +extern "C" int fl_button_get_down_box(BUTTON b); +extern "C" void fl_button_set_down_box(BUTTON b, int t); +extern "C" int fl_button_get_shortcut(BUTTON b); +extern "C" void fl_button_set_shortcut(BUTTON b, int k); + + #endif diff --git a/src/c_fl_menu_button.cpp b/src/c_fl_menu_button.cpp index d4ff176..b08c36f 100644 --- a/src/c_fl_menu_button.cpp +++ b/src/c_fl_menu_button.cpp @@ -74,3 +74,8 @@ void fl_menu_button_type(MENUBUTTON m, unsigned int t) { reinterpret_cast(m)->type(t); } +const void * fl_menu_button_popup(MENUBUTTON m) { + return reinterpret_cast(m)->popup(); +} + + diff --git a/src/c_fl_menu_button.h b/src/c_fl_menu_button.h index 505723d..8013bf9 100644 --- a/src/c_fl_menu_button.h +++ b/src/c_fl_menu_button.h @@ -26,6 +26,7 @@ extern "C" void free_fl_menu_button(MENUBUTTON m); extern "C" void fl_menu_button_type(MENUBUTTON m, unsigned int t); +extern "C" const void * fl_menu_button_popup(MENUBUTTON m); #endif diff --git a/src/fltk-widgets-buttons.adb b/src/fltk-widgets-buttons.adb index 5e7e18c..9024f8e 100644 --- a/src/fltk-widgets-buttons.adb +++ b/src/fltk-widgets-buttons.adb @@ -54,6 +54,29 @@ package body FLTK.Widgets.Buttons is + function fl_button_get_down_box + (B : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_button_get_down_box, "fl_button_get_down_box"); + + procedure fl_button_set_down_box + (B : in System.Address; + T : in Interfaces.C.int); + pragma Import (C, fl_button_set_down_box, "fl_button_set_down_box"); + + function fl_button_get_shortcut + (B : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_button_get_shortcut, "fl_button_get_shortcut"); + + procedure fl_button_set_shortcut + (B : in System.Address; + T : in Interfaces.C.int); + pragma Import (C, fl_button_set_shortcut, "fl_button_set_shortcut"); + + + + procedure fl_button_draw (W : in System.Address); pragma Import (C, fl_button_draw, "fl_button_draw"); @@ -134,6 +157,40 @@ package body FLTK.Widgets.Buttons is + function Get_Down_Box + (This : in Button) + return Box_Kind is + begin + return Box_Kind'Val (fl_button_get_down_box (This.Void_Ptr)); + end Get_Down_Box; + + + procedure Set_Down_Box + (This : in out Button; + To : in Box_Kind) is + begin + fl_button_set_down_box (This.Void_Ptr, Box_Kind'Pos (To)); + end Set_Down_Box; + + + function Get_Shortcut + (This : in Button) + return Shortcut_Key is + begin + return C_To_Key (Interfaces.C.unsigned_long (fl_button_get_shortcut (This.Void_Ptr))); + end Get_Shortcut; + + + procedure Set_Shortcut + (This : in out Button; + Key : in Shortcut_Key) is + begin + fl_button_set_shortcut (This.Void_Ptr, Interfaces.C.int (Key_To_C (Key))); + end Set_Shortcut; + + + + procedure Draw (This : in out Button) is begin diff --git a/src/fltk-widgets-buttons.ads b/src/fltk-widgets-buttons.ads index 55d75c6..f740b32 100644 --- a/src/fltk-widgets-buttons.ads +++ b/src/fltk-widgets-buttons.ads @@ -36,6 +36,25 @@ package FLTK.Widgets.Buttons is + function Get_Down_Box + (This : in Button) + return Box_Kind; + + procedure Set_Down_Box + (This : in out Button; + To : in Box_Kind); + + function Get_Shortcut + (This : in Button) + return Shortcut_Key; + + procedure Set_Shortcut + (This : in out Button; + Key : in Shortcut_Key); + + + + procedure Draw (This : in out Button); diff --git a/src/fltk-widgets-menus-menu_buttons.adb b/src/fltk-widgets-menus-menu_buttons.adb index 8c39887..9b6d1cb 100644 --- a/src/fltk-widgets-menus-menu_buttons.adb +++ b/src/fltk-widgets-menus-menu_buttons.adb @@ -42,6 +42,11 @@ package body FLTK.Widgets.Menus.Menu_Buttons is T : in Interfaces.C.unsigned); pragma Import (C, fl_menu_button_type, "fl_menu_button_type"); + function fl_menu_button_popup + (M : in System.Address) + return System.Address; + pragma Import (C, fl_menu_button_popup, "fl_menu_button_popup"); + @@ -110,6 +115,16 @@ package body FLTK.Widgets.Menus.Menu_Buttons is end Set_Popup_Kind; + function Popup + (This : in out Menu_Button) + return FLTK.Menu_Items.Menu_Item is + begin + return Item : FLTK.Menu_Items.Menu_Item do + Wrapper (Item).Void_Ptr := fl_menu_button_popup (This.Void_Ptr); + end return; + end Popup; + + procedure Draw diff --git a/src/fltk-widgets-menus-menu_buttons.ads b/src/fltk-widgets-menus-menu_buttons.ads index fe1092a..f7bba64 100644 --- a/src/fltk-widgets-menus-menu_buttons.ads +++ b/src/fltk-widgets-menus-menu_buttons.ads @@ -1,5 +1,10 @@ +with + + FLTK.Menu_Items; + + package FLTK.Widgets.Menus.Menu_Buttons is @@ -30,6 +35,10 @@ package FLTK.Widgets.Menus.Menu_Buttons is (This : in out Menu_Button; Pop : in Popup_Buttons); + function Popup + (This : in out Menu_Button) + return FLTK.Menu_Items.Menu_Item; + -- cgit