Пример #1
0
        internal MasterStyle AddMasterStyle(AdaptiveView view)
        {
            MasterStyle style = new MasterStyle(this, view.Guid);

            _masterStyles.Add(style.ViewGuid, style);
            return(style);
        }
Пример #2
0
 internal static void CopyMasterStyle(MasterStyle source, MasterStyle target)
 {
     target.IsVisible = source.IsVisible;
     target.X         = source.X;
     target.Y         = source.Y;
     target.Z         = source.Z;
     target.IsFixed   = source.IsFixed;
 }
Пример #3
0
        // Clear all view styles and make base view style has the value of the specific new base style
        internal void RebuildStyleChain(MasterStyle newBaseStyle)
        {
            // Clear all view styles
            _masterStyles.Clear();

            // Reset base view style value.
            if (newBaseStyle != null)
            {
                Style.CopyStyle(newBaseStyle, _masterStyle, null, null);
            }
        }
Пример #4
0
        internal Master(MasterPage masterPage, Page parentPage)
            : base(parentPage, "Master")
        {
            Guid baseViewGuid = Guid.Empty;

            if (ParentDocument != null && ParentDocument.IsOpened)
            {
                baseViewGuid = ParentDocument.AdaptiveViewSet.Base.Guid;
            }
            _masterStyle = new MasterStyle(this, baseViewGuid);

            _masterStyles = new MasterStyles(this);
            InitializeAdaptiveViewStyles();

            _masterPage = masterPage;

            if (masterPage != null)
            {
                _masterPageGuid = _masterPage.Guid;
            }
        }
Пример #5
0
        internal void PlaceMasterInternal(Master master, bool placeToChild)
        {
            if (master != null && !_masterGuidList.Contains(master.Guid) &&
                ParentDocument != null && ParentDocument.IsOpened)
            {
                _masterGuidList.Add(master.Guid);

                if (_masters != null)
                {
                    _masters.Add(master.Guid, master as Master);
                }

                // If this master is never placed in base view before.
                if (master.HasBeenPlacedInBaseView == false)
                {
                    // If this view is base view, set the flag
                    if (_viewGuid == ParentDocument.AdaptiveViewSet.Base.Guid)
                    {
                        master.HasBeenPlacedInBaseView = true;

                        // If the widget is not created in base view, set the create view style as the base view style.
                        // If the widget is IPageEmbeddedWidget, we don't update the child widgets style.
                        if (master.CreatedViewGuid != ParentDocument.AdaptiveViewSet.Base.Guid)
                        {
                            MasterStyle createdViewStyle = master.GetMasterStyle(master.CreatedViewGuid) as MasterStyle;
                            MasterStyle baseViewStyle    = master.MasterStyle as MasterStyle;
                            if (createdViewStyle != null)
                            {
                                Style.CopyStyle(createdViewStyle, baseViewStyle, null, null);
                            }
                        }
                    }
                }

                // Place to child page view.
                if (placeToChild)
                {
                    IAdaptiveView view = null;
                    if (_viewGuid == ParentDocument.AdaptiveViewSet.Base.Guid)
                    {
                        view = ParentDocument.AdaptiveViewSet.Base;
                    }
                    else
                    {
                        view = ParentDocument.AdaptiveViewSet.AdaptiveViews[_viewGuid];
                    }

                    if (view != null)
                    {
                        foreach (AdaptiveView childView in view.ChildViews)
                        {
                            PageView childPageView = ParentPage.PageViews[childView.Guid] as PageView;
                            if (childPageView != null)
                            {
                                childPageView.PlaceMasterInternal(master, true);
                            }
                        }
                    }
                }
            }
        }