コード例 #1
0
        /// <summary>
        ///     Menu Windows Process Messages callback.
        /// </summary>
        /// <param name="args"><see cref="WindowsKeys" /> data</param>
        public override void OnWndProc(WindowsKeys args)
        {
            this.Handler.OnWndProc(args);

            // Pass OnWndProc on to children
            foreach (var item in this.Components)
            {
                item.Value.OnWndProc(args);
            }
        }
コード例 #2
0
        /// <summary>
        ///     On Window Process Message event.
        /// </summary>
        /// <param name="args">
        ///     Event data
        /// </param>
        private void Game_OnWndProc(WndEventArgs args)
        {
            if (MenuGUI.IsChatOpen)
            {
                return;
            }

            var keys = new WindowsKeys(args);

            if (!this.ForcedOpen)
            {
                if (keys.SingleKey == MenuPressKeybind ||
                    (MenuPressKeybind == Keys.ShiftKey && keys.Key == (Keys.Return | Keys.Shift)))
                {
                    var keyDown = keys.Msg == WindowsMessages.KEYDOWN;
                    var keyUp   = keys.Msg == WindowsMessages.KEYUP || keys.Msg == WindowsMessages.CHAR;

                    if (keyDown)
                    {
                        if (!this.MenuVisible)
                        {
                            this.MenuVisible = true;
                            this.FireOnOpen();
                        }
                    }
                    else if (keyUp)
                    {
                        if (this.MenuVisible)
                        {
                            this.MenuVisible = false;
                            this.FireOnClose();
                        }
                    }
                }
                else if (keys.SingleKey == MenuToggleKeybind && keys.Msg == WindowsMessages.KEYDOWN)
                {
                    this.MenuVisible = !this.MenuVisible;

                    if (this.MenuVisible)
                    {
                        this.FireOnOpen();
                    }
                    else
                    {
                        this.FireOnClose();
                    }
                }
            }

            foreach (var component in this.Menus)
            {
                component.OnWndProc(keys);
            }
        }
コード例 #3
0
        /// <summary>
        ///     Boolean Item Windows Process Messages callback.
        /// </summary>
        /// <param name="args">WindowsKeys</param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (args.Msg == WindowsMessages.LBUTTONDOWN && Position.IsValid())
            {
                Rectangle rect = ThemeManager.Current.Boolean.AdditionalBoundries(Position, Container);

                if (args.Cursor.IsUnderRectangle(rect.X, rect.Y, rect.Width, rect.Height))
                {
                    Value = !Value;
                    FireEvent(this);
                }
            }
        }
コード例 #4
0
        /// <summary>
        ///     Gets the byte.
        /// </summary>
        /// <param name="args">
        ///     The windows keys.
        /// </param>
        /// <param name="rect">
        ///     The <see cref="Rectangle" />
        /// </param>
        /// <returns>
        ///     The byte.
        /// </returns>
        private static byte GetByte(WindowsKeys args, Rectangle rect)
        {
            if (args.Cursor.X < rect.X)
            {
                return(0);
            }

            if (args.Cursor.X > rect.X + rect.Width)
            {
                return(255);
            }

            return((byte)(((args.Cursor.X - rect.X) / rect.Width) * 255));
        }
コード例 #5
0
        /// <summary>
        ///     On windows process messages callback.
        /// </summary>
        /// <param name="keys">Converted windowskeys</param>
        public override void OnWndProc(WindowsKeys keys)
        {
            if (!Flags.HasFlag(NotificationFlags.WPM))
            {
                return;
            }

            if (Geometry.IsUnderRectangle(keys.Cursor, DrawPosition.X, DrawPosition.Y, Width, Height) && keys.Msg == WindowsMessages.LBUTTONUP)
            {
                if (Variables.TickCount - _lastClickTick <= 500)
                {
                    Dispose();
                }
                _lastClickTick = Variables.TickCount;
            }
        }
コード例 #6
0
        /// <summary>
        ///     Menu Windows Process Messages callback.
        /// </summary>
        /// <param name="args"></param>
        public override void OnWndProc(WindowsKeys args)
        {
            if ((MenuManager.Instance.MenuVisible && Parent == null) || Visible)
            {
                if (args.Cursor.IsUnderRectangle(Position.X, Position.Y, MenuWidth, DefaultSettings.ContainerHeight))
                {
                    Hovering = true;
                    if (args.Msg == WindowsMessages.LBUTTONDOWN && Components.Count > 0)
                    {
                        Toggled = !Toggled;

                        //Toggling siblings logic
                        if (Parent == null)
                        {
                            foreach (var rootComponent in MenuManager.Instance.Menus.Where(c => !c.Equals(this)))
                            {
                                rootComponent.Toggled = false;
                            }
                        }
                        else
                        {
                            foreach (var comp in Parent.Components.Where(comp => comp.Value.Name != Name))
                            {
                                comp.Value.Toggled = false;
                            }
                        }

                        return;
                    }
                }
                else
                {
                    Hovering = false;
                }

                //Pass OnWndProc on to children
                if (Toggled)
                {
                    foreach (var item in Components.Where(c => c.Value.Visible))
                    {
                        item.Value.OnWndProc(args);
                    }
                }
            }
        }
コード例 #7
0
        /// <summary>
        ///     Processes windows messages
        /// </summary>
        /// <param name="args">event data</param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (!this.Component.Visible)
            {
                return;
            }

            if (args.Msg == WindowsMessages.LBUTTONDOWN)
            {
                var rect = this.ButtonBoundaries(this.Component);

                if (args.Cursor.IsUnderRectangle(rect.X, rect.Y, rect.Width, rect.Height))
                {
                    this.Component.Value = !this.Component.Value;
                    this.Component.FireEvent();
                }
            }
        }
