Beispiel #1
0
        private void _treeList_OnSelect(UIActionEvent e, UIElement sender)
        {
            var list   = (UIBrowserTreeList)sender;
            var target = (BrowserTreeDisplayNode)list.SelectedElement;

            OnSelectionChange?.Invoke(new UIActionEvent(target.BindingElement, e.TimeStamp), this);
        }
Beispiel #2
0
        public static void Select(DocumentObject documentObject, bool silently = false)
        {
            if (currentObject == documentObject)
            {
                return;
            }

            currentObject = documentObject;

            if (!silently)
            {
                OnSelectionChange?.Invoke(documentObject);
            }

#if DEBUG
            // For Debug
            if (documentObject != null)
            {
                Console.WriteLine("Selected object : " + currentObject.Name);
            }
            else
            {
                Console.WriteLine("UnSelecting object");
            }
#endif
        }
 void UpdateSelected()
 {
     if (onSelectionChangeCallback != null)
     {
         onSelectionChangeCallback.Invoke(selected);
     }
 }
Beispiel #4
0
 public void ClearSelection()
 {
     foreach (NodeUi node in UiManager.GetNodes())
     {
         node.selected    = false;
         node.preSelected = false;
     }
     OnSelectionChange.Invoke(box.GetAllSelected());
 }
Beispiel #5
0
        protected override void OnMouseUp(MouseButtonEventArgs e)
        {
            base.OnMouseUp(e);

            if (isSelected)
            {
                isSelected = false;
            }

            if (Core.IsDragging)
            {
                if (isDragging)
                {
                    onMouseUpTimestamp = e.Timestamp & Int32.MaxValue;
                    isDragging         = false;
                    Debug.WriteLine("IsDragging = " + isDragging);
                    Cursor = cursorBefore;
                    Mouse.Capture(null);
                }
                Core.EndDrag();

                if (BoundsOfMap.HasValue && !BoundsOfMap.Value.Contains(Position))
                {
                    if (Core.LastLocationInBounds.HasValue)
                    {
                        Position = Core.LastLocationInBounds.Value;
                    }
                }
            }
            else
            {
                if (e.ChangedButton == DragButton)
                {
                    Core.mouseDown = GPoint.Empty;
                }

                if (!selectionEnd.IsEmpty && !selectionStart.IsEmpty)
                {
                    bool zoomtofit = false;

                    if (!SelectedArea.IsEmpty && Keyboard.Modifiers == ModifierKeys.Shift)
                    {
                        zoomtofit = SetZoomToFitRect(SelectedArea);
                    }

                    OnSelectionChange?.Invoke(SelectedArea, zoomtofit);
                }
                else
                {
                    InvalidateVisual();
                }
            }
        }
Beispiel #6
0
 public void ChangeSelection(PlanetNode node)
 {
     if (isCursorActive)
     {
         currentSelectedNode = node;
         if (OnSelectionChange != null)
         {
             OnSelectionChange.Invoke(node);
         }
         UpdateSelectionUI();
     }
 }
Beispiel #7
0
        /// <summary>
        /// If your item is within our list, we will set the current item to it.
        /// </summary>
        /// <param name="_itemInList"></param>
        public bool Select(T _itemInList)
        {
            if (!items.Contains(_itemInList))
            {
                Debug.LogWarning("Item not set! Unable to find the provided item.");
                return(false);
            }

            ChangeSelection(_itemInList);
            onSelectionChange?.Invoke(lastSelectedItem, currentItem);
            return(true);
        }
 public void OnClick(object sender, MouseButtonEventArgs e)
 {
     if (e.Button == MouseButton.Left)
     {
         _selectedObject = GetNearestObject(GetOnRaycast(GetVisibleObjects()));
         if (_selectedObject != null)
         {
             OnSelectionChange?.Invoke(this, new SelectObjectEventArgs()
             {
                 SelectedObject = _selectedObject
             });
         }
     }
 }
Beispiel #9
0
        private void changeSelection(PixControl obj)
        {
            if (DisableSelection)
            {
                return;
            }

            radios.ForEach(s => s.Active = false);
            var radio = obj as IndexedButton;

            radio.Active = true;
            Selection    = radios.IndexOf(radio);
            OnSelectionChange?.Invoke(this, new SelectionEventArgs(radio));
        }
Beispiel #10
0
        public override void UpdateSelf(GameTime gameTime)
        {
            base.UpdateSelf(gameTime);
            Browser.Position   = new Vector2(0, Navigator.Position.Y + Navigator.Height);
            Browser.Size       = new Vector2(0f, -(Navigator.Position.Y + Navigator.Height));
            Viewer.Position    = new Vector2(Browser.Width, Navigator.Position.Y + Navigator.Height);
            Viewer.Size        = new Vector2(0, -(Navigator.Position.Y + Navigator.Height));
            Inspecter.Position = new Vector2(Browser.Width, Viewer.Height + Navigator.Position.Y + Navigator.Height);
            var selected = (BrowserTreeDisplayNode)Browser.SelectedElement;
            var e        = (selected == null) ? null : selected.BindingElement;

            if (_lastFocusElement != e)
            {
                OnSelectionChange.Invoke(new UIActionEvent(e, gameTime.TotalGameTime), this);
                _lastFocusElement = e;
            }
        }
Beispiel #11
0
 public void SelectionChanged(int id)
 {
     OnSelectionChange?.Invoke(id);
 }
Beispiel #12
0
 public void NotifySelectionChange()
 {
     OnSelectionChange.Invoke(new UIActionEvent(_lastFocusElement, Main._drawInterfaceGameTime.TotalGameTime), this);
 }
Beispiel #13
0
 /// <summary>
 /// Adds Listener to Selection-Event
 /// </summary>
 /// <param name="listener">Listener to Add</param>
 public void AddSelectionListener(OnSelectionChange listener)
 {
     selectionEvent += listener;
     // Set initial value
     listener.Invoke(selectedSpellIndex);
 }