示例#1
0
        public Content(XmlTextReader xmlIn, int formatVersion)
        {
            // Define the initial object state
            _control = null;
            _title = "";
            _fullTitle = "";
            _imageList = null;
            _imageIndex = -1;
            _manager = null;
            _parentWindowContent = null;
            _displaySize = new Size(_defaultDisplaySize, _defaultDisplaySize);
            _autoHideSize = new Size(_defaultAutoHideSize, _defaultAutoHideSize);
            _floatingSize = new Size(_defaultFloatingSize, _defaultFloatingSize);
            _displayLocation = new Point(_defaultLocation, _defaultLocation);
            _order = _counter++;
            _visible = false;
            _defaultRestore = null;
            _autoHideRestore = null;
            _floatingRestore = null;
            _dockingRestore = null;
            _autoHidePanel = null;
            _docked = true;
            _captionBar = true;
            _closeButton = true;
            _hideButton = true;
            _autoHidden = false;

            // Overwrite default with values read in
            LoadFromXml(xmlIn, formatVersion);
        }
示例#2
0
		public override Restore RecordRestore(Window w, object child, Restore childRestore)
		{
			Content c = child as Content;

			// We currently only understand Windows that have Content as children
			if (c != null)
			{
				StringCollection best;
				StringCollection next;
				StringCollection previous;

				GetWindowContentFriends(w, out best, out next, out previous); 

				// Create a restore object that will find the correct WindowContent to 
				// place a Content in within a specified Zone, or it will create a new 
				// WindowContent in an appropriate relative ordering
				Restore zoneRestore = new RestoreZoneAffinity(childRestore, c, best, next, previous); 

				if (_state == State.Floating)
				{
					// Create a restore object to find the correct Floating Form to restore inside
					// or it will create a new Floating Form as appropriate
					return new RestoreContentFloatingAffinity(zoneRestore, _state, c, best, ZoneHelper.ContentNames(this));
				}
				else
				{
					StringCollection zoneBest;
					StringCollection zoneNext;
					StringCollection zonePrevious;
					StringCollection zoneNextAll;
					StringCollection zonePreviousAll;

					GetZoneContentFriends(c, out zoneBest, out zoneNext, out zonePrevious, 
														   out zoneNextAll, out zonePreviousAll); 

					// Create a restore object able to find the correct Zone in the appropriate 
					// docking direction and then restore into that Zone. If no appropriate Zone 
					// found then create a new one
					return new RestoreContentDockingAffinity(zoneRestore, _state, c, zoneBest, 
															 zoneNext, zonePrevious,
															 zoneNextAll, zonePreviousAll);
				}
			}

			return null;
		}
 public virtual Restore RecordRestore(Window w, object child, Restore childRestore)
 {
     return null;
 }
        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;
        }
        public virtual void LoadFromXml(XmlTextReader xmlIn, int formatVersion)
        {
            LoadInternalFromXml(xmlIn, formatVersion);

            // Move to next xml node
            if (!xmlIn.Read())
                throw new ArgumentException("Could not read in next expected node");

            // Check it has the expected name
            if (xmlIn.Name != "Child")
                throw new ArgumentException("Node 'Child' expected but not found");

            string type = xmlIn.GetAttribute(0);

            if (type != "null")
                _child = CreateFromXml(xmlIn, false, formatVersion);

            // Move past the end element
            if (!xmlIn.Read())
                throw new ArgumentException("Could not read in next expected node");

            // Check it has the expected name
            if (xmlIn.NodeType != XmlNodeType.EndElement)
                throw new ArgumentException("EndElement expected but not found");
        }
 public RestoreWindowContent(Restore child, 
     Content content,
     StringCollection next,
     StringCollection previous,
     bool selected)
     : base(child, content)
 {
     // Remember parameters
     _selected = selected;
     _next = next;
     _previous = previous;
 }
 public Restore(Restore child)
 {
     // Remember parameter
     _child = child;
 }