コード例 #8
0
ファイル: BlueMenu2.cs プロジェクト: chienhao10/TwLS.SDK
        /// <summary>
        ///     Processes windows messages
        /// </summary>
        /// <param name="args">
        ///     The event data
        /// </param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (this.Component.Visible)
            {
                if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging
                    && !MenuCustomizer.Instance.LockPosition.Value)
                {
                    MenuSettings.Position = new Vector2(args.Cursor.X - this.xd, args.Cursor.Y - this.yd);
                    this.hasDragged = true;
                }

                if (args.Cursor.IsUnderRectangle(
                    this.Component.Position.X,
                    this.Component.Position.Y,
                    this.Component.MenuWidth,
                    MenuSettings.ContainerHeight))
                {
                    if (args.Msg == WindowsMessages.LBUTTONDOWN && this.Component.Root)
                    {
                        var pos = MenuSettings.Position;
                        this.xd = args.Cursor.X - pos.X;
                        this.yd = args.Cursor.Y - pos.Y;
                        this.dragging = true;
                    }

                    this.hovering = true;
                    if (args.Msg == WindowsMessages.LBUTTONUP && !this.hasDragged)
                    {
                        this.Component.Toggle();
                    }
                }
                else
                {
                    this.hovering = false;
                }
            }

            if (args.Msg == WindowsMessages.LBUTTONUP)
            {
                this.hasDragged = false;
                this.dragging = false;
            }
        }
コード例 #9
0
        private void CalculateNewValue(WindowsKeys args)
        {
            var newValue =
                (int)
                System.Math.Round(
                    (MinValue + ((args.Cursor.X - Position.X) * (MaxValue - MinValue)) / Container.MenuWidth));

            if (newValue < MinValue)
            {
                newValue = MinValue;
            }
            else if (newValue > MaxValue)
            {
                newValue = MaxValue;
            }
            if (newValue != Value)
            {
                Value = newValue;
                FireEvent(this);
            }
        }
コード例 #10
0
        /// <summary>
        ///     Slider Windows Process Messages callback.
        /// </summary>
        /// <param name="args">
        ///     <see cref="WindowsKeys" />
        /// </param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (args.Msg == WindowsMessages.MOUSEMOVE && Interacting)
            {
                CalculateNewValue(args);
            }
            else if (args.Msg == WindowsMessages.LBUTTONDOWN && !Interacting)
            {
                Rectangle container = ThemeManager.Current.Slider.Bounding(Position, Container);

                if (args.Cursor.IsUnderRectangle(container.X, container.Y, container.Width, container.Height))
                {
                    Interacting = true;
                    CalculateNewValue(args);
                }
            }
            else if (args.Msg == WindowsMessages.LBUTTONUP)
            {
                Interacting = false;
            }
        }
コード例 #11
0
ファイル: LightButton.cs プロジェクト: wx8829110/WUYANZZZ
        /// <summary>
        ///     Processes windows events
        /// </summary>
        /// <param name="args">
        ///     The event data
        /// </param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (!this.Component.Visible)
            {
                return;
            }

            var rect = this.ButtonBoundaries(this.Component);

            if (args.Cursor.IsUnderRectangle(rect.X, rect.Y, rect.Width, rect.Height))
            {
                this.Component.Hovering = true;
                if (args.Msg == WindowsMessages.LBUTTONDOWN)
                {
                    this.Component.Action?.Invoke();
                }
            }
            else
            {
                this.Component.Hovering = false;
            }
        }
コード例 #12
0
        /// <summary>
        ///     Calculate the new value based onto the cursor position.
        /// </summary>
        /// <param name="component">menu component</param>
        /// <param name="args">
        ///     <see cref="WindowsKeys" /> data
        /// </param>
        private void CalculateNewValue(MenuSlider component, WindowsKeys args)
        {
            var newValue =
                (int)
                Math.Round(
                    component.MinValue
                    + ((args.Cursor.X - component.Position.X - Offset) * (component.MaxValue - component.MinValue))
                    / (component.MenuWidth - Offset * 2));
            if (newValue < component.MinValue)
            {
                newValue = component.MinValue;
            }
            else if (newValue > component.MaxValue)
            {
                newValue = component.MaxValue;
            }

            if (newValue != component.Value)
            {
                component.Value = newValue;
                component.FireEvent();
            }
        }
コード例 #13
0
        /// <summary>
        ///     Processes windows messages
        /// </summary>
        /// <param name="args">event data</param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (!this.Component.Visible)
            {
                return;
            }

            if (args.Msg == WindowsMessages.MOUSEMOVE && this.Component.Interacting)
            {
                this.CalculateNewValue(this.Component, args);
            }
            else if (args.Msg == WindowsMessages.LBUTTONDOWN)
            {
                var rect = this.ButtonBoundaries(this.Component);

                if (args.Cursor.IsUnderRectangle(rect.X, rect.Y, rect.Width, rect.Height))
                {
                    this.Component.BValue = !this.Component.BValue;
                    this.Component.FireEvent();
                }

                if (!this.Component.Interacting)
                {
                    var container = this.SliderBoundaries(this.Component);

                    if (args.Cursor.IsUnderRectangle(container.X, container.Y, container.Width, container.Height))
                    {
                        this.Component.Interacting = true;
                        this.CalculateNewValue(this.Component, args);
                    }
                }
            }
            else if (args.Msg == WindowsMessages.LBUTTONUP)
            {
                this.Component.Interacting = false;
            }
        }
