[GB.GTK]
* BUG: Fix 'Menu' event and PopupMenu property behaviour. The default behaviour of the control is cancelled if: the PopupMenu property is defined, or if the 'Menu' event is stopped with STOP EVENT, of if a popup menu is displayed during the 'Menu' event handler. [GB.GTK3] * BUG: Fix 'Menu' event and PopupMenu property behaviour. The default behaviour of the control is cancelled if: the PopupMenu property is defined, or if the 'Menu' event is stopped with STOP EVENT, of if a popup menu is displayed during the 'Menu' event handler. [GB.QT4] * BUG: Fix 'Menu' event and PopupMenu property behaviour. The default behaviour of the control is cancelled if: the PopupMenu property is defined, or if the 'Menu' event is stopped with STOP EVENT, of if a popup menu is displayed during the 'Menu' event handler. git-svn-id: svn://localhost/gambas/trunk@6519 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
97913aa329
commit
05f20c33e4
@ -190,8 +190,9 @@ bool gb_raise_MouseEvent(gControl *sender, int type)
|
||||
{
|
||||
if (GB.CanRaise(ob, EVENT_Menu))
|
||||
{
|
||||
GB.Raise(ob, EVENT_Menu, 0);
|
||||
return true;
|
||||
int old = gMenu::popupCount();
|
||||
if (GB.Raise(ob, EVENT_Menu, 0) || old != gMenu::popupCount())
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ob->popup)
|
||||
|
@ -580,7 +580,10 @@ __FOUND_WIDGET:
|
||||
while (control)
|
||||
{
|
||||
if (control->onMouseEvent(control, gEvent_MouseMenu))
|
||||
{
|
||||
cancel = true;
|
||||
break;
|
||||
}
|
||||
control = control->_proxy_for;
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ typedef
|
||||
|
||||
gMenu *gMenu::_current_popup = NULL;
|
||||
int gMenu::_in_popup = 0;
|
||||
int gMenu::_popup_count = 0;
|
||||
|
||||
static GList *menus = NULL;
|
||||
|
||||
@ -741,7 +742,8 @@ void gMenu::doPopup(bool move, int x, int y)
|
||||
_current_popup = this;
|
||||
|
||||
_in_popup++;
|
||||
|
||||
_popup_count++;
|
||||
|
||||
gtk_menu_popup(child, NULL, NULL, move ? (GtkMenuPositionFunc)position_menu : NULL, (gpointer)pos, 0, gApplication::lastEventTime());
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 20, 0)
|
||||
|
@ -42,6 +42,8 @@ public:
|
||||
static void updateColor(gMainWindow *win);
|
||||
static gMenu *findFromName(gMainWindow *win, const char *name);
|
||||
|
||||
static int popupCount() { return _popup_count; }
|
||||
|
||||
//"Properties"
|
||||
bool checked() const { return _checked; }
|
||||
bool toggle() const { return _toggle; }
|
||||
@ -129,6 +131,7 @@ private:
|
||||
|
||||
static gMenu *_current_popup;
|
||||
static int _in_popup;
|
||||
static int _popup_count;
|
||||
|
||||
void doPopup(bool move, int x = 0, int y = 0);
|
||||
void update();
|
||||
|
@ -2498,15 +2498,14 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event)
|
||||
//qDebug("Menu event! %p %d", control, EVENT_Menu);
|
||||
if (GB.CanRaise(control, EVENT_Menu))
|
||||
{
|
||||
static int old = MENU_popup_count;
|
||||
int old = MENU_popup_count;
|
||||
|
||||
((QContextMenuEvent *)event)->accept();
|
||||
|
||||
GB.Raise(control, EVENT_Menu, 0);
|
||||
if (MENU_popup_count != old)
|
||||
if (GB.Raise(control, EVENT_Menu, 0) || MENU_popup_count != old)
|
||||
return true;
|
||||
else
|
||||
goto __NEXT;
|
||||
//else
|
||||
// goto __NEXT;
|
||||
}
|
||||
|
||||
if (EXT(control) && EXT(control)->popup)
|
||||
|
Loading…
x
Reference in New Issue
Block a user