Menu.Closed is a new property that returns if a popup menu is closed.

[GB.GTK]
* NEW: Menu.Closed is a new property that returns if a popup menu is closed.

[GB.GTK3]
* NEW: Menu.Closed is a new property that returns if a popup menu is closed.

[GB.QT4]
* NEW: Menu.Closed is a new property that returns if a popup menu is closed.

[GB.QT5]
* NEW: Menu.Closed is a new property that returns if a popup menu is closed.
This commit is contained in:
gambas 2018-02-23 04:05:27 +01:00
parent a93f5b3cc2
commit 5969cc0062
4 changed files with 25 additions and 0 deletions

View File

@ -520,6 +520,14 @@ BEGIN_PROPERTY(Menu_Proxy)
END_PROPERTY
BEGIN_PROPERTY(Menu_Closed)
GB.ReturnBoolean(MENU->isClosed());
END_PROPERTY
//---------------------------------------------------------------------------
GB_DESC CMenuChildrenDesc[] =
@ -573,6 +581,8 @@ GB_DESC CMenuDesc[] =
GB_METHOD("Show", 0, Menu_Show, 0),
GB_METHOD("Hide", 0, Menu_Hide, 0),
GB_PROPERTY_READ("Closed", "b", Menu_Closed),
GB_EVENT("Click", 0, 0, &EVENT_Click),
GB_EVENT("Show", 0, 0, &EVENT_Show),
GB_EVENT("Hide", 0, 0, &EVENT_Hide),

View File

@ -60,6 +60,7 @@ public:
bool topLevel() const { return top_level; }
bool isSeparator() const { return _style == SEPARATOR; }
void *parent() const { return pr; }
bool isClosed() const { return !_opened; }
void setChecked(bool vl);
void setToggle(bool vl);

View File

@ -893,6 +893,13 @@ BEGIN_PROPERTY(Menu_Tag)
END_METHOD
BEGIN_PROPERTY(Menu_Closed)
GB.ReturnBoolean(!THIS->opened);
END_PROPERTY
//---------------------------------------------------------------------------
GB_DESC CMenuChildrenDesc[] =
@ -943,6 +950,8 @@ GB_DESC CMenuDesc[] =
GB_METHOD("Show", NULL, Menu_Show, NULL),
GB_METHOD("Hide", NULL, Menu_Hide, NULL),
GB_PROPERTY_READ("Closed", "b", Menu_Closed),
//GB_EVENT("Delete", NULL, NULL, &EVENT_Destroy), // Must be first
GB_EVENT("Click", NULL, NULL, &EVENT_Click),
GB_EVENT("Show", NULL, NULL, &EVENT_Show),
@ -1022,6 +1031,8 @@ void CMenu::slotShown(void)
HANDLE_PROXY(menu);
GB.Ref(menu);
menu->opened = TRUE;
GB.Raise(menu, EVENT_Show, 0);
@ -1043,6 +1054,8 @@ void CMenu::slotHidden(void)
GET_MENU_SENDER(menu);
HANDLE_PROXY(menu);
menu->opened = FALSE;
if (GB.CanRaise(menu, EVENT_Hide))
{
GB.Ref(menu);

View File

@ -80,6 +80,7 @@ typedef
unsigned disabled : 1;
unsigned visible : 1;
unsigned init_shortcut : 1;
unsigned opened : 1;
}
CMENU;