Example #1
0
 protected internal override void MouseUp(MouseEventArgs e)
 {
     _isPressed = false;
     lock (RenderRule) {
         RenderRule.SetTextCursor(
             new Point(
                 e.Location.X - RenderRule.Area.X,
                 e.Location.Y - RenderRule.Area.Y));
     }
 }
Example #2
0
 public override void mouseDown(object sender, MouseEventArgs e)
 {
     if (e.button_ == MouseButton.RIGHT)
     {
         GameEntity en = Locator.getComponentManager().pick(Locator.getShip().tiles, mouseTile_);
         if (en != null && en.tile != null && en.item != null && (en.spatial.w_translation - Locator.getPlayer().spatial.w_translation).Length() < interactRange)
         {
             changeState(new Removing(en));
         }
     }
 }
Example #3
0
        protected override void OnLeftMouseClick(MouseEventArgs args)
        {
            base.OnLeftMouseClick(args);

            EventArgs e = new EventArgs();
            OnExecuted(e);
            if (Executed != null)
                Executed(this, e);

            args.Handled = true;
        }
        protected override void OnMouseMove(MouseEventArgs args)
        {
            if (args.MouseMode == MouseMode.Captured)
            {
                position += args.GlobalPosition;
            }

            output.Text = position.ToString();

            base.OnMouseMove(args);
        }
Example #5
0
        protected internal override void MouseMove(MouseEventArgs e)
        {
            if (!_isPressed)
            {
                return;
            }

            lock (RenderRule) {
                RenderRule.SetTextCursor(
                    new Point(
                        e.Location.X - RenderRule.Area.X,
                        e.Location.Y - RenderRule.Area.Y));
            }
        }
Example #6
0
 /// <summary>
 /// Вызывает делегат входа мыши в контрол
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnMouseInput(MouseEventArgs e)
 {
     MouseInput?.Invoke(this, e);
     _isInputMouse = true;
     _isBlockedMouse = true;
 }
Example #7
0
 protected override void OnLeftMouseUp(MouseEventArgs args)
 {
     if (dragging)
     {
         dragging = false;
         args.Handled = true;
     }
 }
Example #8
0
 /// <summary>
 /// Вызывает делегат колесика
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnScrollDelta(MouseEventArgs e)
 {
     ScrollDelta?.Invoke(this, e);
     _isBlockedMouse = true;
 }
Example #9
0
 private void TextBox_MouseDown(Control sender, MouseEventArgs e)
 {
     Vector2 pos = e.Coord - DrawabledLocation;
     char ch;
     Vector2 sz = Vector2.Zero;
     int coretkaIndex = -1;
     for (int i = 0; i < Text.Length; i++)
     {
         ch = Text[i];
         sz += Font.MeasureString(ch.ToString());
         if (pos.X > sz.X) coretkaIndex = i;
         if (pos.X < sz.X) break;
     }
     _positionCoretka = coretkaIndex + 1;
 }
Example #10
0
 private void ExitGameClicked(Control sender, MouseEventArgs args)
 {
     _game.Exit();
 }
Example #11
0
        protected override void OnRightMouseDown(MouseEventArgs args)
        {
            if (!IsActiveScreen) return;

            Manager.Player.InteractInput = true;
            args.Handled = true;
        }
Example #12
0
 protected virtual void OnMouseWheel(MouseEventArgs e)
 {
     var handler = MouseWheel;
     handler?.Invoke(this, e);
 }
Example #13
0
 protected override void OnLeftMouseDown(MouseEventArgs args)
 {
     mouseClickActive = true;
 }
Example #14
0
 protected override void OnLeftMouseUp(MouseEventArgs args)
 {
     mouseClickActive = false;
 }
Example #15
0
 /// <summary>
 /// This method is called when the <see cref="GuiItem.Click"/> event is raised.
 /// </summary>
 /// <param name="sender"> The <see cref="GuiItem"/> that raised the event. </param>
 /// <param name="e"> The current <see cref="MouseState"/>. </param>
 protected void OnClick(object sender, MouseEventArgs e)
 {
     if (IsSliding(GetRotatedMouse(e.State))) sliding = true;
 }
Example #16
0
        /// <summary>
        /// This method is called when the <see cref="MouseDown"/> event is raised.
        /// </summary>
        /// <param name="sender"> The <see cref="GuiItem"/> that raised the event. </param>
        /// <param name="e"> The current <see cref="MouseState"/>. </param>
        protected void OnMouseDown(object sender, MouseEventArgs e)
        {
            Vector2 offset = SliderBarDimentions.Position() + Position - GetRotatedMouse(e.State);
            if (oldOffset == Vector2.Zero) oldOffset = offset;
            else if (offset != oldOffset)
            {
                Rectangle newDim = SliderBarDimentions.Add(new Vector2(-offset.X - (SliderBarDimentions.Width >> 1), 0));

                if (newDim.X + Position.X > Bounds.X && newDim.X + SliderBarDimentions.Width <= Bounds.Width) SliderBarDimentions = newDim;
                else if (newDim.X + Position.X > Bounds.X) SliderBarDimentions = new Rectangle(Bounds.Width - SliderBarDimentions.Width, 0, SliderBarDimentions.Width, SliderBarDimentions.Height);
                else SliderBarDimentions = new Rectangle(0, 0, SliderBarDimentions.Width, SliderBarDimentions.Height);

                oldOffset = offset;

                float ppp = 100f / Bounds.Width;
                bool overCenter = SliderBarDimentions.X * ppp >= 50;
                float percent = (SliderBarDimentions.X + (overCenter ? SliderBarDimentions.Width : 0)) * ppp;

                int old = Value;
                data.ChangeValue((int)percent);
                if (Value != old) ValueChanged.Invoke(this, new Args(old, Value));
            }
        }