コード例 #14
0
        /// <summary>
        ///     Calculate the new value based onto the cursor position.
        /// </summary>
        /// <param name="component">menu component</param>
        /// <param name="args">
        ///     <see cref="WindowsKeys" /> data
        /// </param>
        private void CalculateNewValue(MenuSliderButton component, WindowsKeys args)
        {
            var newValue =
                (int)
                Math.Round(
                    component.MinValue
                    + (((args.Cursor.X - component.Position.X) * (component.MaxValue - component.MinValue))
                       / (component.MenuWidth - MenuSettings.ContainerHeight)));

            if (newValue < component.MinValue)
            {
                newValue = component.MinValue;
            }
            else if (newValue > component.MaxValue)
            {
                newValue = component.MaxValue;
            }

            if (newValue != component.Value)
            {
                component.SValue = newValue;
                component.FireEvent();
            }
        }
コード例 #15
0
ファイル: ADrawable.cs プロジェクト: CjShu/LeagueSharp.SDKEx
 /// <summary>
 ///     Handles the window events for this <see cref="AMenuComponent" />.
 /// </summary>
 /// <param name="args">Event data</param>
 public abstract void OnWndProc(WindowsKeys args);
コード例 #16
0
ファイル: LightList2.cs プロジェクト: CjShu/LeagueSharp.SDKEx
        /// <summary>
        ///     Processes windows messages
        /// </summary>
        /// <param name="args">The event data</param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (!this.Component.Visible)
            {
                return;
            }

            var dropdownRect = this.DropDownBoundaries(this.Component);
            var entireDropdownRect = this.DropDownExpandedBoundaries(this.Component);

            if (args.Cursor.IsUnderRectangle(dropdownRect.X, dropdownRect.Y, dropdownRect.Width, dropdownRect.Height))
            {
                this.Component.Hovering = true;

                if (args.Msg == WindowsMessages.LBUTTONDOWN)
                {
                    this.Component.Active = !this.Component.Active;
                }
            }
            else
            {
                this.Component.Hovering = false;
            }

            const int Buffer = 20;
            if (this.Component.Active
                && !args.Cursor.IsUnderRectangle(
                    entireDropdownRect.X - Buffer,
                    entireDropdownRect.Y - Buffer,
                    entireDropdownRect.Width + (2 * Buffer),
                    entireDropdownRect.Height + (2 * Buffer)))
            {
                this.Component.Active = false;
            }

            if (this.Component.Active)
            {
                var found = false;
                var dropdownRectangles = this.DropDownListBoundaries(this.Component);
                for (var i = 0; i < dropdownRectangles.Count; i++)
                {
                    if (args.Cursor.IsUnderRectangle(
                        dropdownRectangles[i].X,
                        dropdownRectangles[i].Y,
                        dropdownRectangles[i].Width,
                        dropdownRectangles[i].Height))
                    {
                        this.Component.HoveringIndex = i;
                        found = true;
                    }
                }

                if (!found)
                {
                    this.Component.HoveringIndex = -1;
                }
                else if (args.Msg == WindowsMessages.LBUTTONDOWN)
                {
                    this.Component.Index = this.Component.HoveringIndex;
                    args.Process = false;
                }
            }
        }
コード例 #17
0
ファイル: MenuKeyBind.cs プロジェクト: CONANLXF/Berb.Common
 /// <summary>
 ///     KeyBind Item Windows Process Messages callback.
 /// </summary>
 /// <param name="args">
 ///     <see cref="WindowsKeys" /> data
 /// </param>
 public override void WndProc(WindowsKeys args)
 {
     // do nothing, we use the fast OnWndProc for keybinds
 }
コード例 #18
0
 /// <summary>
 ///     InputText Item Windows Process Messages callback.
 /// </summary>
 /// <param name="args">
 ///     <see cref="WindowsKeys" />
 /// </param>
 public override void OnWndProc(WindowsKeys args)
 {
     if (!MenuGUI.IsChatOpen && args.Msg == WindowsMessages.LBUTTONDOWN)
     {
     }
 }
コード例 #19
0
        /// <summary>
        ///     Gets fired when the mouse is released and pressed before
        /// </summary>
        /// <param name="args">Keys</param>
        public void ColorBoxMouseUp(WindowsKeys args)
        {
            if (this.mDragging && args.Msg == WindowsMessages.LBUTTONUP && !this.mDisabled)
            {
                this.mDragging = false;
                var x = (int)args.Cursor.X - 2 - (int)this.mPos.X;
                var y = (int)args.Cursor.Y - 2 - (int)this.mPos.Y;

                if (x < 0)
                {
                    x = 0;
                }
                if (x > (this.mWidth - 4))
                {
                    x = (this.mWidth - 4);
                }

                if (y < 0)
                {
                    y = 0;
                }
                if (y > (this.mHeight - 4))
                {
                    y = (this.mHeight - 4);
                }

                this.mMarkerX = x;
                this.mMarkerY = y;

                this.DrawMarker(x, y, true);
                // Redraw the marker
                this.ResetHslrgb();
                // Reset the color

                this.ColorBoxScrolled?.Invoke();
            }
        }
コード例 #20
0
ファイル: Hotkey.cs プロジェクト: Xicy/HotKey-Services
 [DllImport("user32.dll", SetLastError = true, EntryPoint = "keybd_event"), SuppressUnmanagedCodeSecurity] private static extern void KeyboardEvent(WindowsKeys key, byte scan, int flags, int extraInfo);
