Esempio n. 1
0
 protected override void OnKeyUp(System.Windows.Forms.KeyEventArgs e)
 {
     if (Capture)
     {
         VariantMap eventData = new VariantMap();
         eventData.Set("Raw", new Variant((uint)e.KeyCode));
         eventData.Set("ScanCode", new Variant(e.KeyValue));
         eventData.Set("Key", new Variant(e.KeyValue));
         SendEvent("KeyUp", eventData);
     }
     else
     {
         base.OnKeyUp(e);
     }
 }
Esempio n. 2
0
        protected override void OnMouseWheel(System.Windows.Forms.MouseEventArgs e)
        {
            VariantMap eventData = new VariantMap();

            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                eventData.Set("Buttons", new UrhoBackend.Variant((int)0));
            }
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                eventData.Set("Buttons", new UrhoBackend.Variant((int)1));
            }
            if (e.Button == System.Windows.Forms.MouseButtons.Middle)
            {
                eventData.Set("Buttons", new UrhoBackend.Variant((int)2));
            }

            eventData.Set("Wheel", new Variant(e.Delta));
            SendEvent("MouseWheel", eventData);
            base.OnMouseWheel(e);
        }
Esempio n. 3
0
        public static void Fill(VariantMap map, VariantMapList values)
        {
            string[] varNames = Enum.GetNames(typeof(VariantType));
            foreach (VariantMapRecord rec in values)
            {
                Variant var     = new Variant();
                string  keyname = rec.Key;
                string  name    = varNames[(int)rec.Type];
                string  value   = rec.Value;

                var.FromString(varNames[(int)rec.Type], rec.Value);
                if (rec.Key != null)
                {
                    map.Set(rec.Key, var);
                }
                else
                {
                    map.Set(rec.ExplicitKey, var);
                }
            }
        }
Esempio n. 4
0
        protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
        {
            Capture = false;
            this.Unfocus();

            VariantMap eventData = new VariantMap();

            SendEvent("CaptureEnded", eventData);
            eventData.Set("Button", new Variant((int)e.Button));
            SendEvent("MouseButtonUp", eventData);

            base.OnMouseUp(e);
        }
Esempio n. 5
0
        protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            this.Focus();
            Capture        = true;
            lastPosition.x = e.X;
            lastPosition.y = e.Y;

            VariantMap eventData = new VariantMap();

            SendEvent("CaptureStarted", eventData);

            eventData.Set("Button", new Variant((int)e.Button));
            SendEvent("MouseButtonDown", eventData);

            base.OnMouseDown(e);
        }