Beispiel #1
0
        public Zone Add(Zone value)
        {
            // Use base class to process actual collection operation
            base.List.Add(value as object);

            return value;
        }
Beispiel #2
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 #3
0
        public Window(DockingManager manager)
        {
            // Must provide a valid manager instance
            if (manager == null)
                throw new ArgumentNullException("DockingManager");

            // Default object state
            _state = State.Floating;
            _parentZone = null;
            _zoneArea = 100m;
            _minimalSize = new Size(0,0);
            _manager = manager;
            _autoDispose = true;
            _fullTitle = "";
            _redockAllowed = true;
            _floatingCaption = true;
            _contentCaption = true;

            // Create collection of window details
            _windowDetails = new WindowDetailCollection();

            // We want notification when window details are added/removed/cleared
            _windowDetails.Clearing += new CollectionClear(OnDetailsClearing);
            _windowDetails.Inserted += new CollectionChange(OnDetailInserted);
            _windowDetails.Removing += new CollectionChange(OnDetailRemoving);
        }
Beispiel #4
0
 public WindowDetail(DockingManager manager)
 {
     // Default the state
     _parentZone = null;
     _parentWindow = null;
     _manager = manager;
     
     // Get correct starting state from manager
     this.BackColor = _manager.BackColor;            
     this.ForeColor = _manager.InactiveTextColor;
 }
        //, ContextHandler contextHandler)
        public FloatingForm(DockingManager dockingManager, Zone zone)
        {
            // The caller is responsible for setting our initial screen location
            this.StartPosition = FormStartPosition.Manual;

            // Not in task bar to prevent clutter
            this.ShowInTaskbar = false;

            // Make sure the main Form owns us
            this.Owner = dockingManager.Container.FindForm();

            // Need to know when the Zone is removed
            this.ControlRemoved += new ControlEventHandler(OnZoneRemoved);

            // Add the Zone as the only content of the Form
            Controls.Add(zone);

            // Default state
            _redocker = null;
            _intercept = false;
            _zone = zone;
            _dockingManager = dockingManager;

            // Assign any event handler for context menu
            //            if (contextHandler != null)
            //                this.Context += contextHandler;

            // Default color
            this.BackColor = _dockingManager.BackColor;
            this.ForeColor = _dockingManager.InactiveTextColor;

            // Monitor changes in the Zone content
            _zone.Windows.Inserted += new CollectionChange(OnWindowInserted);
            _zone.Windows.Removing += new CollectionChange(OnWindowRemoving);
            _zone.Windows.Removed += new CollectionChange(OnWindowRemoved);

            if (_zone.Windows.Count == 1)
            {
                // The first Window to be added. Tell it to hide details
                _zone.Windows[0].HideDetails();

                // Monitor change in window title
                _zone.Windows[0].FullTitleChanged += new EventHandler(OnFullTitleChanged);

                // Grab any existing title
                this.Text = _zone.Windows[0].FullTitle;
            }

            // Need to hook into message pump so that the ESCAPE key can be
            // intercepted when in redocking mode
            Application.AddMessageFilter(this);
        }
Beispiel #6
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;
        }
Beispiel #7
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;
        }
Beispiel #8
0
 public void AddRange(Zone[] values)
 {
     // Use existing method to add each array entry
     foreach(Zone page in values)
         Add(page);
 }
Beispiel #9
0
 public virtual void PerformRestore(Zone z) {}
Beispiel #10
0
		public override void PerformRestore(Zone z)
		{
			int count = z.Windows.Count;
			int beforeIndex = - 1;
			int afterIndex = count;
		
			// Find the match to one of our best friends
			for(int index=0; index<count; index++)
			{
				WindowContent wc = z.Windows[index] as WindowContent;

				if (wc != null)
				{
					// If this WindowContent contains a best friend, then add ourself here as well
					if (wc.Contents.Contains(_best))
					{
						if (_child == null)
						{
							// If we do not have a Restore object for the Window then just add
							// into the WindowContent at the end of the existing Contents
							wc.Contents.Add(_content);
						}
						else
						{
							// Get the child to restore as best as possible inside WindowContent
							_child.PerformRestore(wc);
						}

						return;
					}

					// If the WindowContent contains a Content previous to the target
					if (wc.Contents.Contains(_previous))
					{
						if (index > beforeIndex)
							beforeIndex = index;
					}
					
					// If the WindowContent contains a Content next to the target
					if (wc.Contents.Contains(_next))
					{
						if (index < afterIndex)
							afterIndex = index;
					}
				}
			}

			// If we get here then we did not find any best friends, this 
			// means we need to create a new WindowContent to host the Content.
			Window newW =  z.DockingManager.CreateWindowForContent(_content);

			ZoneSequence zs = z as ZoneSequence;

			// If this is inside a ZoneSequence instance
			if (zs != null)
			{
				// Do not reposition the Windows on the .Insert but instead ignore the
				// reposition and let it happen in the .ModifyWindowSpace. This reduces
				// the flicker that would occur otherwise
				zs.SuppressReposition();
			}

			// Need to find the best place in the order for the Content, start by
			// looking for the last 'previous' content and place immediately after it
			if (beforeIndex >= 0)
			{
				// Great, insert after it
				z.Windows.Insert(beforeIndex + 1, newW);
			}
			else
			{
				// No joy, so find the first 'next' content and place just before it, if
				// none are found then just add to the end of the collection.
				z.Windows.Insert(afterIndex, newW);
			}

			// If this is inside a ZoneSequence instance
			if (zs != null)
			{
				// We want to try and allocate the correct Zone space
				zs.ModifyWindowSpace(newW, _space);
			}
		}