コード例 #21
0
        /// <summary>
        ///     Processes windows events
        /// </summary>
        /// <param name="args">
        ///     The event data
        /// </param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (!this.Component.Visible)
            {
                return;
            }

            var previewRect = PreviewBoundaries(this.Component);

            if (args.Msg == WindowsMessages.MOUSEMOVE)
            {
                this.Component.HoveringPreview = args.Cursor.IsUnderRectangle(
                    previewRect.X,
                    previewRect.Y,
                    previewRect.Width,
                    previewRect.Height);

                if (this.Component.Active)
                {
                    if (this.InteractingColorBox)
                    {
                        this.colorBox.ColorBoxMouseMove(args);
                    }
                    else if (this.InteractingVerticalColorSlider)
                    {
                        this.verticalColorSlider.VerticalColorSlider_MouseMove(args);
                    }
                    else if (this.InteractingVerticalAlphaSlider)
                    {
                        this.verticalAlphaSlider.VerticalAlphaSlider_MouseMove(args);
                    }
                }
            }

            if (args.Msg == WindowsMessages.LBUTTONUP)
            {
                if (this.InteractingColorBox)
                {
                    this.InteractingColorBox = false;
                    this.colorBox.ColorBoxMouseUp(args);
                }
                if (this.InteractingVerticalColorSlider)
                {
                    this.InteractingVerticalColorSlider = false;
                    this.verticalColorSlider.VerticalColorSlider_MouseUp(args);
                }
                if (this.InteractingVerticalAlphaSlider)
                {
                    this.InteractingVerticalAlphaSlider = false;
                    this.verticalAlphaSlider.VerticalAlphaSlider_MouseUp(args);
                }
            }

            if (args.Msg == WindowsMessages.LBUTTONDOWN)
            {
                if (args.Cursor.IsUnderRectangle(
                        this.ColorPickerBoundaries().X,
                        this.ColorPickerBoundaries().Y,
                        this.ColorPickerBoundaries().Width,
                        this.ColorPickerBoundaries().Height))
                {
                    this.Component.Active = true;
                    if (args.Cursor.IsUnderRectangle(
                            this.ColorBoxBoundaries().X,
                            this.ColorBoxBoundaries().Y,
                            this.ColorBoxBoundaries().Width,
                            this.ColorBoxBoundaries().Height))
                    {
                        this.InteractingColorBox = true;
                        this.colorBox.ColorBoxMouseDown(args);
                    }
                    else if (args.Cursor.IsUnderRectangle(
                                 this.VerticalColorSliderBoundaries().X,
                                 this.VerticalColorSliderBoundaries().Y,
                                 this.VerticalColorSliderBoundaries().Width,
                                 this.VerticalColorSliderBoundaries().Height))
                    {
                        this.InteractingVerticalColorSlider = true;
                        this.verticalColorSlider.VerticalColorSlider_MouseDown(args);
                    }
                    else if (args.Cursor.IsUnderRectangle(
                                 this.VerticalAlphaSliderBoundaries().X,
                                 this.VerticalAlphaSliderBoundaries().Y,
                                 this.VerticalAlphaSliderBoundaries().Width,
                                 this.VerticalAlphaSliderBoundaries().Height))
                    {
                        this.InteractingVerticalAlphaSlider = true;
                        this.verticalAlphaSlider.VerticalAlphaSlider_MouseDown(args);
                    }
                    else if (args.Cursor.IsUnderRectangle(
                                 this.ApplyButtonBoundaries().X,
                                 this.ApplyButtonBoundaries().Y,
                                 this.ApplyButtonBoundaries().Width,
                                 this.ApplyButtonBoundaries().Height))
                    {
                        this.Component.Active = false;
                        this.Component.Color  = this.colorBox.Rgb.ToSharpDxColor();
                    }
                    else if (args.Cursor.IsUnderRectangle(
                                 this.CancelButtonBoundaries().X,
                                 this.CancelButtonBoundaries().Y,
                                 this.CancelButtonBoundaries().Width,
                                 this.CancelButtonBoundaries().Height))
                    {
                        this.Component.Active        = false;
                        this.colorBox.Rgb            = this.Component.Color.ToSystemColor();
                        this.verticalColorSlider.Rgb = this.Component.Color.ToSystemColor();
                        this.verticalAlphaSlider.Rgb = this.Component.Color.ToSystemColor();
                    }
                }
                else if (args.Cursor.IsUnderRectangle(
                             previewRect.X,
                             previewRect.Y,
                             previewRect.Width,
                             previewRect.Height))
                {
                    this.Component.Active = true;
                }
                else
                {
                    this.Component.Active = false;
                }
            }
        }
コード例 #22
0
 /// <summary>
 ///     KeyBind Item Windows Process Messages callback.
 /// </summary>
 /// <param name="args">
 ///     <see cref="WindowsKeys" /> data
 /// </param>
 public override void WndProc(WindowsKeys args)
 {
     // do nothing, we use the fast OnWndProc for keybinds
 }
コード例 #23
0
 /// <summary>
 ///     <c>OnWndProc</c> event, occurs on a windows process message to the thread.
 /// </summary>
 /// <param name="basePosition">
 ///     The base position
 /// </param>
 /// <param name="windowsKeys">
 ///     The windows keys
 /// </param>
 /// <param name="isEdit">
 ///     Indicates whether it's an edit message.
 /// </param>
 public abstract void OnWndProc(Vector2 basePosition, WindowsKeys windowsKeys, bool isEdit);
