示例#1
0
        internal void RefreshChildLists()
        {
            if (NotebookPages.IsSorted == false)
            {
                NotebookPages.Sort();
            }

            NavigatorInterface.RefreshAllPages();
        }
示例#2
0
 public Wander(string _alertTag, string _animString = "[A][I]Add the correct animation name to the state[A][I]",
               NavigatorInterface _nav = null, NavMeshAgent _agent = null, float _wanderTime = 10, float _alertRange = 20, float _walkSpeed = 0.5f)
 {
     alertTag   = _alertTag;
     animString = _animString;
     agent      = _agent;
     nav        = _nav;
     wanderTime = _wanderTime;
     timeLeft   = wanderTime;
     alertRange = _alertRange;
     walkSpeed  = _walkSpeed;
 }
示例#3
0
        private void InsertPageInternal(int index, NotebookPage page)
        {
            if (page == null)
            {
                throw new NullReferenceException();
            }
            if (NotebookPages.Contains(page))
            {
                throw new ArgumentException();
            }

            NotebookPages.InsertInternal(index, page);
            NoteControls.AddInternal(page);

            NavigatorInterface.RefreshAllPages();
        }
示例#4
0
        private void AddPageInternal(NotebookPage page)
        {
            if (page == null)
            {
                throw new ArgumentException("Page cannot be null.");
            }
            if (NotebookPages.Contains(page))
            {
                throw new ArgumentException("Page is already in the notebook.");
            }

            NotebookPages.AddInternal(page);
            NoteControls.AddInternal(page);

            NavigatorInterface.RefreshAllPages();
        }
示例#5
0
        private void CreateNavigator(NavigatorType type)
        {
            INavigator navigator      = NavigatorFactory.CreateNavigator(this, type);
            int        currentNavSize = 0;
            int        selectedIndex  = -1;

            if (navigator is Control == false)
            {
                throw new ArgumentException("Notebook navigators must inherit from Control.");
            }

            if (mNavigator != null)
            {
                selectedIndex = SelectedIndex;

                switch (Navigator.Location)
                {
                case NavigatorLocation.Left:
                case NavigatorLocation.Top:
                    currentNavSize = mSplitterLocation;
                    break;

                case NavigatorLocation.Bottom:
                    currentNavSize = ClientSize.Height - mSplitterLocation;
                    break;

                case NavigatorLocation.Right:
                    currentNavSize = ClientSize.Width - mSplitterLocation;
                    break;
                }
            }

            mNavType       = type;
            mNavProperties = navigator.CreateProperties();
            mNavigator     = (Control)navigator;

            // remove any existing navigator before adding the new one
            NoteControls.RemoveNavigator();
            NoteControls.Add(mNavigator);

            NavigatorInterface.RefreshAllPages();
            SelectedIndex = selectedIndex;

            RedoLayout();
            DisplayCorrectPage();
        }
示例#6
0
        private void RemovePageInternal(NotebookPage page)
        {
            if (page == null)
            {
                throw new NullReferenceException();
            }

            int newIndex = SelectedIndex;

            if (newIndex >= NotebookPages.IndexOf(page) && newIndex > -1)
            {
                newIndex--;

                if (newIndex < 0 && NotebookPages.Count > 1)
                {
                    newIndex = 0;
                }
            }
            if (newIndex >= NotebookPages.Count)
            {
                newIndex = NotebookPages.Count - 1;
            }

            SelectedIndex = newIndex;

            NotebookPages.RemoveInternal(page);
            NoteControls.RemoveInternal(page);

            if (NotebookPages.Count > 0 && SelectedIndex == -1)
            {
                SelectedIndex = 0;
            }

            NavigatorInterface.RefreshAllPages();

            DisplayCorrectPage();
        }
