Event handling loop for the menu
169300
def update(self, screen, clock):
        """"""

        # If a music file was passed, start playing it on repeat
        if self.music is not None:
            pygame.mixer.music.play(-1)

        while True:
            clock.tick(30)
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    sys.exit()
                # Check if any of the buttons were clicked
                for i in self.buttonlist:
                    if (event.type == pygame.MOUSEBUTTONUP and
                            i.rect.collidepoint(pygame.mouse.get_pos())):
                        if self.music is not None:
                            pygame.mixer.music.stop()
                        if self.widgetlist:
                            return [i(), self.widget_status()]
                        else:
                            return i()
                # If there is a widget list, check to see if any were clicked
                if self.widgetlist:
                    for i in self.widgetlist:
                        if (event.type == pygame.MOUSEBUTTONDOWN and
                                i.rect.collidepoint(pygame.mouse.get_pos())):
                            # Call the widget and give it the menu information
                            i(self)
            screen.blit(self.image, self.pos)
            pygame.display.flip()
144859
function onTriggerClick(e, noFocus) {
    toggleSubmenu(elements.trigger, (_, done) => {
      Classlist(elements.trigger).toggle(ACTIVE_CLASS);
      const wasActive = Classlist(elements.menu).contains(ACTIVE_CLASS);
      const first = wasActive ? ACTIVE_CLASS : 'dqpl-show';
      const second = first === ACTIVE_CLASS ? 'dqpl-show' : ACTIVE_CLASS;

      Classlist(elements.menu).toggle(first);

      if (elements.scrim) {
        Classlist(elements.scrim).toggle('dqpl-scrim-show');
      }

      setTimeout(() => {
        Classlist(elements.menu).toggle(second);
        if (elements.scrim) { Classlist(elements.scrim).toggle('dqpl-scrim-fade-in'); }
        setTimeout(() => done(noFocus));
      }, 100);
    });
  }
1345696
function() {
        var html = this.root.getHtml(),
            el = this.getEl();
        el.innerHTML = html;
        if (!this._hasEvents) {
            Event.on(el, 'click', this._onClickEvent, this, true);
            Event.on(el, 'dblclick', this._onDblClickEvent, this, true);
            Event.on(el, 'mouseover', this._onMouseOverEvent, this, true);
            Event.on(el, 'mouseout', this._onMouseOutEvent, this, true);
            Event.on(el, 'keydown', this._onKeyDownEvent, this, true);
        }
        this._hasEvents = true;
    }
62065
function captureClickListener(e) {
          var target = e.target;
          // Traverse up the event until we get to the menuContentEl to see if
          // there is an ng-click and that the ng-click is not disabled
          do {
            if (target == opts.menuContentEl[0]) return;
            if ((hasAnyAttribute(target, ['ng-click', 'ng-href', 'ui-sref']) ||
                target.nodeName == 'BUTTON' || target.nodeName == 'MD-BUTTON') && !hasAnyAttribute(target, ['md-prevent-menu-close'])) {
              var closestMenu = $mdUtil.getClosest(target, 'MD-MENU');
              if (!target.hasAttribute('disabled') && (!closestMenu || closestMenu == opts.parent[0])) {
                close();
              }
              break;
            }
          } while (target = target.parentNode);

          function close() {
            scope.$apply(function() {
              opts.mdMenuCtrl.close(true, { closeAll: true });
            });
          }

          function hasAnyAttribute(target, attrs) {
            if (!target) return false;

            for (var i = 0, attr; attr = attrs[i]; ++i) {
              if (prefixer.hasAttribute(target, attr)) {
                return true;
              }
            }

            return false;
          }
        }
1104463
def contextMenuEvent(self, event):
        """"""
        if self.model.showndata:
            self.refresh_menu()
            self.menu.popup(event.globalPos())
            event.accept()
        else:
            self.empty_ws_menu.popup(event.globalPos())
            event.accept()
1281608
public void onClick(MenuItemClickEvent event) {
		if (feature != null && feature.isSelected()) {
			SC.confirm(
					I18nProvider.getGlobal().confirmDeleteFeature(feature.getLabel(), feature.getLayer().getLabel()),
					new BooleanCallback() {

						public void execute(Boolean value) {
							if (value) {
								feature.getLayer().deselectFeature(feature);
								mapWidget.getMapModel().getFeatureEditor()
										.startEditing(new Feature[] { feature }, null);
								SaveEditingAction action = new SaveEditingAction(mapWidget, controller);
								action.onClick(null);
							}
						}
					});
		}
	}
