Ejemplo n.º 1
0
 public MainApp()
 {
     _config            = new Config();
     _hostsController   = new HostsController();
     _availableCommands = new CommandsTable();
     DraggingController.CreateInstance();
 }
Ejemplo n.º 2
0
        public void Update()
        {
            foreach (UICommandElement element in _UIElements)
            {
                element.Update();
            }

            if (DraggingController.GetInstance().IsDragging())
            {
                Dispose();
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
        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();
            }
        }
Ejemplo n.º 6
0
 public void InitDropEvent()
 {
     DraggingController.GetInstance().ClearEvents();
     DraggingController.GetInstance().OnDropEvent += OnDropUIElement;
 }