Ejemplo n.º 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);
        }
Ejemplo n.º 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;
		}
Ejemplo n.º 3
0
 public virtual Restore RecordRestore(Window w, object child, Restore childRestore)
 {
     return null;
 }
Ejemplo n.º 4
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.º 5
0
        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");
        }
Ejemplo n.º 6
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.º 7
0
 public Restore(Restore child)
 {
     // Remember parameter
     _child = child;
 }
Ejemplo n.º 8
0
        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");
        }
Ejemplo n.º 9
0
 public Restore()
 {
     // Default state
     _child = null;
 }
Ejemplo n.º 10
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.º 11
0
 public RestoreContent(Restore child, Content content)
     : base(child)
 {
     // Remember parameter
     _title = content.Title;
     _content = content;
 }
Ejemplo n.º 12
0
 public RestoreAutoHideState(Restore child, State state, Content content)
     : base(child, state, content)
 {
 }
Ejemplo n.º 13
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.º 14
0
        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;
        }
Ejemplo n.º 15
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.º 16
0
        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;
        }
Ejemplo n.º 17
0
 public RestoreContentState(Restore child, State state, Content content)
     : base(child, content)
 {
     // Remember parameter
     _state = state;
 }
Ejemplo n.º 18
0
        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;
        }
Ejemplo n.º 19
0
 public virtual Restore RecordRestore(Window w, object child, Restore childRestore)
 {
     return(null);
 }