Example #17
0
 /// <summary>
 /// Вызывает делегат движения мыши
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnMouseMove(MouseEventArgs e)
 {
     MouseMove?.Invoke(this, e);
     _isBlockedMouse = true;
 }
Example #18
0
 private void Control_MouseUp(Control sender, MouseEventArgs e)
 {
     if (_isClick && Focused)
         Click?.Invoke(this, e);
     _isClick = false;
 }
Example #19
0
 private void Control_MouseDown(Control sender, MouseEventArgs e)
 {
     Focused = true;
     _isClick = true;
 }
Example #20
0
        protected override void OnLeftMouseDown(MouseEventArgs args)
        {
            if (!IsActiveScreen) return;

            Manager.Player.ApplyInput = true;
            args.Handled = true;
        }
Example #21
0
 private void TextBox_Click(GuiItem sender, MouseEventArgs e)
 {
     if (AutoFocus)
     {
         for (int i = 0; i < tabs.Length; i++)
         {
             GuiItemCollection controlls = tabs[i].Value;
             for (int j = 0; j < controlls.Count; j++)
             {
                 TextBox txt;
                 if ((txt = controlls[j] as TextBox) != null)
                 {
                     txt.Focused = txt.Name == sender.Name;
                     txt.Refresh();
                 }
             }
         }
     }
 }
Example #22
0
        protected override void OnMouseMove(MouseEventArgs args)
        {
            if (!IsActiveScreen) return;

            if (args.MouseMode == MouseMode.Captured && IsActiveScreen)
            {
                Manager.Player.HeadInput = args.GlobalPosition.ToVector2() * mouseSpeed * new Vector2(1f, -1f);
                args.Handled = true;
            }
        }
Example #23
0
 protected internal override void MouseDoubleClick(MouseEventArgs e)
 {
     MouseDown(e);
 }
Example #24
0
 protected virtual void OnMouseDoubleClick(MouseEventArgs e)
 {
     var handler = MouseDoubleClick;
     handler?.Invoke(this, e);
 }
Example #25
0
        /// <summary>
        /// Констрктор для Базовой Инициализации
        /// </summary>
        /// <param name="window">Окно в котором будут Отображаться Контролы</param>
        internal static void ControlInicializer(IWindow window)
        {
            if (Graphics == null) Graphics = window.Graphics2D;
            if (Window == null) Window = window;

            _ticks = new TickEventArgs(Window, null);
            _mouseEventArgs = new MouseEventArgs();
            _keyEventArgs = new KeyEventArgs();
        }
Example #26
0
 private void Breturn_Click(object sender, MouseEventArgs e)
 {
     Game1.Instance.Scenes.Navigate("Harbor");
 }
Example #27
0
 /// <summary>
 /// Вызывает делегат выхода мыши из контрола
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnMouseLeave(MouseEventArgs e)
 {
     MouseLeave?.Invoke(this, e);
     _isInputMouse = false;
 }
Example #28
0
 private void NewGameClicked(Control sender, MouseEventArgs args)
 {
     NextState = new StateTransition(() => new GameState(_game, _squidInputManager));
 }
Example #29
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (ReadOnly && e.Button == MouseButton.Left)
                btnDown_Click(this, new MouseEventArgs());
        }
Example #30
0
 protected override void OnLeftMouseDown(MouseEventArgs args)
 {
     if (Orientation == Orientation.Horizontal)
     {
         if (args.LocalPosition.X > ActualSplitterPosition &&
             args.LocalPosition.X <= ActualSplitterPosition + SplitterSize)
         {
             dragging = true;
             args.Handled = true;
         }
     }
     else if (Orientation == Orientation.Vertical)
     {
         if (args.LocalPosition.Y > ActualSplitterPosition &&
             args.LocalPosition.Y <= ActualSplitterPosition + SplitterSize)
         {
             dragging = true;
             args.Handled = true;
         }
     }
 }
Example #31
0
        void Input_MouseDown(object sender, MouseEventArgs e)
        {
            if (ReadOnly &&
                (e.Position.X >= AbsoluteLeft &&
                 e.Position.X <= AbsoluteLeft + Width &&
                 e.Position.Y >= AbsoluteTop &&
                 e.Position.Y <= AbsoluteTop + Height)) return;

            if (lstCombo.Visible &&
               (e.Position.X < lstCombo.AbsoluteLeft ||
                e.Position.X > lstCombo.AbsoluteLeft + lstCombo.Width ||
                e.Position.Y < lstCombo.AbsoluteTop ||
                e.Position.Y > lstCombo.AbsoluteTop + lstCombo.Height) &&
               (e.Position.X < btnDown.AbsoluteLeft ||
                e.Position.X > btnDown.AbsoluteLeft + btnDown.Width ||
                e.Position.Y < btnDown.AbsoluteTop ||
                e.Position.Y > btnDown.AbsoluteTop + btnDown.Height))
            {
                //lstCombo.Visible = false;
                btnDown_Click(sender, e);
            }
        }
Example #32
0
 protected override void OnMouseMove(MouseEventArgs args)
 {
     if (dragging)
     {
         if (Orientation == Orientation.Horizontal)
             SplitterPosition = args.LocalPosition.X;
         else if (Orientation == Orientation.Vertical)
             SplitterPosition = args.LocalPosition.Y;
         args.Handled = true;
     }
 }
Example #33
0
 /// <summary>
 /// Вызывает делегат отпускания кнопки мыши
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnMouseUp(MouseEventArgs e)
 {
     MouseUp?.Invoke(this, e);
     _isBlockedMouse = true;
     _isMouseDown = false;
 }