From 91593912af9a6b81b89ee15b2cfc3c604f9ce5a7 Mon Sep 17 00:00:00 2001 From: Mohammed Alyousef Date: Fri, 26 Jul 2024 23:24:17 +0300 Subject: [PATCH] Add Menu mvalue() and prev_mvalue() --- fltk | 2 +- include/cfl_menu.h | 4 +++- src/cfl_menu.cpp | 17 +++++++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/fltk b/fltk index a7d00ae..b740c48 160000 --- a/fltk +++ b/fltk @@ -1 +1 @@ -Subproject commit a7d00ae558afb7390f249db234a1e83c280365df +Subproject commit b740c48ee8505f93662065384d84b449d5e33438 diff --git a/include/cfl_menu.h b/include/cfl_menu.h index d719ad6..a0e1967 100644 --- a/include/cfl_menu.h +++ b/include/cfl_menu.h @@ -53,7 +53,9 @@ extern "C" { const Fl_Menu_Item *item \ ); \ void widget##_set_menu_box(widget *self, int b); \ - int widget##_menu_box(const widget *self); + int widget##_menu_box(const widget *self); \ + Fl_Menu_Item *widget##_mvalue(const widget *); \ + Fl_Menu_Item *widget##_prev_mvalue(const widget *); typedef struct Fl_Menu_Item Fl_Menu_Item; diff --git a/src/cfl_menu.cpp b/src/cfl_menu.cpp index 67dfe77..c33ef7c 100644 --- a/src/cfl_menu.cpp +++ b/src/cfl_menu.cpp @@ -149,6 +149,14 @@ int widget##_menu_box(const widget *self) { \ LOCK(auto ret = self->menu_box()); \ return ret; \ + } \ + Fl_Menu_Item *widget##_mvalue(const widget *self) { \ + LOCK(auto ret = self->mvalue()); \ + return (Fl_Menu_Item *)ret; \ + } \ + Fl_Menu_Item *widget##_prev_mvalue(const widget *self) { \ + LOCK(auto ret = self->prev_mvalue()); \ + return (Fl_Menu_Item *)ret; \ } WIDGET_CLASS(Fl_Menu_Bar) @@ -252,7 +260,11 @@ const Fl_Menu_Item *Fl_Menu_Item_pulldown( const Fl_Menu_Item *title, int menubar ) { - LOCK(auto ret = self->pulldown(X, Y, W, H, picked, (const Fl_Menu_ *)menu, title, menubar)); + LOCK( + auto ret = self->pulldown( + X, Y, W, H, picked, (const Fl_Menu_ *)menu, title, menubar + ) + ); return ret; } @@ -365,7 +377,8 @@ void Fl_Menu_Item_set_callback(Fl_Menu_Item *self, Fl_Callback *c, void *p) { } void Fl_Menu_Item_do_callback(Fl_Menu_Item *self, Fl_Widget *w) { - LOCK(if (self->callback() && ((Fl_Menu_*)w)->find_index(self) >= 0) self->do_callback(w)); + LOCK(if (self->callback() && ((Fl_Menu_ *)w)->find_index(self) >= 0) + self->do_callback(w)); } void *Fl_Menu_Item_user_data(const Fl_Menu_Item *self) {