def onBrowserEvent(self, event): # farm out the event to convenience handlers. # detect existence by checking for the listener lists of each # type of handler. there's probably a better way to do this... if hasattr(self, "_clickListeners"): ClickHandler.onBrowserEvent(self, event) if hasattr(self, "_keyboardListeners"): KeyboardHandler.onBrowserEvent(self, event) if hasattr(self, "_mouseListeners"): MouseHandler.onBrowserEvent(self, event) if hasattr(self, "_focusListeners"): FocusHandler.onBrowserEvent(self, event) if self.contextMenu is None: return True type = DOM.eventGetType(event) if type == "contextmenu": DOM.eventCancelBubble(event, True) DOM.eventPreventDefault(event) self.contextMenu.onContextMenu(self) return False return True