Example #1
0
        public new bool EventFilter(QObject obj, QEvent evnt)
        {
            var type = evnt.type();

            if (type == QEvent.TypeOf.MouseButtonPress) {
                var mouseEvent = (QMouseEvent)evnt;
                if (mouseEvent.Button() == Qt.MouseButton.LeftButton) {
                    m_Moving = true;
                    m_OrigX = mouseEvent.X();
                    m_OrigY = mouseEvent.Y();
                    m_ParentWidget.Cursor = new QCursor(Qt.CursorShape.SizeAllCursor);
                }

            } else if (type == QEvent.TypeOf.MouseMove) {
                var mouseEvent = (QMouseEvent)evnt;
                if (m_Moving) {
                    var pos = mouseEvent.GlobalPos();
                    m_ParentWidget.Move(pos.X() - m_OrigX, pos.Y() - m_OrigY);
                }

            } else if (type == QEvent.TypeOf.MouseButtonRelease) {
                var mouseEvent = (QMouseEvent)evnt;
                if (m_Moving && mouseEvent.Button() == Qt.MouseButton.LeftButton) {
                    m_Moving = false;
                    m_ParentWidget.Cursor = new QCursor(Qt.CursorShape.ArrowCursor);
                }
            }

            return obj.EventFilter(obj, evnt);
        }
Example #2
0
 protected override void ChangeEvent(Qyoto.QEvent arg1)
 {
     if (arg1.type() == QEvent.TypeOf.ActivationChange)
     {
         if (this.IsActiveWindow && m_Tabs.CurrentWidget() != null)
         {
             m_Tabs.CurrentWidget().SetFocus();
         }
     }
 }
Example #3
0
 public new bool EventFilter(QObject obj, QEvent evnt)
 {
     if (evnt.type() == QEvent.TypeOf.KeyPress) {
         if (KeyEvent != null) {
             if (KeyEvent((QKeyEvent)evnt)) {
                 return true;
             }
         }
     }
     return obj.EventFilter(obj, evnt);
 }
Example #4
0
 public new bool EventFilter(Qyoto.QObject arg1, Qyoto.QEvent arg2)
 {
     if (arg2.type() == QEvent.TypeOf.HoverMove)
     {
         if (MouseMoved != null)
         {
             MouseMoved(this, EventArgs.Empty);
         }
     }
     else if (arg2.type() == QEvent.TypeOf.ContextMenu)
     {
         var mouseEvent = (QContextMenuEvent)arg2;
         this.Hide();
         if (RightClicked != null)
         {
             RightClicked(this.MapToGlobal(mouseEvent.Pos()));
         }
     }
     return(base.EventFilter(arg1, arg2));
 }
 public override bool Event(QEvent e)
 {
     if (e != null && e.type() == QEvent.TypeOf.User)
     {
         ThreadEvent my = e as ThreadEvent;
         if (e != null)
         {
             my.dele();
             my.handle.SynchronizedFree();                      // free the handle so the event can be collected
             return(true);
         }
     }
     return(false);
 }
Example #6
0
 public override bool Event(QEvent e)
 {
     if (e != null && e.type() == QEvent.TypeOf.User) {
         ThreadEvent my = e as ThreadEvent;
         if (e != null) {
             my.dele();
             my.handle.SynchronizedFree();  // free the handle so the event can be collected
             return true;
         }
     }
     return false;
 }
        protected new virtual bool EventFilter(QObject o, QEvent e)
        {
            MethodInfo eventHandler;
            if (!eventHandlers.TryGetValue(e.type(), out eventHandler)) {
                return false;
            }

            Object[] args = new Object[1];
            args[0] = e;
            eventHandler.Invoke(applet, args);
            return true;
        }