コード例 #24
0
        /// <summary>
        ///     Processes windows events
        /// </summary>
        /// <param name="args">
        ///     The event data
        /// </param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (!this.Component.Visible)
            {
                return;
            }

            var previewRect = PreviewBoundaries(this.Component);

            if (args.Msg == WindowsMessages.MOUSEMOVE)
            {
                this.Component.HoveringPreview = args.Cursor.IsUnderRectangle(
                    previewRect.X,
                    previewRect.Y,
                    previewRect.Width,
                    previewRect.Height);

                if (this.Component.Active)
                {
                    if (this.InteractingColorBox)
                    {
                        this.colorBox.ColorBoxMouseMove(args);
                    }
                    else if (this.InteractingVerticalColorSlider)
                    {
                        this.verticalColorSlider.VerticalColorSliderMouseMove(args);
                    }
                    else if (this.InteractingVerticalAlphaSlider)
                    {
                        this.verticalAlphaSlider.VerticalAlphaSliderMouseMove(args);
                    }
                }
            }

            if (args.Msg == WindowsMessages.LBUTTONUP)
            {
                if (this.InteractingColorBox)
                {
                    this.InteractingColorBox = false;
                    this.colorBox.ColorBoxMouseUp(args);
                }
                if (this.InteractingVerticalColorSlider)
                {
                    this.InteractingVerticalColorSlider = false;
                    this.verticalColorSlider.VerticalColorSliderMouseUp(args);
                }
                if (this.InteractingVerticalAlphaSlider)
                {
                    this.InteractingVerticalAlphaSlider = false;
                    this.verticalAlphaSlider.VerticalAlphaSliderMouseUp(args);
                }
            }

            if (args.Msg == WindowsMessages.LBUTTONDOWN)
            {
                if (args.Cursor.IsUnderRectangle(
                    this.ColorPickerBoundaries().X,
                    this.ColorPickerBoundaries().Y,
                    this.ColorPickerBoundaries().Width,
                    this.ColorPickerBoundaries().Height))
                {
                    this.Component.Active = true;
                    if (args.Cursor.IsUnderRectangle(
                        this.ColorBoxBoundaries().X,
                        this.ColorBoxBoundaries().Y,
                        this.ColorBoxBoundaries().Width,
                        this.ColorBoxBoundaries().Height))
                    {
                        this.InteractingColorBox = true;
                        this.colorBox.ColorBoxMouseDown(args);
                    }
                    else if (args.Cursor.IsUnderRectangle(
                        this.VerticalColorSliderBoundaries().X,
                        this.VerticalColorSliderBoundaries().Y,
                        this.VerticalColorSliderBoundaries().Width,
                        this.VerticalColorSliderBoundaries().Height))
                    {
                        this.InteractingVerticalColorSlider = true;
                        this.verticalColorSlider.VerticalColorSliderMouseDown(args);
                    }
                    else if (args.Cursor.IsUnderRectangle(
                        this.VerticalAlphaSliderBoundaries().X,
                        this.VerticalAlphaSliderBoundaries().Y,
                        this.VerticalAlphaSliderBoundaries().Width,
                        this.VerticalAlphaSliderBoundaries().Height))
                    {
                        this.InteractingVerticalAlphaSlider = true;
                        this.verticalAlphaSlider.VerticalAlphaSliderMouseDown(args);
                    }
                    else if (args.Cursor.IsUnderRectangle(
                        this.ApplyButtonBoundaries().X,
                        this.ApplyButtonBoundaries().Y,
                        this.ApplyButtonBoundaries().Width,
                        this.ApplyButtonBoundaries().Height))
                    {
                        this.Component.Active = false;
                        this.Component.Color = this.colorBox.Rgb.ToSharpDxColor();
                    }
                    else if (args.Cursor.IsUnderRectangle(
                        this.CancelButtonBoundaries().X,
                        this.CancelButtonBoundaries().Y,
                        this.CancelButtonBoundaries().Width,
                        this.CancelButtonBoundaries().Height))
                    {
                        this.Component.Active = false;
                        this.colorBox.Rgb = this.Component.Color.ToSystemColor();
                        this.verticalColorSlider.Rgb = this.Component.Color.ToSystemColor();
                        this.verticalAlphaSlider.Rgb = this.Component.Color.ToSystemColor();
                    }
                }
                else if (args.Cursor.IsUnderRectangle(
                    previewRect.X,
                    previewRect.Y,
                    previewRect.Width,
                    previewRect.Height))
                {
                    this.Component.Active = true;
                }
                else
                {
                    this.Component.Active = false;
                }
            }
        }
コード例 #25
0
        /// <summary>
        ///     Gets fired when the mouse is moved and pressed before
        /// </summary>
        /// <param name="args">Keys</param>
        public void VerticalColorSliderMouseMove(WindowsKeys args)
        {
            if (this.mDragging && args.Msg == WindowsMessages.MOUSEMOVE && !this.mDisabled)
            {
                var y = (int)args.Cursor.Y - (int)this.Position.Y;
                y -= 4;
                if (y < 0)
                {
                    y = 0;
                }
                if (y > (this.mHeight - 9))
                {
                    y = (this.mHeight - 9);
                }

                this.ArrowPos = y;
                this.DrawSlider(y, false);
                this.ResetHslrgb();
                this.ColorSliderScroll?.Invoke();
            }
        }
コード例 #26
0
 /// <summary>
 ///     Handles the window events for this <see cref="AMenuComponent" />.
 /// </summary>
 /// <param name="args">Event data</param>
 public override void OnWndProc(WindowsKeys args)
 {
     // Do nothing.
 }
コード例 #27
0
 /// <summary>
 ///     <c>OnWndProc</c> event, occurs on a windows process message to the thread.
 /// </summary>
 /// <param name="basePosition">
 ///     The base position
 /// </param>
 /// <param name="windowsKeys">
 ///     The windows keys
 /// </param>
 /// <param name="isEdit">
 ///     Indicates whether it's an edit message.
 /// </param>
 public abstract void OnWndProc(Vector2 basePosition, WindowsKeys windowsKeys, bool isEdit);
