Beispiel #1
0
        //MOUSE MOVE event
        protected override bool OnMotionNotifyEvent(EventMotion evnt)
        {
            GcMouseEventArgs args = new GcMouseEventArgs(this, 0, 0, (int)evnt.X, (int)evnt.Y, MouseButton.None);

            if (MouseMove != null)
            {
                MouseMove(this, args);
            }
            return(base.OnMotionNotifyEvent(evnt));
        }
Beispiel #2
0
        //MOUSE WHEEL
        protected override bool OnScrollEvent(EventScroll evnt)
        {
            //daca este inainte este pozitiva, daca este inapoi este negativa valoarea delta
            int delta = 120;

            if (evnt.Direction == ScrollDirection.Down)
            {
                delta = 0 - delta;
            }
            GcMouseEventArgs args = new GcMouseEventArgs(this, 0, delta, (int)evnt.X, (int)evnt.Y, MouseButton.None);

            if (MouseWheel != null)
            {
                MouseWheel(this, args);
            }
            return(base.OnScrollEvent(evnt));
        }
Beispiel #3
0
        //MOUSE DOWN event
        protected override bool OnButtonPressEvent(EventButton evnt)
        {
            MouseButton btn = MouseButton.None;

            if (evnt.Button == 1)
            {
                btn = MouseButton.Left;
            }
            if (evnt.Button == 2)
            {
                btn = MouseButton.Middle;
            }
            if (evnt.Button == 3)
            {
                btn = MouseButton.Right;
            }
            GcMouseEventArgs args = new GcMouseEventArgs(this, 0, 0, (int)evnt.X, (int)evnt.Y, btn);

            if (MouseDown != null)
            {
                MouseDown(this, args);
            }

            //fa si clickurile si dublu-clickurile

            if (MouseDoubleClick != null && evnt.Type == EventType.TwoButtonPress)
            {
                args = new GcMouseEventArgs(this, 2, 0, (int)evnt.X, (int)evnt.Y, btn);
                MouseDoubleClick(this, args);
            }
            else if (MouseClick != null && evnt.Type == EventType.ButtonPress)
            {
                args = new GcMouseEventArgs(this, 1, 0, (int)evnt.X, (int)evnt.Y, btn);
                MouseClick(this, args);
            }

            return(base.OnButtonPressEvent(evnt));
        }
Beispiel #4
0
        //MOUSE UP event + MOUSE CLICK + MOUSE DBL CLICK
        protected override bool OnButtonReleaseEvent(EventButton evnt)
        {
            MouseButton btn = MouseButton.None;

            if (evnt.Button == 1)
            {
                btn = MouseButton.Left;
            }
            if (evnt.Button == 2)
            {
                btn = MouseButton.Middle;
            }
            if (evnt.Button == 3)
            {
                btn = MouseButton.Right;
            }
            GcMouseEventArgs args = new GcMouseEventArgs(this, 0, 0, (int)evnt.X, (int)evnt.Y, btn);

            if (MouseUp != null)
            {
                MouseUp(this, args);
            }
            return(base.OnButtonReleaseEvent(evnt));
        }
 protected virtual void OnGtkcontrol1MouseWheel(object sender, HollyLibrary.GcMouseEventArgs args)
 {
     HollyLibrary.GcMouseEventArgs a = args;
     Console.WriteLine("mouse wheel!" + a.Delta);
 }
 protected virtual void OnGtkcontrol1MouseDoubleClick(object sender, HollyLibrary.GcMouseEventArgs args)
 {
     HollyLibrary.GcMouseEventArgs a = args;
     Console.WriteLine("mouse dbl click!" + a.Button);
     gtkcontrol1.BackColor = GraphUtil.gdkColorFromWinForms(System.Drawing.Color.AliceBlue);
 }
 protected virtual void OnGtkcontrol1MouseClick(object sender, HollyLibrary.GcMouseEventArgs args)
 {
     HollyLibrary.GcMouseEventArgs a = args;
     Console.WriteLine("mouse click!" + a.Button);
 }
 protected virtual void OnGtkcontrol1MouseMove(object sender, HollyLibrary.GcMouseEventArgs args)
 {
     Console.WriteLine("mouse move!");
 }
 //MOUSE WHEEL
 protected override bool OnScrollEvent(EventScroll evnt)
 {
     //daca este inainte este pozitiva, daca este inapoi este negativa valoarea delta
     int delta = 120;
     if( evnt.Direction == ScrollDirection.Down ) delta = 0 - delta;
     GcMouseEventArgs args = new GcMouseEventArgs( this, 0, delta, (int)evnt.X, (int)evnt.Y, MouseButton.None );
     if( MouseWheel != null ) MouseWheel( this, args );
     return base.OnScrollEvent (evnt);
 }
 //MOUSE MOVE event
 protected override bool OnMotionNotifyEvent(EventMotion evnt)
 {
     GcMouseEventArgs args = new GcMouseEventArgs( this, 0, 0, (int)evnt.X, (int)evnt.Y, MouseButton.None );
     if( MouseMove != null ) MouseMove( this, args );
     return base.OnMotionNotifyEvent (evnt);
 }
 //MOUSE UP event + MOUSE CLICK + MOUSE DBL CLICK
 protected override bool OnButtonReleaseEvent(EventButton evnt)
 {
     MouseButton btn  = MouseButton.None;
     if( evnt.Button == 1 ) btn = MouseButton.Left;
     if( evnt.Button == 2 ) btn = MouseButton.Middle;
     if( evnt.Button == 3 ) btn = MouseButton.Right;
     GcMouseEventArgs args = new GcMouseEventArgs( this, 0, 0, (int)evnt.X, (int)evnt.Y, btn );
     if( MouseUp != null ) MouseUp( this, args );
     return base.OnButtonReleaseEvent (evnt);
 }
        //MOUSE DOWN event
        protected override bool OnButtonPressEvent(EventButton evnt)
        {
            MouseButton btn  = MouseButton.None;
            if( evnt.Button == 1 ) btn = MouseButton.Left;
            if( evnt.Button == 2 ) btn = MouseButton.Middle;
            if( evnt.Button == 3 ) btn = MouseButton.Right;
            GcMouseEventArgs args = new GcMouseEventArgs( this, 0, 0, (int)evnt.X, (int)evnt.Y, btn );
            if( MouseDown != null ) MouseDown( this, args );

            //fa si clickurile si dublu-clickurile

            if( MouseDoubleClick != null && evnt.Type == EventType.TwoButtonPress )
            {
                args = new GcMouseEventArgs( this, 2, 0, (int)evnt.X, (int)evnt.Y, btn );
                MouseDoubleClick( this, args );
            }
            else if( MouseClick != null && evnt.Type == EventType.ButtonPress)
            {
                args = new GcMouseEventArgs( this, 1, 0, (int)evnt.X, (int)evnt.Y, btn );
                MouseClick( this, args );
            }

            return base.OnButtonPressEvent (evnt);
        }