Exemplo n.º 1
0
    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, "_mouseWheelListeners"):
            MouseWheelHandler.onBrowserEvent(self, event)
        if hasattr(self, "_focusListeners"):
            FocusHandler.onBrowserEvent(self, event)
        if hasattr(self, "_dragListeners"):
            DragHandler.onBrowserEvent(self, event)
        if hasattr(self, "_dropListeners"):
            DropHandler.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
    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, "_mouseWheelListeners"):
            MouseWheelHandler.onBrowserEvent(self, event)
        if hasattr(self, "_focusListeners"):
            FocusHandler.onBrowserEvent(self, event)
        if hasattr(self, "_dragListeners"):
            DragHandler.onBrowserEvent(self, event)
        if hasattr(self, "_changeListeners"):
            ChangeHandler.onBrowserEvent(self, event)
        if hasattr(self, "_inputListeners"):
            InputHandler.onBrowserEvent(self, event)
        if hasattr(self, "_dropListeners"):
            DropHandler.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
Exemplo n.º 3
0
 def onBrowserEvent(self, event):
     if DOM.eventGetType(event) in DROP_EVENTS and not self.block.original:
         mb = getWorkspace().getMovingBlock()
         if not DOM.isOrHasChild(
                 mb.getElement(),
                 self.getElement()) and mb.blockType in self.accepts:
             DropHandler.onBrowserEvent(self, event)
     elif DOM.eventGetType(event) in KEYBOARD_EVENTS:
         KeyboardHandler.onBrowserEvent(self, event)