예제 #1
0
        /// <inheritdoc />
        public override bool OnMouseUp(Vector2 location, MouseButton buttons)
        {
            if (base.OnMouseUp(location, buttons))
            {
                return(true);
            }

            // Check if mouse was pressing
            if (_isMouseDown)
            {
                // Clear flag
                _isMouseDown = false;

                // Close topmost context menu
                ParentContextMenu?.TopmostCM.Hide();

                // Auto check logic
                if (AutoCheck)
                {
                    Checked = !Checked;
                }

                // Fire event
                Clicked?.Invoke();
                ButtonClicked?.Invoke(this);
                ParentContextMenu?.OnButtonClicked(this);

                // Event handled
                return(true);
            }

            return(false);
        }
예제 #2
0
        /// <summary>
        /// Clicks this button.
        /// </summary>
        public void Click()
        {
            // Close topmost context menu
            ParentContextMenu?.TopmostCM.Hide();

            // Auto check logic
            if (AutoCheck)
            {
                Checked = !Checked;
            }

            // Fire event
            Clicked?.Invoke();
            ButtonClicked?.Invoke(this);
            ParentContextMenu?.OnButtonClicked(this);
        }