コード例 #1
0
        bool isSameAsAlreadySelectedElement(GuiElement element)
        {
            // is not the same if no element is selected
            if (!selectionTracker.isAnyGuiElementSelected)
            {
                return(false);
            }

            return(element == selectionTracker.selectedElement);
        }
コード例 #2
0
        void trySendDeselectionToElementIfNotSameElement(GuiElement element)
        {
            // if no element is/was selected we can't send it an deselection event
            if (!selectionTracker.isAnyGuiElementSelected)
            {
                return;
            }

            // if it is the same gui element sending it a deselection event is useless
            if (isSameAsAlreadySelectedElement(element))
            {
                return;
            }

            // all fine, send delesection event
            sendDelesectionEventTo(selectionTracker.selectedElement);
        }
コード例 #3
0
        // called from outside when the mouse button was released
        public void eventMouseReleased(SpatialVectorDouble mousePosition)
        {
            IEnumerable <GuiElement> guiElementsUnderMousePositionAsEnumerable =
                positionChecker.getElementsWhichOverlapTheMousePosition(mousePosition);
            IList <GuiElement> guiElementsUnderMousePosition = new List <GuiElement>(guiElementsUnderMousePositionAsEnumerable);

            if (guiElementsUnderMousePosition.Count > 0)
            {
                // change the selection

                // we just take first GuiElement in case of multiple
                // NOTE< could be a problem if there are multiple elements under the mouse position, we let it this way for now >
                GuiElement elementUnderMousePosition = guiElementsUnderMousePosition[0];

                // delesection
                trySendDeselectionToElementIfNotSameElement(elementUnderMousePosition);

                // selection
                if (!isSameAsAlreadySelectedElement(elementUnderMousePosition))
                {
                    changeSelectionTo(elementUnderMousePosition);
                }
            }
        }
コード例 #4
0
ファイル: GuiScreenCLASSES.cs プロジェクト: chargen/AGI-X0
        public void removeAndDisposeGuiElement(GuiElement element)
        {
            guiElements.elements.Remove(element);

            // TODO< dispose >
        }
コード例 #5
0
ファイル: GuiScreenCLASSES.cs プロジェクト: chargen/AGI-X0
 public void addGuiElement(GuiElement element)
 {
     guiElements.elements.Add(element);
 }
コード例 #6
0
 void sendDelesectionEventTo(GuiElement element)
 {
     throw new NotImplementedException(); // TODO
 }
コード例 #7
0
 void changeSelectionTo(GuiElement element)
 {
     selectionTracker.selectedElement = element;
     sendSelectionEventTo(element);
 }