Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
		public bool Contains(StringCollection values)
		{
			foreach(String s in values)
				if (Contains(s))
					return true;

			return false;
		}
Ejemplo n.º 3
0
        public bool Contains(StringCollection values)
        {
			foreach(String c in values)
			{
	            // Use base class to process actual collection operation
				if (Contains(c))
					return true;
			}

			return false;
        }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 5
0
		public RestoreContentFloatingAffinity(Restore child, 
										      State state, 
											  Content content, 
											  StringCollection best,
											  StringCollection associates)
			: base(child, state, content)
		{
			// Remember parameters
			_best = best;
			_associates = associates;
			_size = content.DisplaySize;
			_location = content.DisplayLocation;

			// Remove target from collection of friends
			if (_best.Contains(content.Title))
				_best.Remove(content.Title);

			// Remove target from collection of associates
			if (_associates.Contains(content.Title))
				_associates.Remove(content.Title);
		}
Ejemplo n.º 6
0
		public RestoreContentFloatingAffinity()
			: base()
		{
			// Must always point to valid reference
			_best = new StringCollection();
			_associates = new StringCollection();
		}
Ejemplo n.º 7
0
		public RestoreContentDockingAffinity(Restore child, 
										     State state, 
											 Content content, 
											 StringCollection best,
											 StringCollection next,
											 StringCollection previous,
											 StringCollection nextAll,
											 StringCollection previousAll)
			: base(child, state, content)
		{
			// Remember parameters
			_best = best;
			_next = next;
			_previous = previous;
			_nextAll = nextAll;
			_previousAll = previousAll;
			_size = content.DisplaySize;
			_location = content.DisplayLocation;
		}
Ejemplo n.º 8
0
		public RestoreContentDockingAffinity()
			: base()
		{
			// Must always point to valid reference
			_best = new StringCollection();
			_next = new StringCollection();
			_previous = new StringCollection();
			_nextAll = new StringCollection();
			_previousAll = new StringCollection();
		}
Ejemplo n.º 9
0
 public RestoreAutoHideAffinity(Restore child, 
                                State state,
                                Content content, 
                                StringCollection next,
                                StringCollection previous,
                                StringCollection nextAll,
                                StringCollection previousAll)
 : base(child, state, content)
 {
     // Remember parameters
     _next = next;				
     _previous = previous;	
     _nextAll = nextAll;				
     _previousAll = previousAll;	
 }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
0
		public RestoreWindowContent()
			: base()
		{
			// Must always point to valid reference
			_selected = false;
			_next = new StringCollection();
			_previous = new StringCollection();
		}
Ejemplo n.º 12
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);
						}
					}
				}
			}

		}
Ejemplo n.º 13
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();
					}
				}
			}
		}
Ejemplo n.º 14
0
        public void AddContent(Content content, 
                               StringCollection next, 
                               StringCollection previous, 
                               StringCollection nextAll, 
                               StringCollection previousAll)
        {
            int nextIndex = 0;
            int previousIndex = 0;
            TabStub nextTabStub = null;
            TabStub previousTabStub = null;
            TabStub nextAllTabStub = null;
            TabStub previousAllTabStub = null;
        
            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 c = page.Tag as Content;

                    // Always use the last 'previous' discovered
                    if (previous.Contains(c.Title))
                    {
                        previousIndex = ts.TabPages.IndexOf(page);
                        previousTabStub = ts;
                    }
                    
                    // Only remember the first 'next' discovered
                    if (next.Contains(c.Title))
                    {
                        if (nextTabStub == null)
                        {
                            nextIndex = ts.TabPages.IndexOf(page);
                            nextTabStub = ts;
                        }
                    }

                    // Always use the last 'previousAll' discovered
                    if (previousAll.Contains(c.Title))
                        previousAllTabStub = ts;

                    // Only remember the first 'next' discovered
                    if (nextAll.Contains(c.Title))
                    {
                        if (nextAllTabStub == null)
                            nextAllTabStub = ts;
                    }
                }
            }            

            // If no matches at all found
            if ((previousTabStub == null) && (nextTabStub == null))
            {
                // Default to inserting at end of list
                int insertIndex = Controls.Count;
            
                // If found some friends contents, then insert relative to them
                if (previousAllTabStub != null)
                    insertIndex = Controls.IndexOf(previousAllTabStub);
                else
                {
                    if (nextAllTabStub != null)
                        insertIndex = Controls.IndexOf(nextAllTabStub) + 1;
                }
            
                ContentCollection cs = new ContentCollection();
                
                cs.Add(content);
            
                // Add at end of current list of TabStubs
                AddContentsAsGroup(cs, insertIndex);
            }
            else
            {
                if (previousTabStub != null)
                    AddContentIntoTabStub(content, previousTabStub, previousIndex + 1);
                else
                    AddContentIntoTabStub(content, nextTabStub, nextIndex);
            }
        }
Ejemplo n.º 15
0
		public RestoreZoneAffinity()
			: base()
		{
			// Default state
			_space = 50m;

			// Must always point to valid reference
			_best = new StringCollection();
			_next = new StringCollection();
			_previous = new StringCollection();
		}
Ejemplo n.º 16
0
		public RestoreZoneAffinity(Restore child, 
								   Content content, 
								   StringCollection best,
								   StringCollection next,
								   StringCollection previous)
			: base(child, content)
		{
			// Remember parameters
			_best = best;				
			_next = next;				
			_previous = previous;	
			
			if (content.Visible)			
				_space = content.ParentWindowContent.ZoneArea;
			else
				_space = 50m;
		}
Ejemplo n.º 17
0
        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;
        }
Ejemplo n.º 18
0
		public RestoreWindowContent(Restore child, 
									Content content, 
									StringCollection next, 
									StringCollection previous,
									bool selected)
			: base(child, content)
		{
			// Remember parameters
            _selected = selected;
            _next = next;
			_previous = previous;
		}
Ejemplo n.º 19
0
 public RestoreAutoHideAffinity()
     : base()
 {
     // Must always point to valid reference
     _next = new StringCollection();
     _previous = new StringCollection();
     _nextAll = new StringCollection();
     _previousAll = new StringCollection();
 }