* 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:
Benoît Minisini 2014-10-04 12:56:02 +00:00
parent 97913aa329
commit 05f20c33e4
5 changed files with 16 additions and 8 deletions

View File

@ -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)

View File

@ -580,7 +580,10 @@ __FOUND_WIDGET:
while (control)
{
if (control->onMouseEvent(control, gEvent_MouseMenu))
{
cancel = true;
break;
}
control = control->_proxy_for;
}
}

View File

@ -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,6 +742,7 @@ 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());

View File

@ -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();

View File

@ -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)