public void Update() { foreach (UICommandElement element in _UIElements) { element.Update(); } if (DraggingController.GetInstance().IsDragging()) { Dispose(); } }
public void SetButtonState(InteractionState interactionState) { if (_interactionState == InteractionState.Dragging && interactionState == InteractionState.Released) { DraggingController.GetInstance().SetDraggingElement(null); } _interactionState = interactionState; if (_interactionState == InteractionState.Dragging) { DraggingController.GetInstance().SetDraggingElement(this); } }
public void Dispose() { bool isIntersecting = false; _nextPosition = _origin; UIUtils.SetWidgetPosition(_parent.GetCanvas(), _label, _nextPosition); _nextPosition.Y += incrementSection.Y; UICommandElement dragElement = DraggingController.GetInstance().GetDraggedElement(); foreach (UICommandElement element in _UIElements) { if (dragElement != null) { if (element == dragElement) { continue; } if (!isIntersecting && IsElementInsideTargetBoundaries(dragElement, _nextPosition)) { isIntersecting = true; _nextPosition.X += increment.X; if (_nextPosition.X > _boundaryX) { _nextPosition.X = _origin.X; _nextPosition.Y += increment.Y; } } } element.SetLocation(_nextPosition); _nextPosition.X += increment.X; if (_nextPosition.X > _boundaryX) { _nextPosition.X = _origin.X; _nextPosition.Y += increment.Y; } } _nextPosition.X = _origin.X; _nextPosition.Y += increment.Y; }
protected void OnTabButtonPressed(object o, ButtonPressEventArgs args) { if (args.Event.Button == 1) { DraggingController.GetInstance().ClearEvents(); DraggingController.GetInstance().OnDropEvent += OnDropUIElement; OnTabSelectedEvent?.Invoke(this); } else if (args.Event.Button == 3) { _mouseRightClickPoint = GetCanvasMousePos(); Gtk.Menu rightButtonMenu = new Gtk.Menu(); Gtk.MenuItem menuItem = null; menuItem = new Gtk.MenuItem("Delete tab page"); menuItem.ButtonReleaseEvent += OnDeleteTabPagePressed; rightButtonMenu.Append(menuItem); rightButtonMenu.ShowAll(); rightButtonMenu.Popup(); } }
public void InitDropEvent() { DraggingController.GetInstance().ClearEvents(); DraggingController.GetInstance().OnDropEvent += OnDropUIElement; }