private int getNumberOfPeers(LayoutElementName elementName)
        {
            int elementCount = 1;
            if (compactMode)
            {
                //Everything is a peer in compact mode
                elementCount += countContainer(left);
                elementCount += countContainer(right);
                elementCount += countContainer(top);
                elementCount += countContainer(bottom);
            }
            else
            {
                if (elementName == LeftElementName || elementName == RightElementName)
                {
                    elementCount += countContainer(left);
                    elementCount += countContainer(right);
                }
                else if (elementName == TopElementName || elementName == BottomElementName)
                {
                    elementCount += countContainer(top);
                    elementCount += countContainer(bottom);
                }
            }

            return elementCount;
        }
示例#2
0
 public void changeElement(LayoutElementName elementName, LayoutContainer container, Action removedCallback)
 {
     if (container != null)
     {
         container.Visible = true;
         container.bringToFront();
     }
     screenLayoutManager.LayoutChain.addContainer(elementName, container, removedCallback);
 }
示例#3
0
        public override bool Equals(object obj)
        {
            LayoutElementName other = obj as LayoutElementName;

            if (other == null)
            {
                return(false);
            }
            return(this.UniqueDerivedName == other.UniqueDerivedName);
        }
        public GUIElementPopup(String layout, GUIManager guiManager, LayoutElementName elementName)
            : base(layout)
        {
            this.guiManager  = guiManager;
            this.elementName = elementName;
            layoutContainer  = new MyGUILayoutContainer(widget);
            layoutContainer.LayoutChanged += new Action(layoutUpdated);

            this.Showing += new EventHandler(ChooseSceneDialog_Showing);
            this.Hidden  += new EventHandler(ChooseSceneDialog_Hidden);
        }
示例#5
0
 public override void setLayoutItem(LayoutElementName elementName, LayoutContainer container, Action removedCallback)
 {
     if (container != null)
     {
         container.Location    = eventContainer.Location;
         container.WorkingSize = eventContainer.WorkingSize;
         container.layout();
         fullscreenPopups.Add(container);
         activeContainers.add(container, removedCallback);
     }
 }
示例#6
0
        /// <summary>
        /// Remove a container from the chain. This will trigger the removed callback for the container if one was provided.
        /// </summary>
        public void removeContainer(LayoutElementName elementName, LayoutContainer container)
        {
            LayoutChainLink link;

            if (namedLinkedElements.TryGetValue(elementName, out link))
            {
                link.removeLayoutItem(elementName, container);
            }
            else
            {
                Log.Warning("Cannot remove container from link '{0}' because it cannot be found. No changes made.", elementName.Name);
            }
        }
        public override void removeLayoutItem(LayoutElementName elementName, LayoutContainer container)
        {
            AnimatedLayoutContainer panel;

            if (panels.TryGetValue(elementName, out panel))
            {
                if (panel.CurrentContainer != null)
                {
                    panel.changePanel(null, 0.25f);
                }
            }
            else
            {
                Log.Warning("Cannot remove container from border layout position '{0}' because it cannot be found. No changes made.", elementName.Name);
            }
        }
示例#8
0
        /// <summary>
        /// Add a layout container to this chain. When the chain is done with the item it will call the removedCallback
        /// if one is provided.
        /// </summary>
        public void addContainer(LayoutElementName elementName, LayoutContainer container, Action removedCallback)
        {
            LayoutChainLink link;

            if (namedLinkedElements.TryGetValue(elementName, out link))
            {
                link.setLayoutItem(elementName, container, removedCallback);
            }
            else
            {
                Log.Warning("Cannot add container to container '{0}' because it cannot be found. No changes made.", elementName.Name);
                if (removedCallback != null)
                {
                    removedCallback.Invoke();
                }
            }
        }
        public override void setLayoutItem(LayoutElementName elementName, LayoutContainer container, Action removedCallback)
        {
            AnimatedLayoutContainer panel;

            if (panels.TryGetValue(elementName, out panel))
            {
                if (panel.CurrentContainer != container)
                {
                    panel.changePanel(container, 0.25f);
                    activePanels.add(container, removedCallback);
                }
            }
            else
            {
                Log.Warning("Cannot add container to border layout position '{0}' because it cannot be found. Container will not be visible on UI.", elementName.Name);
                if (removedCallback != null)
                {
                    removedCallback.Invoke();
                }
            }
        }
示例#10
0
        public override void setLayoutItem(LayoutElementName elementName, LayoutContainer container, Action removedCallback)
        {
            bool added = true;

            switch (((BorderLayoutElementName)elementName).ViewLocation)
            {
            case BorderLayoutLocations.Left:
                borderLayout.Left = container;
                break;

            case BorderLayoutLocations.Right:
                borderLayout.Right = container;
                break;

            case BorderLayoutLocations.Top:
                borderLayout.Top = container;
                break;

            case BorderLayoutLocations.Bottom:
                borderLayout.Bottom = container;
                break;

            case BorderLayoutLocations.Center:
                borderLayout.Center = container;
                break;

            default:
                Log.Warning("Cannot add container to border layout position '{0}' because it cannot be found. Container will not be visible on UI.", elementName.Name);
                if (removedCallback != null)
                {
                    removedCallback.Invoke();
                }
                added = false;
                break;
            }
            if (added)
            {
                activePanels.add(container, removedCallback);
            }
        }