Beispiel #11
0
 public int IndexOf(Zone value)
 {
     // Find the 0 based index of the requested entry
     return base.List.IndexOf(value);
 }
        public void ReorderZoneToInnerMost(Zone zone)
        {
            int index = 0;

            // If there is no control specified as the one for all Zones to be placed
            // in front of then simply add the Zone at the start of the list so it is
            // in front of all controls.
            if (_innerControl != null)
            {
                // Find position of specified control and place after it in the list
                // (hence adding one to the returned value)
                index = _container.Controls.IndexOf(_innerControl) + 1;
            }

            // Find current position of the Zone to be repositioned
            int current = _container.Controls.IndexOf(zone);

            // If the old position is before the new position then we need to
            // subtract one. As the collection will remove the Control from the
            // old position before inserting it in the new, thus reducing the index
            // by 1 before the insert occurs.
            if (current < index)
                index--;

            // Found a Control that is not a Zone, so need to insert straight it
            _container.Controls.SetChildIndex(zone, index);

            // Manageing Zones should remove display AutoHide windows
            RemoveShowingAutoHideWindows();
        }
Beispiel #13
0
 public bool Contains(Zone value)
 {
     // Use base class to process actual collection operation
     return base.List.Contains(value as object);
 }
Beispiel #14
0
 public void Insert(int index, Zone value)
 {
     // Use base class to process actual collection operation
     base.List.Insert(index, value as object);
 }
Beispiel #15
0
 public void Remove(Zone value)
 {
     // Use base class to process actual collection operation
     base.List.Remove(value as object);
 }
        public void ReorderZoneToOuterMost(Zone zone)
        {
            // Get index of the outer control (minus AutoHidePanel's)
            int index = OuterControlIndex();

            // Find current position of the Zone to be repositioned
            int current = _container.Controls.IndexOf(zone);

            // If the old position is before the new position then we need to
            // subtract one. As the collection will remove the Control from the
            // old position before inserting it in the new, thus reducing the index
            // by 1 before the insert occurs.
            if (current < index)
                index--;

            // Found a Control that is not a Zone, so need to insert straight it
            _container.Controls.SetChildIndex(zone, index);

            // Manageing Zones should remove display AutoHide windows
            RemoveShowingAutoHideWindows();
        }
        public Window AddContentToZone(Content c, Zone z, int index)
        {
            // Validate the incoming Content instance is a valid reference
            // and is a current instance within our internal collection
            if ((c == null) || !_contents.Contains(c))
                return null;

            // Validate the incoming Zone instance is a valid reference
            if (z == null)
                return null;

            // Do not generate hiding/hidden/shown events
            _surpressVisibleEvents++;

            // Manageing Zones should remove display AutoHide windows
            RemoveShowingAutoHideWindows();

            // Is the window already part of a WindowContent?
            if (c.ParentWindowContent != null)
            {
                // Is there a change in docking state?
                if (c.ParentWindowContent.ParentZone.State != z.State)
                {
                    // If it used to be in a floating mode, then record state change
                    if (c.ParentWindowContent.ParentZone.State == State.Floating)
                        c.ContentLeavesFloating();
                    else
                        c.ContentBecomesFloating();
                }

                // Remove the Content from its current WindowContent
                c.ParentWindowContent.Contents.Remove(c);
            }
            else
            {
                // If target zone is floating window then we are no longer docked
                if (z.State == State.Floating)
                    c.Docked = false;
            }

            // Create a new WindowContent instance according to our style
            Window w = CreateWindowForContent(c);

            // Add the Window to the Zone at given position
            z.Windows.Insert(index, w);

            // Enable generation hiding/hidden/shown events
            _surpressVisibleEvents--;

            // Generate event to indicate content is now visible
            OnContentShown(c);

            return w;
        }