diff --git a/gb.gtk/src/CMenu.cpp b/gb.gtk/src/CMenu.cpp index 291e88a31..a9399b3a9 100644 --- a/gb.gtk/src/CMenu.cpp +++ b/gb.gtk/src/CMenu.cpp @@ -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), diff --git a/gb.gtk/src/gmenu.h b/gb.gtk/src/gmenu.h index db6d181ee..40290491b 100644 --- a/gb.gtk/src/gmenu.h +++ b/gb.gtk/src/gmenu.h @@ -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); diff --git a/gb.qt4/src/CMenu.cpp b/gb.qt4/src/CMenu.cpp index 496710b33..27bbd2cf7 100644 --- a/gb.qt4/src/CMenu.cpp +++ b/gb.qt4/src/CMenu.cpp @@ -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); diff --git a/gb.qt4/src/CMenu.h b/gb.qt4/src/CMenu.h index eb317fe33..50cb9b552 100644 --- a/gb.qt4/src/CMenu.h +++ b/gb.qt4/src/CMenu.h @@ -80,6 +80,7 @@ typedef unsigned disabled : 1; unsigned visible : 1; unsigned init_shortcut : 1; + unsigned opened : 1; } CMENU;