Exemple #1
0
		// This method can be called by containers to register new objects in the tree.
		// Unless an object is registered in this way, no status will be tracked for it.
		// The provided status element must be a direct or indirect child of the parent status.
		internal void RegisterObject (ObjectWrapper w, XmlElement status)
		{
			VerifyManager ();
				
			if (IsRegistered (w))
				throw new InvalidOperationException ("Object already registered: " + w.GetType ());

			elements [w] = GetLocalElement (status);
			
			w.Disposed += OnObjectDisposed;
		}
Exemple #2
0
        // This method can be called by containers to register new objects in the tree.
        // Unless an object is registered in this way, no status will be tracked for it.
        // The provided status element must be a direct or indirect child of the parent status.
        internal void RegisterObject(ObjectWrapper w, XmlElement status)
        {
            VerifyManager();

            if (IsRegistered(w))
            {
                throw new InvalidOperationException("Object already registered: " + w.GetType());
            }

            elements [w] = GetLocalElement(status);

            w.Disposed += OnObjectDisposed;
        }
Exemple #3
0
        static void SetOverrideProperties(ObjectWrapper wrapper, Hashtable overrideProps)
        {
            foreach (TypedPropertyDescriptor prop in overrideProps.Keys)
            {
                XmlElement prop_elem = overrideProps[prop] as XmlElement;

                try {
                    GLib.Value value = ParseProperty(prop.ParamSpec, prop.PropertyType, prop_elem.InnerText);
                    prop.SetValue(wrapper.Wrapped, value.Val);
                } catch {
                    throw new GladeException("Could not parse property", wrapper.GetType().ToString(), wrapper is Stetic.Wrapper.Container.ContainerChild, prop.GladeName, prop_elem.InnerText);
                }
            }
        }
Exemple #4
0
        PropertyInfo FindBoolProperty(object obj, out object target)
        {
            PropertyInfo prop = obj.GetType().GetProperty(name, flags);

            if (prop != null && prop.PropertyType == typeof(bool))
            {
                target = obj;
                return(prop);
            }

            ObjectWrapper wrap = ObjectWrapper.Lookup(obj);

            if (wrap != null)
            {
                prop = wrap.GetType().GetProperty(name, flags);
                if (prop != null && prop.PropertyType == typeof(bool))
                {
                    target = wrap;
                    return(prop);
                }
            }
            target = null;
            return(null);
        }
		static void SetOverrideProperties (ObjectWrapper wrapper, Hashtable overrideProps)
		{
			foreach (TypedPropertyDescriptor prop in overrideProps.Keys) {
				XmlElement prop_elem = overrideProps[prop] as XmlElement;

				try {
					GLib.Value value = ParseProperty (prop.ParamSpec, prop.PropertyType, prop_elem.InnerText);
					prop.SetValue (wrapper.Wrapped, value.Val);
				} catch {
					throw new GladeException ("Could not parse property", wrapper.GetType ().ToString (), wrapper is Stetic.Wrapper.Container.ContainerChild, prop.GladeName, prop_elem.InnerText);
				}
			}
		}
Exemple #6
0
        // This method can be called to update the xml tree, for example when a change in the
        // object is detected.
        internal void UpdateObjectStatus(ObjectWrapper w, XmlElement status)
        {
            VerifyManager();

            XmlElement oldElem = (XmlElement)elements [w];

            if (oldElem == null)
            {
                throw new InvalidOperationException("Could not update unregistered object of type " + w.GetType());
            }

            if (oldElem != status)
            {
                XmlElement newElem = GetLocalElement(status);
                if (oldElem.ParentNode != null)
                {
                    oldElem.ParentNode.ReplaceChild(newElem, oldElem);
                    elements [w] = newElem;
                }
                else
                {
                    if (w != root)
                    {
                        throw new InvalidOperationException("Root element does not match the root widget: " + w.GetType());
                    }
                    elements [w] = newElem;
                }
            }
        }
Exemple #7
0
        // Returns the xml that describes the specified widget (including information for all
        // children of the widget).
        internal XmlElement GetObjectStatus(ObjectWrapper w)
        {
            VerifyManager();

            XmlElement elem = (XmlElement)elements [w];

            if (elem == null)
            {
                throw new InvalidOperationException("No status found for object of type " + w.GetType());
            }
            return(elem);
        }
Exemple #8
0
		// This method can be called to update the xml tree, for example when a change in the
		// object is detected.
		internal void UpdateObjectStatus (ObjectWrapper w, XmlElement status)
		{
			VerifyManager ();
			
			XmlElement oldElem = (XmlElement) elements [w];
			if (oldElem == null)
				throw new InvalidOperationException ("Could not update unregistered object of type " + w.GetType ());

			if (oldElem != status) {
				XmlElement newElem = GetLocalElement (status);
				if (oldElem.ParentNode != null) {
					oldElem.ParentNode.ReplaceChild (newElem, oldElem);
					elements [w] = newElem;
				} else {
					if (w != root)
						throw new InvalidOperationException ("Root element does not match the root widget: " + w.GetType ());
					elements [w] = newElem;
				}
			}
		}
Exemple #9
0
		// Returns the xml that describes the specified widget (including information for all
		// children of the widget).
		internal XmlElement GetObjectStatus (ObjectWrapper w)
		{
			VerifyManager ();
				
			XmlElement elem = (XmlElement) elements [w];
			if (elem == null)
				throw new InvalidOperationException ("No status found for object of type " + w.GetType ());
			return elem;
		}