示例#7
0
        void RedoLayoutImpl()
        {
            Rectangle navRegion;

            if (mNavigator == null)
            {
                return;
            }

            if (SelectedIndex == -1 && NotebookPages.Count > 0)
            {
                SelectedIndex = 0;
            }

            int currentNavSize = 0;

            // make sure the navigator size is within the right range
            switch (Navigator.Location)
            {
            case NavigatorLocation.Left:
            case NavigatorLocation.Right:
                currentNavSize = mNavigator.Width;

                if (currentNavSize < NavigatorInterface.NavMinSize.Width)
                {
                    currentNavSize = NavigatorInterface.NavMinSize.Width;
                }

                if (currentNavSize > NavigatorInterface.NavMaxSize.Width)
                {
                    currentNavSize = NavigatorInterface.NavMaxSize.Width;
                }

                break;

            case NavigatorLocation.Top:
            case NavigatorLocation.Bottom:
                currentNavSize = mNavigator.Height;

                if (currentNavSize < NavigatorInterface.NavMinSize.Height)
                {
                    currentNavSize = NavigatorInterface.NavMinSize.Height;
                }

                if (currentNavSize > NavigatorInterface.NavMaxSize.Height)
                {
                    currentNavSize = NavigatorInterface.NavMaxSize.Height;
                }

                break;
            }

            // set the splitter location to size the navigator at the right size
            switch (Navigator.Location)
            {
            case NavigatorLocation.Left:
                mNavigator.Width  = currentNavSize;
                mSplitterLocation = currentNavSize + Navigator.Margin.Horizontal;
                break;

            case NavigatorLocation.Right:
                mNavigator.Width  = currentNavSize;
                mSplitterLocation = ClientSize.Width - currentNavSize - SplitterWidth - Navigator.Margin.Horizontal;
                break;

            case NavigatorLocation.Top:
                mNavigator.Height = currentNavSize;
                mSplitterLocation = currentNavSize + Navigator.Margin.Vertical;
                break;

            case NavigatorLocation.Bottom:
                mNavigator.Height = currentNavSize;
                mSplitterLocation = ClientSize.Height - currentNavSize - SplitterWidth - Navigator.Margin.Vertical;
                break;
            }

            if (Navigator.IsShowing)
            {
                switch (Navigator.Location)
                {
                case NavigatorLocation.Left:
                    navRegion = new Rectangle(0, 0,
                                              mSplitterLocation, ClientSize.Height);

                    mPageRect = new Rectangle(mSplitterLocation + SplitterWidth, 0,
                                              0, ClientSize.Height);

                    mPageRect.Width = ClientSize.Width - mPageRect.Left;

                    break;

                case NavigatorLocation.Right:
                    mPageRect = new Rectangle(0, 0,
                                              mSplitterLocation, ClientSize.Height);

                    navRegion = new Rectangle(mSplitterLocation + SplitterWidth, 0,
                                              0, ClientSize.Height);

                    navRegion.Width = ClientSize.Width - navRegion.Left;

                    break;

                case NavigatorLocation.Top:
                    navRegion = new Rectangle(0, 0,
                                              ClientSize.Width, mSplitterLocation);

                    mPageRect = new Rectangle(0, mSplitterLocation + SplitterWidth,
                                              ClientSize.Width, 0);

                    mPageRect.Height = ClientSize.Height - mPageRect.Top;

                    break;

                case NavigatorLocation.Bottom:
                    mPageRect = new Rectangle(0, 0,
                                              ClientSize.Width, mSplitterLocation);

                    navRegion = new Rectangle(0, mSplitterLocation + SplitterWidth,
                                              ClientSize.Width, 0);

                    navRegion.Height = ClientSize.Height - navRegion.Top;

                    break;

                default:
                    throw new Exception("Navigator.Location is not set to a valid value.");
                }
            }
            else
            {
                navRegion = new Rectangle(-1000, -1000, 50, 50);
                mPageRect = this.ClientRectangle;
            }

            mNavigator.Location = GetLocationWithMargin(navRegion, Navigator.Margin);
            mNavigator.Size     = GetSizeWithMargin(navRegion, Navigator.Margin);

            NavigatorInterface.OnUpdateLayout();

            foreach (NotebookPage p in NotebookPages)
            {
                p.Location = mPageRect.Location;
                p.Size     = mPageRect.Size;
            }

            DisplayCorrectPage();
        }