示例#8
0
文件: Content.cs 项目: uvbs/Holodeck
        internal void LoadFromXml(XmlTextReader xmlIn, int formatVersion)
        {
            // Read in the attribute values
            string attrTitle = xmlIn.GetAttribute(0);
            string attrVisible = xmlIn.GetAttribute(1);
            string attrDocked = xmlIn.GetAttribute(2);
            string attrAutoHide = xmlIn.GetAttribute(3);
            string attrCaptionBar = xmlIn.GetAttribute(4);
            string attrCloseButton = xmlIn.GetAttribute(5);
            string attrDisplaySize = xmlIn.GetAttribute(6);
            string attrDisplayLocation = xmlIn.GetAttribute(7);
            string attrAutoHideSize = xmlIn.GetAttribute(8);
            string attrFloatingSize = xmlIn.GetAttribute(9);
            string attrFullTitle = attrTitle;

            // 'FullTitle' property added in version 5 format and above
            if (formatVersion >= 5)
                attrFullTitle = xmlIn.GetAttribute(10);

            // Convert to correct types
            _title = attrTitle;
            _visible = Convert.ToBoolean(attrVisible);
            _docked = Convert.ToBoolean(attrDocked);
            _autoHidden = Convert.ToBoolean(attrAutoHide);
            _captionBar = Convert.ToBoolean(attrCaptionBar);
            _closeButton = Convert.ToBoolean(attrCloseButton);
            _displaySize = ConversionHelper.StringToSize(attrDisplaySize);
            _displayLocation = ConversionHelper.StringToPoint(attrDisplayLocation);
            _autoHideSize = ConversionHelper.StringToSize(attrAutoHideSize);
            _floatingSize = ConversionHelper.StringToSize(attrFloatingSize);
            _fullTitle = attrFullTitle;

            // Load the Restore objects
            _defaultRestore = Restore.CreateFromXml(xmlIn, true, formatVersion);
            _autoHideRestore  = Restore.CreateFromXml(xmlIn, true, formatVersion);
            _dockingRestore  = Restore.CreateFromXml(xmlIn, true, formatVersion);
            _floatingRestore = Restore.CreateFromXml(xmlIn, true, formatVersion);

            // Move past the end element
            if (!xmlIn.Read())
                throw new ArgumentException("Could not read in next expected node");

            // Check it has the expected name
            if (xmlIn.NodeType != XmlNodeType.EndElement)
                throw new ArgumentException("EndElement expected but not found");
        }
 public Restore()
 {
     // Default state
     _child = null;
 }
 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;
 }
 public RestoreContent(Restore child, Content content)
     : base(child)
 {
     // Remember parameter
     _title = content.Title;
     _content = content;
 }
 public RestoreAutoHideState(Restore child, State state, Content content)
     : base(child, state, content)
 {
 }
 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;
 }
示例#14
0
文件: Content.cs 项目: uvbs/Holodeck
        public Restore RecordAutoHideRestore()
        {
            // Remove any existing restore object
            _autoHideRestore = null;

            // We should be inside a parent window
            if (_parentWindowContent != null)
            {
                // And in the auto hidden state
                if (_autoHidden)
                {
                    // Get access to the AutoHostPanel that contains use
                    AutoHidePanel ahp = _parentWindowContent.DockingManager.AutoHidePanelForContent(this);

                    if (ahp != null)
                    {
                        // Request the ahp create a relevant restore object for us
                        _autoHideRestore = ahp.RestoreObjectForContent(this);
                    }
                }
            }

            return _autoHideRestore;
        }
        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);
        }
示例#16
0
文件: Content.cs 项目: uvbs/Holodeck
        public Restore RecordFloatingRestore()
        {
            // Remove any existing Restore object
            _floatingRestore = null;

            // Do we have a parent window we are inside?
            if (_parentWindowContent != null)
            {
                // Ask the parent to provide a Restore object for us
                _floatingRestore = _parentWindowContent.RecordRestore(this);
            }

            // If we cannot get a valid Restore object from the parent then we have no choice
            // but to use the default restore which is less accurate but better than nothing
            if (_floatingRestore == null)
                _floatingRestore = _defaultRestore;

            return _floatingRestore;
        }
 public RestoreContentState(Restore child, State state, Content content)
     : base(child, content)
 {
     // Remember parameter
     _state = state;
 }
示例#18
0
文件: Content.cs 项目: uvbs/Holodeck
        protected void InternalConstruct(DockingManager manager, 
            Control control,
            string title,
            ImageList imageList,
            int imageIndex,
            Icon icon)
        {
            // Must provide a valid manager instance
            if (manager == null)
                throw new ArgumentNullException("DockingManager");

            // Define the initial object state
            _control = control;
            _title = title;
            _imageList = imageList;
            _imageIndex = imageIndex;
            _icon = icon;
            _manager = manager;
            _parentWindowContent = null;
            _order = _counter++;
            _visible = false;
            _displaySize = new Size(_defaultDisplaySize, _defaultDisplaySize);
            _autoHideSize = new Size(_defaultAutoHideSize, _defaultAutoHideSize);
            _floatingSize = new Size(_defaultFloatingSize, _defaultFloatingSize);
            _displayLocation = new Point(_defaultLocation, _defaultLocation);
            _defaultRestore = new RestoreContentState(State.DockLeft, this);
            _floatingRestore = new RestoreContentState(State.Floating, this);
            _autoHideRestore = new RestoreAutoHideState(State.DockLeft, this);
            _dockingRestore = _defaultRestore;
            _autoHidePanel = null;
            _tag = null;
            _docked = true;
            _captionBar = true;
            _closeButton = true;
            _hideButton = true;
            _autoHidden = false;
            _closeOnHide = false;
            _fullTitle = title;
        }
示例#19
0
 public virtual Restore RecordRestore(Window w, object child, Restore childRestore)
 {
     return(null);
 }