Esempio n. 1
0
        protected override void PartAdded(string partName, object instance)
        {
            //Debug.Log("PartAdded: " + partName);

            base.PartAdded(partName, instance);

            if (instance == ContentGroup)
            {
                //Debug.Log("Part added: ContentGroup: " + ContentGroup);
                if (_contentModified)
                {
                    if (_placeHolderGroup != null)
                    {
                        for (int i = _placeHolderGroup.NumberOfChildren - 1; i >= 0; i--)
                        {
                            var child = _placeHolderGroup.RemoveChildAt(i);
                            ContentGroup.AddChildAt(child, 0);
                        }
                    }
                }

                // copy proxied values from contentGroupProperties (if set) to contentGroup

                var newContentGroupProperties = new ContentGroupProperties();

                if (null != _contentGroupProperties.AutoLayout)
                {
                    ContentGroup.AutoLayout = (bool)_contentGroupProperties.AutoLayout;
                    newContentGroupProperties.AutoLayoutSet = true;
                }

                if (null != _contentGroupProperties.Layout)
                {
                    ContentGroup.Layout = _contentGroupProperties.Layout;
                    newContentGroupProperties.LayoutSet = true;
                }

                _contentGroupProperties = newContentGroupProperties;

                ContentGroup.AddEventListener(
                    ElementExistenceEvent.ELEMENT_ADD, ContentGroupElementAddedHandler);
                ContentGroup.AddEventListener(
                    ElementExistenceEvent.ELEMENT_REMOVE, ContentGroupElementRemovedHandler);

                if (null != _placeHolderGroup)
                {
                    _placeHolderGroup.RemoveEventListener(
                        ElementExistenceEvent.ELEMENT_ADD, ContentGroupElementAddedHandler);
                    _placeHolderGroup.RemoveEventListener(
                        ElementExistenceEvent.ELEMENT_REMOVE, ContentGroupElementRemovedHandler);

                    _placeHolderGroup = null;
                }
            }
        }
Esempio n. 2
0
        protected override void PartRemoved(string partName, object instance)
        {
            base.PartRemoved(partName, instance);

            if (instance == ContentGroup)
            {
                ContentGroup.RemoveEventListener(
                    ElementExistenceEvent.ELEMENT_ADD, ContentGroupElementAddedHandler);
                ContentGroup.RemoveEventListener(
                    ElementExistenceEvent.ELEMENT_REMOVE, ContentGroupElementRemovedHandler);

                // copy proxied values from contentGroup (if explicitely set) to contentGroupProperties

                ContentGroupProperties newContentGroupProperties = new ContentGroupProperties();

                //if (BitFlagUtil.isSet(contentGroupProperties as uint, AUTO_LAYOUT_PROPERTY_FLAG))
                if (_contentGroupProperties.AutoLayoutSet)
                {
                    newContentGroupProperties.AutoLayout = ContentGroup.AutoLayout;
                }

                //if (BitFlagUtil.isSet(contentGroupProperties as uint, LAYOUT_PROPERTY_FLAG))
                if (_contentGroupProperties.LayoutSet)
                {
                    newContentGroupProperties.Layout = ContentGroup.Layout;
                }

                _contentGroupProperties = newContentGroupProperties;

                if (_contentModified)
                {
                    _placeHolderGroup = new Group();

                    _placeHolderGroup.AddEventListener(
                        ElementExistenceEvent.ELEMENT_ADD, ContentGroupElementAddedHandler);
                    _placeHolderGroup.AddEventListener(
                        ElementExistenceEvent.ELEMENT_REMOVE, ContentGroupElementRemovedHandler);
                }

                ContentGroup.Layout = null;
            }
        }
Esempio n. 3
0
        protected override void PartRemoved(string partName, object instance)
        {
            base.PartRemoved(partName, instance);

            if (instance == ContentGroup) {
                ContentGroup.RemoveEventListener(
                    ElementExistenceEvent.ELEMENT_ADD, ContentGroupElementAddedHandler);
                ContentGroup.RemoveEventListener(
                    ElementExistenceEvent.ELEMENT_REMOVE, ContentGroupElementRemovedHandler);
                
                // copy proxied values from contentGroup (if explicitely set) to contentGroupProperties
                
                ContentGroupProperties newContentGroupProperties = new ContentGroupProperties();
                
                //if (BitFlagUtil.isSet(contentGroupProperties as uint, AUTO_LAYOUT_PROPERTY_FLAG))
                if (_contentGroupProperties.AutoLayoutSet)
                    newContentGroupProperties.AutoLayout = ContentGroup.AutoLayout;
                
                //if (BitFlagUtil.isSet(contentGroupProperties as uint, LAYOUT_PROPERTY_FLAG))
                if (_contentGroupProperties.LayoutSet)
                    newContentGroupProperties.Layout = ContentGroup.Layout;
                    
                _contentGroupProperties = newContentGroupProperties;
                
                if (_contentModified)
                {
                    _placeHolderGroup = new Group();
                         
                    _placeHolderGroup.AddEventListener(
                        ElementExistenceEvent.ELEMENT_ADD, ContentGroupElementAddedHandler);
                    _placeHolderGroup.AddEventListener(
                        ElementExistenceEvent.ELEMENT_REMOVE, ContentGroupElementRemovedHandler);
                }
                
                ContentGroup.Layout = null;
            }
        }
Esempio n. 4
0
        protected override void PartAdded(string partName, object instance)
        {
            //Debug.Log("PartAdded: " + partName);

            base.PartAdded(partName, instance);

            if (instance == ContentGroup) 
            {
                //Debug.Log("Part added: ContentGroup: " + ContentGroup);
                if (_contentModified)
                {
                    if (_placeHolderGroup != null)
                    {
                        for (int i = _placeHolderGroup.NumberOfChildren - 1; i >= 0; i--)
                        {
                            var child = _placeHolderGroup.RemoveChildAt(i);
                            ContentGroup.AddChildAt(child, 0);
                        }
                    }
                }
                
                // copy proxied values from contentGroupProperties (if set) to contentGroup

                var newContentGroupProperties = new ContentGroupProperties();

                if (null != _contentGroupProperties.AutoLayout)
                {
                    ContentGroup.AutoLayout = (bool) _contentGroupProperties.AutoLayout;
                    newContentGroupProperties.AutoLayoutSet = true;
                }
                
                if (null != _contentGroupProperties.Layout)
                {
                    ContentGroup.Layout = _contentGroupProperties.Layout;
                    newContentGroupProperties.LayoutSet = true;
                }
                
                _contentGroupProperties = newContentGroupProperties;
                
                ContentGroup.AddEventListener(
                    ElementExistenceEvent.ELEMENT_ADD, ContentGroupElementAddedHandler);
                ContentGroup.AddEventListener(
                    ElementExistenceEvent.ELEMENT_REMOVE, ContentGroupElementRemovedHandler);
                
                if (null != _placeHolderGroup)
                {
                    _placeHolderGroup.RemoveEventListener(
                        ElementExistenceEvent.ELEMENT_ADD, ContentGroupElementAddedHandler);
                    _placeHolderGroup.RemoveEventListener(
                        ElementExistenceEvent.ELEMENT_REMOVE, ContentGroupElementRemovedHandler);
                    
                    _placeHolderGroup = null;
                }
            }
        }