Ejemplo n.º 1
0
		public static ContentCollection Contents(Zone z)
		{
			// Container for returned group of found Content objects
			ContentCollection cc = new ContentCollection();

			// 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)
						cc.Add(c);
				}
			}

			return cc;
		}
		public ContentCollection Copy()
		{
			ContentCollection clone = new ContentCollection();

			// Copy each reference across
            foreach(Content c in base.List)
				clone.Add(c);

			return clone;
		}
Ejemplo n.º 3
0
 public override void PerformRestore(DockingManager dm)
 {
     // Create collection of Contents to auto hide
     ContentCollection cc = new ContentCollection();
     
     // In this case, there is only one
     cc.Add(_content);
 
     // Add to appropriate AutoHidePanel based on _state
     dm.AutoHideContents(cc, _state);
 }
Ejemplo n.º 4
0
        protected virtual void OnRestore(object sender, EventArgs e)
        {
            WindowDetailCaption wdc = sender as WindowDetailCaption;

            // Was Restore generated by a Caption detail?
            if (wdc != null)
            {
                RemoveAnyFillStyle();

                WindowContent wc = wdc.ParentWindow as WindowContent;

                // Is the Caption part of a WindowContent object?
                if (wc != null)
                {
                    ContentCollection copy = new ContentCollection();

                    // Make every Content of the WindowContent record its
                    // current position and remember it for when the future
                    foreach(Content c in wc.Contents)
                    {
                        c.RecordRestore();

                        // Invert docked status
                        c.Docked = (c.Docked == false);

                        copy.Add(c);
                    }

                    int copyCount = copy.Count;

                    // Must have at least one!
                    if (copyCount >= 1)
                    {
                        // Remove from current WindowContent and restore its position
                        HideContent(copy[0], false, true);
                        ShowContent(copy[0]);

                        // Any other content to be moved along with it?
                        if (copyCount >= 2)
                        {
                            WindowContent newWC = copy[0].ParentWindowContent;

                            if (newWC != null)
                            {
                                // Transfer each one to its new location
                                for(int index=1; index<copyCount; index++)
                                {
                                    HideContent(copy[index], false, true);
                                    newWC.Contents.Add(copy[index]);
                                }
                            }
                        }
                    }
                }

                AddInnerFillStyle();
            }
        }
Ejemplo n.º 5
0
        protected virtual void OnInvertAutoHide(object sender, EventArgs e)
        {
            // Do not generate hiding/hidden/shown events
            _surpressVisibleEvents++;

            WindowDetail detail = sender as WindowDetail;

            // Get access to Content that initiated AutoHide for its Window
            WindowContent wc = detail.ParentWindow as WindowContent;

            // Create a collection of the Content in the same window
            ContentCollection cc = new ContentCollection();

            // Add all Content into collection
            foreach(Content c in wc.Contents)
                cc.Add(c);

            // Add to the correct AutoHidePanel
            AutoHideContents(cc, wc.State);

            // Enable generate hiding/hidden/shown events
            _surpressVisibleEvents--;
        }
Ejemplo n.º 6
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.º 7
0
        protected void OnPageClose(object sender, EventArgs e)
        {
            // Find the TabStub instance for the showing WCT
            foreach(TabStub ts in this.Controls)
            {
                // Does this stub match the one showing?
                if (ts.WindowContentTabbed == _currentWCT)
                {
                    ContentCollection cc = new ContentCollection();
                
                    // Get access to Content instance being hidden
                    Content current = _currentWCT.Contents[ts.SelectedIndex];
                    
                    // Check if the hide button is allowed to work
                    if (!_manager.OnContentHiding(current))
                    {
                        // Are we removing the last entry in the WCT?
                        if (ts.TabPages.Count == 1)
                        {
                            // We need to update AutoHide property for all of them
                            foreach(Content c in _currentWCT.Contents)
                                cc.Add(c);
                        
                            // Remove Panel/WCT from display and stop timers
                            KillDisplayedWindow();

                            // Remove the WCT from the WCT
                            ControlHelper.Remove(ts.Controls, ts.WindowContentTabbed);

                            // Remove the stub from this panel
                            ControlHelper.Remove(this.Controls, ts);                    

                            // Cleanup gracefully
                            ts.Dispose();
                        }
                        else
                        {
                            // Which entry in the stub is currently selected?
                            int index = ts.SelectedIndex;

                            // Need to update AutoHide property for removed content
                            cc.Add(_currentWCT.Contents[index]);

                            // Remove just the selected entry from stub
                            ts.TabPages.RemoveAt(index);
                            
                            // Remove the selected entry from WCT
                            _currentWCT.Contents.RemoveAt(index);
                        }

                        // Content instances no longer in AutoHidden state
                        foreach(Content c in cc)
                        {
                            // Remember this AutoHide state for persistence
                            c.RecordAutoHideRestore();

                            // No longer in the auto hidden mode                    
                            c.AutoHidden = false;
                            c.AutoHidePanel = null;
                        }
                    }
                    
                    // Generate hidden event now content is not visible
                    _manager.OnContentHidden(current);
                    
                    break;
                }
            }
            
            // If no more contents remain then hide
            if (this.Controls.Count == 0)
                this.Hide();
        }