示例#11
0
        public override void removeLayoutItem(LayoutElementName elementName, LayoutContainer container)
        {
            bool removed = true;

            switch (((BorderLayoutElementName)elementName).ViewLocation)
            {
            case BorderLayoutLocations.Left:
                borderLayout.Left = null;
                break;

            case BorderLayoutLocations.Right:
                borderLayout.Right = null;
                break;

            case BorderLayoutLocations.Top:
                borderLayout.Top = null;
                break;

            case BorderLayoutLocations.Bottom:
                borderLayout.Bottom = null;
                break;

            case BorderLayoutLocations.Center:
                borderLayout.Center = null;
                break;

            default:
                Log.Warning("Cannot remove container from border layout position '{0}' because it cannot be found. Container will not be visible on UI.", elementName.Name);
                removed = false;
                break;
            }
            if (removed)
            {
                activePanels.remove(container);
            }
        }
示例#12
0
        public TaskMenu(DocumentController documentController, TaskController taskController, GUIManager guiManager, LayoutElementName elementName)
            : base("Anomalous.GuiFramework.GUI.TaskMenu.TaskMenu.layout", guiManager, elementName)
        {
            this.taskController         = taskController;
            taskController.TaskAdded   += new TaskDelegate(taskController_TaskAdded);
            taskController.TaskRemoved += new TaskRemovedDelegate(taskController_TaskRemoved);

            iconScroller = (ScrollView)widget.findWidget("IconScroller");
            iconGrid     = new NoSelectButtonGrid(iconScroller, new ButtonGridGridLayout(), new TaskMenuItemComparer());

            recentDocuments = new TaskMenuRecentDocuments(widget, documentController);
            recentDocuments.DocumentClicked += new EventDelegate(recentDocuments_DocumentClicked);

            searchBox = widget.findWidget("Search") as EditBox;
            searchBox.EventEditTextChange   += SearchBox_EventEditTextChange;
            searchBox.EventEditSelectAccept += SearchBox_EventEditSelectAccept;

            viewButtonGroup = new ButtonGroup();
            viewButtonGroup.SelectedButtonChanged += new EventHandler(viewButtonGroup_SelectedButtonChanged);
            tasksButton = (Button)widget.findWidget("Tasks");
            viewButtonGroup.addButton(tasksButton);
            documentsButton = (Button)widget.findWidget("Documents");
            viewButtonGroup.addButton(documentsButton);

            this.Hidden += new EventHandler(TaskMenu_Hidden);

            dragIconPreview         = (ImageBox)Gui.Instance.createWidgetT("ImageBox", "ImageBox", 0, 0, ScaleHelper.Scaled(32), ScaleHelper.Scaled(32), Align.Default, "Info", "TaskMenuDragIconPreview");
            dragIconPreview.Visible = false;

            Button closeButton = (Button)widget.findWidget("CloseButton");

            closeButton.MouseButtonClick += new MyGUIEvent(closeButton_MouseButtonClick);

            scrollerBorderLeft   = iconScroller.Left;
            scrollerBorderHeight = widget.Height - iconScroller.Bottom;

            dragAreaSize = new IntVector2(ScaleHelper.Scaled(40), iconGrid.ItemHeight);

            //Add tasks that are already defined
            foreach (var task in taskController.Tasks)
            {
                taskController_TaskAdded(task);
            }
        }
示例#13
0
 public override void removeLayoutItem(LayoutElementName elementName, LayoutContainer container)
 {
     fullscreenPopups.Remove(container);
     activeContainers.remove(container);
 }
示例#14
0
 public void closeElement(LayoutElementName elementName, LayoutContainer container)
 {
     screenLayoutManager.LayoutChain.removeContainer(elementName, container);
 }
示例#15
0
 public abstract void setLayoutItem(LayoutElementName elementName, LayoutContainer container, Action removedCallback);
示例#16
0
 public override void removeLayoutItem(LayoutElementName elementName, LayoutContainer container)
 {
     activeContainers.remove(container);
 }
示例#17
0
 public override void setLayoutItem(LayoutElementName elementName, LayoutContainer container, Action removedCallback)
 {
     activeContainers.add(container, removedCallback);
 }
示例#18
0
 public abstract void removeLayoutItem(LayoutElementName elementName, LayoutContainer container);
 public override void setLayoutItem(LayoutElementName elementName, LayoutContainer container, Action removedCallback)
 {
     //This will never be called because this class does not expose any names
 }
 public override void removeLayoutItem(LayoutElementName elementName, LayoutContainer container)
 {
     //This will never be called because this class does not expose any names
 }