コード例 #28
0
ファイル: ColoredList.cs プロジェクト: chienhao10/TwLS.SDK
        /// <summary>
        ///     Processes windows messages
        /// </summary>
        /// <param name="args">The event data</param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (!this.Component.Visible)
            {
                return;
            }

            var dropdownRect       = this.DropDownBoundaries(this.Component);
            var entireDropdownRect = this.DropDownExpandedBoundaries(this.Component);

            if (args.Cursor.IsUnderRectangle(dropdownRect.X, dropdownRect.Y, dropdownRect.Width, dropdownRect.Height))
            {
                this.Component.Hovering = true;

                if (args.Msg == WindowsMessages.LBUTTONDOWN)
                {
                    this.Component.Active = !this.Component.Active;
                }
            }
            else
            {
                this.Component.Hovering = false;
            }

            const int Buffer = 20;

            if (this.Component.Active &&
                !args.Cursor.IsUnderRectangle(
                    entireDropdownRect.X - Buffer,
                    entireDropdownRect.Y - Buffer,
                    entireDropdownRect.Width + (2 * Buffer),
                    entireDropdownRect.Height + (2 * Buffer)))
            {
                this.Component.Active = false;
            }

            if (this.Component.Active)
            {
                var found = false;
                var dropdownRectangles = this.DropDownListBoundaries(this.Component);
                for (var i = 0; i < dropdownRectangles.Count; i++)
                {
                    if (args.Cursor.IsUnderRectangle(
                            dropdownRectangles[i].X,
                            dropdownRectangles[i].Y,
                            dropdownRectangles[i].Width,
                            dropdownRectangles[i].Height))
                    {
                        this.Component.HoveringIndex = i;
                        found = true;
                    }
                }

                if (!found)
                {
                    this.Component.HoveringIndex = -1;
                }
                else if (args.Msg == WindowsMessages.LBUTTONDOWN)
                {
                    this.Component.Index = this.Component.HoveringIndex;
                    args.Process         = false;
                }
            }
        }
コード例 #29
0
 /// <summary>
 ///     Windows Process Messages callback.
 /// </summary>
 /// <param name="args"><see cref="WindowsKeys" /> data</param>
 public abstract void WndProc(WindowsKeys args);
コード例 #30
0
        /// <summary>
        ///     Processes windows events
        /// </summary>
        /// <param name="args">
        ///     The event data
        /// </param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (!this.Component.Visible)
            {
                return;
            }

            var previewRect = PreviewBoundaries(this.Component);
            var pickerRect  = this.PickerBoundaries();
            var redRect     = this.RedPickerBoundaries();
            var greenRect   = this.GreenPickerBoundaries();
            var blueRect    = this.BluePickerBoundaries();
            var alphaRect   = this.AlphaPickerBoundaries();

            if (args.Msg == WindowsMessages.MOUSEMOVE)
            {
                this.Component.HoveringPreview = args.Cursor.IsUnderRectangle(
                    previewRect.X,
                    previewRect.Y,
                    previewRect.Width,
                    previewRect.Height);

                if (this.Component.Active)
                {
                    if (this.Component.InteractingRed)
                    {
                        UpdateRed(this.Component, args, redRect);
                    }
                    else if (this.Component.InteractingGreen)
                    {
                        UpdateGreen(this.Component, args, greenRect);
                    }
                    else if (this.Component.InteractingBlue)
                    {
                        UpdateBlue(this.Component, args, blueRect);
                    }
                    else if (this.Component.InteractingAlpha)
                    {
                        UpdateAlpha(this.Component, args, alphaRect);
                    }
                }
            }

            if (args.Msg == WindowsMessages.LBUTTONUP)
            {
                this.Component.InteractingRed   = false;
                this.Component.InteractingGreen = false;
                this.Component.InteractingBlue  = false;
                this.Component.InteractingAlpha = false;
            }

            if (args.Msg == WindowsMessages.LBUTTONDOWN)
            {
                if (args.Cursor.IsUnderRectangle(previewRect.X, previewRect.Y, previewRect.Width, previewRect.Height))
                {
                    this.Component.Active = true;
                }
                else if (args.Cursor.IsUnderRectangle(pickerRect.X, pickerRect.Y, pickerRect.Width, pickerRect.Height) &&
                         this.Component.Active)
                {
                    if (args.Cursor.IsUnderRectangle(redRect.X, redRect.Y, redRect.Width, redRect.Height))
                    {
                        this.Component.InteractingRed = true;
                        UpdateRed(this.Component, args, redRect);
                    }
                    else if (args.Cursor.IsUnderRectangle(
                                 greenRect.X,
                                 greenRect.Y,
                                 greenRect.Width,
                                 greenRect.Height))
                    {
                        this.Component.InteractingGreen = true;
                        UpdateGreen(this.Component, args, greenRect);
                    }
                    else if (args.Cursor.IsUnderRectangle(
                                 blueRect.X,
                                 blueRect.Y,
                                 blueRect.Width,
                                 blueRect.Height))
                    {
                        this.Component.InteractingBlue = true;
                        UpdateBlue(this.Component, args, blueRect);
                    }
                    else if (args.Cursor.IsUnderRectangle(
                                 alphaRect.X,
                                 alphaRect.Y,
                                 alphaRect.Width,
                                 alphaRect.Height))
                    {
                        this.Component.InteractingAlpha = true;
                        UpdateAlpha(this.Component, args, alphaRect);
                    }
                }
                else
                {
                    this.Component.Active = false;
                }
            }
        }
コード例 #31
0
        /// <summary>
        ///     <c>OnWndProc</c> event.
        /// </summary>
        /// <param name="args">
        ///     The event data.
        /// </param>
        private static void OnWndProc(WndEventArgs args)
        {
            var windowsKeys = new WindowsKeys(args);
            var height = Position.Y;
            var edit = Menu["edit"].GetValue<MenuBool>().Value;

            foreach (var notification in NotificationsList.ToArray())
            {
                notification.OnWndProc(new Vector2(Position.X, height), windowsKeys, edit);
                height += notification.GetReservedHeight();
            }

            var notificationW = NotificationsList.MaxOrDefault(n => n.GetReservedWidth());
            var widthRectangle = notificationW?.GetReservedWidth() ?? 300f;
            if (windowsKeys.Msg == WindowsMessages.LBUTTONDOWN || windowsKeys.Msg == WindowsMessages.LBUTTONUP)
            {
                var heightRectangle =
                    NotificationsList.Where((t, i) => i < NotificationsList.Count).Sum(t => t.GetReservedHeight());
                if (Math.Abs(heightRectangle) < float.Epsilon)
                {
                    heightRectangle = 30f;
                }

                var value = windowsKeys.Msg == WindowsMessages.LBUTTONDOWN;

                EditButtonDown = value
                                 && windowsKeys.Cursor.IsUnderRectangle(
                                     Position.X - widthRectangle,
                                     Position.Y,
                                     widthRectangle,
                                     heightRectangle);

                if (!value)
                {
                    MouseLocation = null;
                    MouseOffsetX = 0f;
                }
            }

            if (edit && EditButtonDown)
            {
                if (MouseLocation.HasValue)
                {
                    Position += MouseLocation.Value - Position;
                    Position = new Vector2(Position.X + MouseOffsetX, Position.Y + MouseOffsetY);
                }
                else
                {
                    MouseOffsetX = Position.X - windowsKeys.Cursor.X;
                    MouseOffsetY = Position.Y - windowsKeys.Cursor.Y;
                }

                MouseLocation = windowsKeys.Cursor;
            }
        }
