Beispiel #1
0
        public static StringCollection ContentNamesInPriority(Zone z, Content c)
        {
            // Container for returned group of found Content objects
            StringCollection sc = new StringCollection();

            // Process each Window in the Zone
            foreach(Window w in z.Windows)
            {
                WindowContent wc = w as WindowContent;

                // Is the Zone a Content derived variation?
                if (wc != null)
                {
                    // Does this contain the interesting Content?
                    if (wc.Contents.Contains(c))
                    {
                        // All Content of this Window are given priority and
                        // added into the start of the collection
                        foreach(Content content in wc.Contents)
                            sc.Insert(0, content.Title);
                    }
                    else
                    {
                        // Lower priority Window and so contents are always
                        // added to the end of the collection
                        foreach(Content content in wc.Contents)
                            sc.Add(content.Title);
                    }
                }
            }

            return sc;
        }
Beispiel #2
0
        public static StringCollection ContentNames(Zone z)
        {
            // Container for returned group of found String objects
            StringCollection sc = new StringCollection();

            // Process each Window in the Zone
            foreach(Window w in z.Windows)
            {
                WindowContent wc = w as WindowContent;

                // Is the Zone a Content derived variation?
                if (wc != null)
                {
                    // Add each Content into the collection
                    foreach(Content c in wc.Contents)
                        sc.Add(c.Title);
                }
            }

            return sc;
        }
        public override Restore RecordRestore(object child) 
        {
            // Child of a WindowContent must be a Content object
            Content c = child as Content;

            StringCollection next = new StringCollection();
            StringCollection previous = new StringCollection();

            bool before = true;

            // Fill collections with list of Content before and after parameter
            foreach(Content content in _contents)
            {
                if (content == c)
                    before = false;
                else
                {
                    if (before)
                        previous.Add(content.Title);
                    else
                        next.Add(content.Title);
                }
            }

            bool selected = false;

            // Is there a selected tab?
            if (_tabControl.SelectedIndex != -1)
            {
                // Get access to the selected Content
                Content selectedContent = _tabControl.SelectedTab.Tag as Content;

                // Need to record if it is selected
                selected = (selectedContent == c);
            }

            // Create a Restore object to handle this WindowContent
            Restore thisRestore = new RestoreWindowContent(null, c, next, previous, selected);

            // Do we have a Zone as our parent?
            if (_parentZone != null)
            {
                // Get the Zone to prepend its own Restore knowledge
                thisRestore = _parentZone.RecordRestore(this, child, thisRestore);
            }

            return thisRestore;
        }
Beispiel #4
0
		protected void GetWindowContentFriends(Window match, 
											   out StringCollection best,
											   out StringCollection next,
											   out StringCollection previous)
		{
			best = new StringCollection();
			next = new StringCollection();
			previous = new StringCollection();

			bool before = true;

			foreach(Window w in _windows)
			{
				WindowContent wc = w as WindowContent;

				// Is this the Window we are searching for?
				if (w == match)
				{
					if (wc != null)
					{
						// Best friends are those in the matching Window
						foreach(Content content in wc.Contents)
							best.Add(content.Title);
					}

					before = false;
				}
				else
				{
					if (wc != null)
					{
						// Remember all found Content in appropriate next/previous collection
						foreach(Content content in wc.Contents)
						{
							if (before)
								previous.Add(content.Title);
							else
								next.Add(content.Title);
						}
					}
				}
			}

		}
Beispiel #5
0
		protected void GetZoneContentFriends(Content c,
											 out StringCollection zoneBest,
											 out StringCollection zoneNext,
											 out StringCollection zonePrevious,
											 out StringCollection zoneNextAll,
											 out StringCollection zonePreviousAll)
		{

			// Out best friends are all those Content inside this Zone but with the ones
			// in the same Window as the first in list and so the highest priority
			zoneBest = ZoneHelper.ContentNamesInPriority(this,c);

			zoneNext = new StringCollection();
			zonePrevious = new StringCollection();
			zoneNextAll = new StringCollection();
			zonePreviousAll = new StringCollection();

			bool before = true;

			foreach(Control control in _manager.Container.Controls)
			{
				Zone z = control as Zone;

				if (z != null)
				{
					if (z == this)
						before = false;
					else
					{
						ContentCollection newContent = ZoneHelper.Contents(z);

						foreach(Content content in newContent)
						{
							if (before)
							{
								if (z.State == this.State)
									zonePrevious.Add(content.Title);

								zonePreviousAll.Add(content.Title);
							}
							else
							{
								if (z.State == this.State)
									zoneNext.Add(content.Title);

								zoneNextAll.Add(content.Title);
							}
						}

						newContent.Clear();
					}
				}
			}
		}
Beispiel #6
0
        public Restore RestoreObjectForContent(Content c)
        {
            StringCollection next = new StringCollection();
            StringCollection previous = new StringCollection();
            StringCollection nextAll = new StringCollection();
            StringCollection previousAll = new StringCollection();

            // Which group has the marked content?
            TabStub marked = TabStubForContent(c);

            // Have we found the marked group yet?
            bool foundGroup = false;
            
            // Found the content in the marked group yet?
            bool foundContent = false;

            int controlCount = this.Controls.Count;
        
            // Process each TabStub in turn
            for(int controlIndex=controlCount-1; controlIndex>=0; controlIndex--)
            {
                TabStub ts = this.Controls[controlIndex] as TabStub;
            
                // Process each Page in the TabStub
                foreach(SharpClient.UI.Controls.TabPage page in ts.TabPages)
                {
                    Content content = page.Tag as Content;

                    // Is this the marked group
                    if (marked == ts)
                    {
                        // Add into the 'nextAll' rather than 'previousAll' groups from now on
                        foundGroup = true;

                        // No need to save ourself in our best friends list!
                        if (content.Title == c.Title)
                        {
                            // Add into the 'next' rather than 'previous' contents now
                            foundContent = true;
                        }
                        else
                        {
                            if (!foundContent)
                                previous.Add(content.Title);
                            else
                                next.Add(content.Title);
                        }
                    }
                    else
                    {
                        if (!foundGroup)
                            previousAll.Add(content.Title);
                        else
                            nextAll.Add(content.Title);                    
                    }
                }
            }

            // Calculate state from docking value
            State windowState = State.DockLeft;
		    
            // Define stub settings based on our docking position
            switch(this.Dock)
            {
                case DockStyle.Left:
                    windowState = State.DockLeft;
                    break;
                case DockStyle.Right:
                    windowState = State.DockRight;
                    break;
                case DockStyle.Top:
                    windowState = State.DockTop;
                    break;
                case DockStyle.Bottom:
                    windowState = State.DockBottom;
                    break;
            }
            
            return new RestoreAutoHideAffinity(null, windowState, c, next, previous, nextAll, previousAll);
        }