Menu.Parent is a new property that returns the parent menu of a menu, or NULL if the menu is a top-level one.

[GB.GTK]
* NEW: Menu.Parent is a new property that returns the parent menu of a menu, or NULL if the menu is a top-level one.

[GB.GTK3]
* NEW: Menu.Parent is a new property that returns the parent menu of a menu, or NULL if the menu is a top-level one.

[GB.QT4]
* NEW: Menu.Parent is a new property that returns the parent menu of a menu, or NULL if the menu is a top-level one.

[GB.QT5]
* NEW: Menu.Parent is a new property that returns the parent menu of a menu, or NULL if the menu is a top-level one.
This commit is contained in:
Benoît Minisini 2022-07-30 00:59:05 +02:00
parent c0de8e87d6
commit 911ba060e7
2 changed files with 21 additions and 0 deletions

View File

@ -429,6 +429,16 @@ BEGIN_PROPERTY(Menu_Window)
END_PROPERTY
BEGIN_PROPERTY(Menu_Parent)
if (MENU->isTopLevel())
GB.ReturnNull();
else
GB.ReturnObject(GetObject(MENU->parentMenu()));
END_PROPERTY
BEGIN_PROPERTY(Menu_Name)
if (READ_PROPERTY)
@ -530,6 +540,7 @@ GB_DESC CMenuDesc[] =
GB_PROPERTY("Value", "b", Menu_Value),
//GB_PROPERTY("TearOff", "b", CMENU_tear_off),
GB_PROPERTY("Action", "s", Menu_Action),
GB_PROPERTY_READ("Parent", "Menu", Menu_Parent),
GB_PROPERTY_READ("Window", "Window", Menu_Window),
GB_PROPERTY("Proxy", "Menu", Menu_Proxy),

View File

@ -834,6 +834,15 @@ BEGIN_PROPERTY(Menu_Window)
END_PROPERTY
BEGIN_PROPERTY(Menu_Parent)
if (CMENU_is_toplevel(THIS))
GB.ReturnNull();
else
GB.ReturnObject(THIS->parent);
END_PROPERTY
BEGIN_PROPERTY(Menu_Action)
char *current = THIS_EXT ? THIS_EXT->action : NULL;
@ -944,6 +953,7 @@ GB_DESC CMenuDesc[] =
GB_PROPERTY("Radio", "b", Menu_Radio),
GB_PROPERTY("Value", "b", Menu_Value),
GB_PROPERTY("Action", "s", Menu_Action),
GB_PROPERTY_READ("Parent", "Menu", Menu_Parent),
GB_PROPERTY_READ("Window", "Window", Menu_Window),
GB_PROPERTY("Proxy", "Menu", Menu_Proxy),