コード例 #32
0
ファイル: BlueKeyBind.cs プロジェクト: Muse30/EloBuddy-1
        /// <summary>
        ///     Processes windows messages
        /// </summary>
        /// <param name="args">event data</param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (!MenuGUI.IsChatOpen)
            {
                switch (args.Msg)
                {
                case WindowsMessages.KEYDOWN:
                    HandleDown(this.Component, args.Key);
                    break;

                case WindowsMessages.KEYUP:
                    if (this.Component.Interacting && args.SingleKey != Keys.ShiftKey)
                    {
                        ChangeKey(this.Component, args.SingleKey == Keys.Escape ? Keys.None : args.Key);
                    }
                    else
                    {
                        HandleUp(this.Component, args.Key);
                    }

                    break;

                case WindowsMessages.XBUTTONDOWN:
                    HandleDown(this.Component, args.SideButton);
                    break;

                case WindowsMessages.XBUTTONUP:
                    if (this.Component.Interacting)
                    {
                        ChangeKey(this.Component, args.SideButton);
                    }
                    else
                    {
                        HandleUp(this.Component, args.SideButton);
                    }

                    break;

                case WindowsMessages.MBUTTONDOWN:
                    HandleDown(this.Component, Keys.MButton);
                    break;

                case WindowsMessages.MBUTTONUP:
                    if (this.Component.Interacting)
                    {
                        ChangeKey(this.Component, Keys.MButton);
                    }
                    else
                    {
                        HandleUp(this.Component, Keys.MButton);
                    }

                    break;

                case WindowsMessages.RBUTTONDOWN:
                    HandleDown(this.Component, Keys.RButton);
                    break;

                case WindowsMessages.RBUTTONUP:
                    if (this.Component.Interacting)
                    {
                        ChangeKey(this.Component, Keys.RButton);
                    }
                    else
                    {
                        HandleUp(this.Component, Keys.RButton);
                    }

                    break;

                case WindowsMessages.LBUTTONDOWN:
                    if (this.Component.Interacting)
                    {
                        ChangeKey(this.Component, Keys.LButton);
                    }
                    else if (this.Component.Visible)
                    {
                        var container = this.ButtonBoundaries(this.Component);
                        var content   = this.KeyBindBoundaries(this.Component);

                        if (args.Cursor.IsUnderRectangle(
                                container.X,
                                container.Y,
                                container.Width,
                                container.Height))
                        {
                            this.Component.Active = !this.Component.Active;
                        }
                        else if (args.Cursor.IsUnderRectangle(content.X, content.Y, content.Width, content.Height))
                        {
                            this.Component.Interacting = !this.Component.Interacting;
                        }
                        else
                        {
                            HandleDown(this.Component, Keys.LButton);
                        }
                    }

                    break;

                case WindowsMessages.LBUTTONUP:
                    HandleUp(this.Component, Keys.LButton);
                    break;
                }
            }
        }
コード例 #33
0
        /// <summary>
        ///     On Window Process Message event.
        /// </summary>
        /// <param name="args">
        ///     Event data
        /// </param>
        private void Game_OnWndProc(WndEventArgs args)
        {
            if (MenuGUI.IsChatOpen)
            {
                return;
            }

            var keys = new WindowsKeys(args);

            if (!this.ForcedOpen)
            {
                if (keys.SingleKey == MenuPressKeybind
                    || (MenuPressKeybind == Keys.ShiftKey && keys.Key == (Keys.Return | Keys.Shift)))
                {
                    var keyDown = keys.Msg == WindowsMessages.KEYDOWN;
                    var keyUp = keys.Msg == WindowsMessages.KEYUP || keys.Msg == WindowsMessages.CHAR;

                    if (keyDown)
                    {
                        if (!this.MenuVisible)
                        {
                            this.MenuVisible = true;
                            this.FireOnOpen();
                        }
                    }
                    else if (keyUp)
                    {
                        if (this.MenuVisible)
                        {
                            this.MenuVisible = false;
                            this.FireOnClose();
                        }
                    }
                }
                else if (keys.SingleKey == MenuToggleKeybind && keys.Msg == WindowsMessages.KEYDOWN)
                {
                    this.MenuVisible = !this.MenuVisible;

                    if (this.MenuVisible)
                    {
                        this.FireOnOpen();
                    }
                    else
                    {
                        this.FireOnClose();
                    }
                }
            }

            foreach (var component in this.Menus)
            {
                component.OnWndProc(keys);
            }
        }