1137614
def handle_menu_event(self, obj):
        ''''''
        menuitem = obj.menuitem
        if menuitem.returnkey.startswith('# '):
            cmd = menuitem.returnkey[2:]
            if menuitem.handler is not None:
                if menuitem.handler_result is None:
                    return
                cmd += menuitem.handler_result
            self.mpstate.functions.process_stdin(cmd)
        elif menuitem.returnkey == 'popupRallyRemove':
            self.remove_rally(obj.selected[0].objkey)
        elif menuitem.returnkey == 'popupRallyMove':
            self.move_rally(obj.selected[0].objkey)
        elif menuitem.returnkey == 'popupMissionSet':
            self.set_mission(obj.selected[0].objkey, obj.selected[0].extra_info)
        elif menuitem.returnkey == 'popupMissionRemoveNoFly':
            self.remove_mission_nofly(obj.selected[0].objkey, obj.selected[0].extra_info)
        elif menuitem.returnkey == 'popupMissionRemove':
            self.remove_mission(obj.selected[0].objkey, obj.selected[0].extra_info)
        elif menuitem.returnkey == 'popupMissionMove':
            self.move_mission(obj.selected[0].objkey, obj.selected[0].extra_info)
        elif menuitem.returnkey == 'popupFenceRemove':
            self.remove_fencepoint(obj.selected[0].objkey, obj.selected[0].extra_info)
        elif menuitem.returnkey == 'popupFenceMove':
            self.move_fencepoint(obj.selected[0].objkey, obj.selected[0].extra_info)
        elif menuitem.returnkey == 'showPosition':
            self.show_position()
554358
def showEvent(self, event):
        
        super(XMenu, self).showEvent(event)
        
        self.adjustSize()
        self.adjustMinimumWidth()
        self.rebuildButtons()
1323345
def contextMenuEvent(self, event):
        """"""
        state = self.has_selected_text()
        self.copy_without_prompts_action.setEnabled(state)
        ShellBaseWidget.contextMenuEvent(self, event)
35337
def contextMenuEvent(self, event):
        """"""
        state = self.has_selected_text()
        self.copy_action.setEnabled(state)
        self.cut_action.setEnabled(state)
        self.delete_action.setEnabled(state)
        self.menu.popup(event.globalPos())
        event.accept()
984827
function () {
            var self = this;
            self.$sausages
                .delegate('.sausage', 'hover', function(){
                    if (self.blocked)
                    {
                        return;
                    }
                    $(this)
                        .toggleClass('sausage-hover')
                        ;
                })
                .delegate('.sausage', 'click', function(e){
                    e.preventDefault();
                    if (self.blocked)
                    {
                        return;
                    }
                    var $sausage = $(this),
                        val = $sausage.index(),
                        o = self.$inner.find(self.options.page).eq(val).offset().top;
                    self._scrollTo(o);
                    // Trigger the `onClick` event.
                    //
                    // Example:
                    //
                    //      $(window)
                    //          .sausage({
                    //              onClick: function (e, o) {
                    //                  alert('You clicked the sausage at index: ' + o.i);
                    //          }
                    //      })
                    //      ;
                    //
                    self._trigger('onClick', e, {
                        $sausage: $sausage,
                        i: val
                    });
                    if ($sausage.hasClass('current'))
                    {
                        return;
                    }
                    // Trigger the `onUpdate` event.
                    self._trigger('onUpdate', e, {
                        $sausage: $sausage,
                        i: val
                    });
                })
                ;
            return;
        }
609336
def contextMenuEvent(self, event):
        
        menu = QtWidgets.QPlainTextEdit.createStandardContextMenu(self)
        mg = self.getGlobalsMenu()

        a0 = menu.actions()[0]
        menu.insertMenu(a0, mg)
        menu.insertSeparator(a0)

        menu.addSeparator()
        a = QtWidgets.QAction('Show line numbers', menu)
        l = self.codeEditor.lineNumbers
        a.setCheckable(True)
        a.setChecked(l.isVisible())
        a.triggered.connect(lambda checked: l.show() if checked else l.hide())
        menu.addAction(a)

        menu.addSeparator()
        a = QtWidgets.QAction('Save to file', menu)
        a.triggered.connect(self.saveToFile)
        menu.addAction(a)

        menu.exec_(event.globalPos())
793016
function () {
		if (this.options.clickable) {
			if (L.Browser.svg || !L.Browser.vml) {
				L.DomUtil.addClass(this._path, 'leaflet-clickable');
			}

			L.DomEvent.on(this._container, 'click', this._onMouseClick, this);

			var events = ['dblclick', 'mousedown', 'mouseover',
			              'mouseout', 'mousemove', 'contextmenu'];
			for (var i = 0; i < events.length; i++) {
				L.DomEvent.on(this._container, events[i], this._fireMouseEvent, this);
			}
		}
	}
789039
function handleOptionClick(event) {
    let el;

    // find the element with the data
    // start with the target element
    if (event.target.dataset.optionValue) {
        el = event.target;
    // check up the tree one level (in case option text or status was clicked)
    } else if (event.target.parentNode.dataset.optionValue) {
        el = event.target.parentNode;
    }

    this.processAfterStateChange(el);
    this.expander.collapse();
    this.el.querySelector(comboboxHostSelector).focus();
}
1175840
def on_menu(self, event):
        ''''''
        state = self.state
        ret = self.menu.find_selected(event)
        if ret is None:
            return
        ret.call_handler()
        state.child_pipe_send.send(ret)
634787
def gameloop(self):
        
        try:
            while True:
                self.handle_events()
                self.update()
                self.render()
        except KeyboardInterrupt:
            pass
562342
function(e) {
            // abort if we're leaving for a menu
            var $related = $(e.relatedTarget);
            if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) {
                return;
            }
            
            try {
                clearTimeout(hoveract.timer);
            } catch(e) {}
            
            hoveract.timer = null;
        }