Пример #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));
     }
 }
Пример #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));
         }
     }
 }
Пример #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;
        }
Пример #4
0
        protected override void OnMouseMove(MouseEventArgs args)
        {
            if (args.MouseMode == MouseMode.Captured)
            {
                position += args.GlobalPosition;
            }

            output.Text = position.ToString();

            base.OnMouseMove(args);
        }
Пример #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));
            }
        }
Пример #6
0
 /// <summary>
 /// Вызывает делегат входа мыши в контрол
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnMouseInput(MouseEventArgs e)
 {
     MouseInput?.Invoke(this, e);
     _isInputMouse = true;
     _isBlockedMouse = true;
 }
Пример #7
0
 protected override void OnLeftMouseUp(MouseEventArgs args)
 {
     if (dragging)
     {
         dragging = false;
         args.Handled = true;
     }
 }
Пример #8
0
 /// <summary>
 /// Вызывает делегат колесика
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnScrollDelta(MouseEventArgs e)
 {
     ScrollDelta?.Invoke(this, e);
     _isBlockedMouse = true;
 }
Пример #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;
 }
Пример #10
0
 private void ExitGameClicked(Control sender, MouseEventArgs args)
 {
     _game.Exit();
 }
Пример #11
0
        protected override void OnRightMouseDown(MouseEventArgs args)
        {
            if (!IsActiveScreen) return;

            Manager.Player.InteractInput = true;
            args.Handled = true;
        }
Пример #12
0
 protected virtual void OnMouseWheel(MouseEventArgs e)
 {
     var handler = MouseWheel;
     handler?.Invoke(this, e);
 }
Пример #13
0
 protected override void OnLeftMouseDown(MouseEventArgs args)
 {
     mouseClickActive = true;
 }
Пример #14
0
 protected override void OnLeftMouseUp(MouseEventArgs args)
 {
     mouseClickActive = false;
 }
Пример #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;
 }
Пример #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));
            }
        }
Пример #17
0
 /// <summary>
 /// Вызывает делегат движения мыши
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnMouseMove(MouseEventArgs e)
 {
     MouseMove?.Invoke(this, e);
     _isBlockedMouse = true;
 }
Пример #18
0
 private void Control_MouseUp(Control sender, MouseEventArgs e)
 {
     if (_isClick && Focused)
         Click?.Invoke(this, e);
     _isClick = false;
 }
Пример #19
0
 private void Control_MouseDown(Control sender, MouseEventArgs e)
 {
     Focused = true;
     _isClick = true;
 }
Пример #20
0
        protected override void OnLeftMouseDown(MouseEventArgs args)
        {
            if (!IsActiveScreen) return;

            Manager.Player.ApplyInput = true;
            args.Handled = true;
        }
Пример #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();
                 }
             }
         }
     }
 }
Пример #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;
            }
        }
Пример #23
0
 protected internal override void MouseDoubleClick(MouseEventArgs e)
 {
     MouseDown(e);
 }
Пример #24
0
 protected virtual void OnMouseDoubleClick(MouseEventArgs e)
 {
     var handler = MouseDoubleClick;
     handler?.Invoke(this, e);
 }
Пример #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();
        }
Пример #26
0
 private void Breturn_Click(object sender, MouseEventArgs e)
 {
     Game1.Instance.Scenes.Navigate("Harbor");
 }
Пример #27
0
 /// <summary>
 /// Вызывает делегат выхода мыши из контрола
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnMouseLeave(MouseEventArgs e)
 {
     MouseLeave?.Invoke(this, e);
     _isInputMouse = false;
 }
Пример #28
0
 private void NewGameClicked(Control sender, MouseEventArgs args)
 {
     NextState = new StateTransition(() => new GameState(_game, _squidInputManager));
 }
Пример #29
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (ReadOnly && e.Button == MouseButton.Left)
                btnDown_Click(this, new MouseEventArgs());
        }
Пример #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;
         }
     }
 }
Пример #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);
            }
        }
Пример #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;
     }
 }
Пример #33
0
 /// <summary>
 /// Вызывает делегат отпускания кнопки мыши
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnMouseUp(MouseEventArgs e)
 {
     MouseUp?.Invoke(this, e);
     _isBlockedMouse = true;
     _isMouseDown = false;
 }