コード例 #34
0
        /// <summary>
        ///     Gets fired when the mouse is released and pressed before
        /// </summary>
        /// <param name="args">Keys</param>
        public void VerticalAlphaSliderMouseUp(WindowsKeys args)
        {
            if (this.mBDragging && args.Msg == WindowsMessages.LBUTTONUP && !this.mDisabled)
            {
                this.mBDragging = false;

                var y = (int)args.Cursor.Y - (int)this.Position.Y;
                y -= 4;
                if (y < 0)
                {
                    y = 0;
                }
                if (y > (this.mHeight - 9))
                {
                    y = (this.mHeight - 9);
                }

                this.ArrowPos = y;
                this.DrawSlider(y, false);
                this.ResetHslrgb();
                this.AlphaSliderScroll?.Invoke();
            }
        }
コード例 #35
0
 /// <summary>
 ///     Windows Process Messages callback.
 /// </summary>
 /// <param name="args"><see cref="WindowsKeys" /> data</param>
 public override void WndProc(WindowsKeys args)
 {
     this.Handler.OnWndProc(args);
 }
コード例 #36
0
 /// <summary>
 ///     Processes windows messages
 /// </summary>
 /// <param name="args">
 ///     The event data
 /// </param>
 public override void OnWndProc(WindowsKeys args)
 {
     // Do nothing.
 }
コード例 #37
0
 /// <summary>
 ///     Slider Windows Process Messages callback.
 /// </summary>
 /// <param name="args">
 ///     <see cref="WindowsKeys" /> data
 /// </param>
 public override void WndProc(WindowsKeys args)
 {
     this.Handler.OnWndProc(args);
 }
コード例 #38
0
ファイル: Hotkey.cs プロジェクト: Xicy/HotKey-Services
 public static void KeyPress(WindowsKeys key)
 {
     KeyDown(key);
     KeyUp(key);
 }
コード例 #39
0
ファイル: Hotkey.cs プロジェクト: Xicy/HotKey-Services
        /* TODO: Add Error Codes
         * https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx
         */

        #region Dll Imports
        [DllImport("user32.dll", SetLastError = true, EntryPoint = "RegisterHotKey"), SuppressUnmanagedCodeSecurity] private static extern int RegisterHotKey(IntPtr hwnd, NativeKey id, ModifierKeys fsModifiers, WindowsKeys vk);
コード例 #40
0
ファイル: LightMenu2.cs プロジェクト: CjShu/LeagueSharp.SDKEx
        /// <summary>
        ///     Processes windows messages
        /// </summary>
        /// <param name="args">
        ///     The event data
        /// </param>
        public override void OnWndProc(WindowsKeys args)
        {
            if (this.Component.Visible)
            {
                if (args.Msg == WindowsMessages.MOUSEMOVE && this.dragging
                    && !MenuCustomizer.Instance.LockPosition.Value)
                {
                    MenuSettings.Position = new Vector2(args.Cursor.X - this.xd, args.Cursor.Y - this.yd);
                    this.hasDragged = true;
                }

                if (args.Cursor.IsUnderRectangle(
                    this.Component.Position.X,
                    this.Component.Position.Y,
                    this.Component.MenuWidth,
                    MenuSettings.ContainerHeight))
                {
                    if (args.Msg == WindowsMessages.LBUTTONDOWN && this.Component.Root)
                    {
                        var pos = MenuSettings.Position;
                        this.xd = args.Cursor.X - pos.X;
                        this.yd = args.Cursor.Y - pos.Y;
                        this.dragging = true;
                    }

                    this.hovering = true;
                    if (args.Msg == WindowsMessages.LBUTTONUP && !this.hasDragged)
                    {
                        this.Component.Toggle();
                    }
                }
                else
                {
                    this.hovering = false;
                }
            }

            if (args.Msg == WindowsMessages.LBUTTONUP)
            {
                this.hasDragged = false;
                this.dragging = false;
            }
        }
コード例 #41
0
        /// <summary>
        ///     <c>OnWndProc</c> event, occurs on a windows process message to the thread.
        /// </summary>
        /// <param name="basePosition">
        ///     The base position
        /// </param>
        /// <param name="windowsKeys">
        ///     The windows keys
        /// </param>
        /// <param name="isEdit">
        ///     Indicates whether it's an edit message.
        /// </param>
        public override void OnWndProc(Vector2 basePosition, WindowsKeys windowsKeys, bool isEdit)
        {
            basePosition.X += this.hideOffsetX;

            if (!isEdit)
            {
                if (windowsKeys.Msg == WindowsMessages.LBUTTONDOWN
                    && windowsKeys.Cursor.IsUnderRectangle(
                        basePosition.X - this.Width - 5,
                        basePosition.Y,
                        this.Width,
                        this.HeaderHeight))
                {
                    windowsKeys.Process = false;
                    this.IsOpen = !this.IsOpen;
                }

                if (windowsKeys.Msg == WindowsMessages.LBUTTONDOWN
                    && windowsKeys.Cursor.IsUnderRectangle(
                        basePosition.X - this.Width + 5f,
                        basePosition.Y + this.HeaderHeight + this.BodyHeight + 1.5f,
                        HideBitmap.Width - 3,
                        HideBitmap.Height * 0.7f) && this.DrawBodyHeight >= this.BodyHeight
                    && this.DrawFooterHeight >= this.FooterHeight)
                {
                    windowsKeys.Process = false;
                    this.hideAnimation = !this.hideAnimation;
                }
            }
        }
コード例 #42
0
 /// <summary>
 ///     On windows process messages callback.
 /// </summary>
 /// <param name="keys">Converted windowskeys</param>
 public abstract void OnWndProc(WindowsKeys keys);
コード例 #43
0
 /// <summary>
 /// Windows Process Messages callback.
 /// </summary>
 /// <param name="args"></param>
 public override void OnWndProc(WindowsKeys args)
 {
     // not needed
 }
コード例 #44
0
ファイル: Hotkey.cs プロジェクト: Xicy/HotKey-Services
 public static void KeyUp(WindowsKeys key)
 {
     KeyboardEvent(key, 0, 0x2, 0);
 }