Exemplo n.º 1
0
 /// <summary>
 /// Handle the mouse down event.
 /// </summary>
 /// <param name="e">Arguments of mouse down event.</param>
 /// <returns>True if event has been handled; Otherwise return false.</returns>
 public override bool OnMouseDown(CellMouseEventArgs e)
 {
     if (ContentBounds.Contains(e.RelativePosition))
     {
         IsPressed = true;
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        /// <inheritdoc/>
        protected override bool HitTest(UIControl control, Vector2F position)
        {
            // If control is the child and ClipContent is enabled, then the mouse must be within the
            // ContentBounds. (The child part that is outside the ContentBounds is invisible and cannot
            // be clicked.)
            if (control != null && control == Content && ClipContent)
            {
                return(ContentBounds.Contains(position));
            }

            return(base.HitTest(control, position));
        }
Exemplo n.º 3
0
 static void FitToChildren()
 {
     foreach (GameObject rootGameObject in Selection.gameObjects)
     {
         Bounds?boundsmaybe = ContentBounds.Box(rootGameObject);
         if (boundsmaybe.HasValue)
         {
             Bounds      bounds   = boundsmaybe.Value;
             BoxCollider collider = rootGameObject.GetComponent <BoxCollider>();
             if (collider == null)
             {
                 collider = rootGameObject.AddComponent(typeof(BoxCollider)) as BoxCollider;
             }
             collider.center    = bounds.center;
             collider.size      = bounds.size;
             collider.isTrigger = true;
         }
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Handle the mouse up event.
        /// </summary>
        /// <param name="e">Arguments of mouse up event.</param>
        /// <returns>True if event has been handled; Otherwise return false.</returns>
        public override bool OnMouseUp(CellMouseEventArgs e)
        {
            if (this.IsPressed)
            {
                this.IsPressed = false;

                if (ContentBounds.Contains(e.RelativePosition))
                {
                    this.ToggleCheckStatus();

                    this.RaiseClickEvent();
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Determine whether checkbox or outside area was clicked
        /// </summary>
        protected override void OnMouseUp(DataGridViewCellMouseEventArgs e)
        {
            base.OnMouseUp(e);

            if (e.X >= CheckBoxPosition.X && e.X <= CheckBoxPosition.X + CheckBoxSize.Width &&
                e.Y >= CheckBoxPosition.Y && e.Y <= CheckBoxPosition.Y + CheckBoxSize.Height)
            {
                if (Checked == true)
                {
                    Checked = false;
                }
                else
                {
                    Checked = true;
                }
                NotifyCheckBoxClicked();
            }
            else if (ContentBounds.Contains(e.Location))
            {
                switch (SortGlyphDirection)
                {
                case SortOrder.Ascending:
                    SortGlyphDirection = SortOrder.Descending;
                    break;

                case SortOrder.Descending:
                    SortGlyphDirection = SortOrder.Ascending;
                    break;

                case SortOrder.None:
                    SortGlyphDirection = SortOrder.Descending;
                    break;
                }
                NotifySortClicked(SortGlyphDirection);
            }
        }
Exemplo n.º 6
0
        public override void Update(UpdateContext context)
        {
            switch (State)
            {
            case DialogState.Init:
                State = DialogState.Open;
                break;

            case DialogState.Open:
                if (context.LeftButton == ButtonState.Pressed)
                {
                    if (!WasPressedOutside && !ContentBounds.Contains(context.CursorPosition.Value))
                    {
                        WasPressedOutside = true;
                    }
                }
                else if (WasPressedOutside)
                {
                    State = DialogState.Closing;
                }
                break;
            }
            base.Update(context);
        }
Exemplo n.º 7
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (RibbonInDesignMode)
            {
                #region DesignMode clicks
                if (ContentBounds.Contains(e.Location))
                {
                    if (ContentButtonsBounds.Contains(e.Location))
                    {
                        foreach (RibbonItem item in MenuItems)
                        {
                            if (item.Bounds.Contains(e.Location))
                            {
                                SelectOnDesigner(item);
                                break;
                            }
                        }
                    }
                    else if (ContentRecentItemsBounds.Contains(e.Location))
                    {
                        foreach (RibbonItem item in RecentItems)
                        {
                            if (item.Bounds.Contains(e.Location))
                            {
                                SelectOnDesigner(item);
                                break;
                            }
                        }
                    }
                }
                if (ButtonsGlyphBounds.Contains(e.Location))
                {
                    RibbonDesigner.Current.CreteOrbMenuItem(typeof(RibbonOrbMenuItem));
                }
                else if (ButtonsSeparatorGlyphBounds.Contains(e.Location))
                {
                    RibbonDesigner.Current.CreteOrbMenuItem(typeof(RibbonSeparator));
                }
                else if (RecentGlyphBounds.Contains(e.Location))
                {
                    RibbonDesigner.Current.CreteOrbRecentItem(typeof(RibbonOrbRecentItem));
                }
                else if (OptionGlyphBounds.Contains(e.Location))
                {
                    RibbonDesigner.Current.CreteOrbOptionItem(typeof(RibbonOrbOptionButton));
                }
                else
                {
                    foreach (RibbonItem item in OptionItems)
                    {
                        if (item.Bounds.Contains(e.Location))
                        {
                            SelectOnDesigner(item);
                            break;
                        }
                    }
                }
                #endregion
            }
        }
Exemplo n.º 8
0
 void Start()
 {
     shipBounds     = ContentBounds.Box(this.gameObject).Value;
     gameController = GameObject.FindWithTag("GameController")
                      .GetComponent <GameControllerScript>();
 }