コード例 #1
0
        internal WidgetStyle AddWidgetStyle(AdaptiveView view)
        {
            WidgetStyle style = new WidgetStyle(this, view.Guid);

            _widgetStyles.Add(style.ViewGuid, style);
            return(style);
        }
コード例 #2
0
 internal static void CopyWidgetStyle(WidgetStyle source, WidgetStyle target)
 {
     target.IsVisible     = source.IsVisible;
     target.X             = source.X;
     target.Y             = source.Y;
     target.Height        = source.Height;
     target.Width         = source.Width;
     target.Z             = source.Z;
     target.IsFixed       = source.IsFixed;
     target.WidgetRotate  = source.WidgetRotate;
     target.TextRotate    = source.TextRotate;
     target.FontFamily    = source.FontFamily;
     target.FontSize      = source.FontSize;
     target.Bold          = source.Bold;
     target.Italic        = source.Italic;
     target.Underline     = source.Underline;
     target.Baseline      = source.Baseline;
     target.Overline      = source.Overline;
     target.Strikethrough = source.Strikethrough;
     target.FontColor     = source.FontColor;
     target.BulletedList  = source.BulletedList;
     target.LineColor     = source.LineColor;
     target.LineWidth     = source.LineWidth;
     target.LineStyle     = source.LineStyle;
     target.ArrowStyle    = source.ArrowStyle;
     target.CornerRadius  = source.CornerRadius;
     target.FillColor     = source.FillColor;
     target.Opacity       = source.Opacity;
     target.HorzAlign     = source.HorzAlign;
     target.VertAlign     = source.VertAlign;
 }
コード例 #3
0
        // Clear all view styles and make base view style has the value of the specific new base style
        internal virtual void RebuildStyleChain(WidgetStyle newBaseStyle)
        {
            // Clear all view styles
            _widgetStyles.Clear();

            // Reset base view style value.
            if (newBaseStyle != null)
            {
                Style.CopyStyle(newBaseStyle, _widgetStyle, null, null);
            }
        }
コード例 #4
0
ファイル: PageEmbeddedWidget.cs プロジェクト: naver/protonow
        internal override void RebuildStyleChain(WidgetStyle newBaseStyle)
        {
            base.RebuildStyleChain(newBaseStyle);

            foreach (EmbeddedPage page in EmbeddedPages)
            {
                foreach (Widget widget in page.Widgets)
                {
                    widget.RebuildStyleChain(newBaseStyle);
                }
            }
        }
コード例 #5
0
        internal Widget(Page parentPage, string tagName)
            : base(parentPage, tagName)
        {
            // The value in  _widgetStyle will be set in specific widget(Button, Checkbox...) constructor
            // or loaded from xml element.
            Guid baseViewGuid = Guid.Empty;

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

            _widgetStyles = new WidgetStyles(this);
            InitializeAdaptiveViewStyles();

            _annotation = new Annotation(this);

            _events = new InteractionEvents(this);
            AddWidgetSupportEvents();
        }
コード例 #6
0
        public virtual void SetWidgetStyleAsDefaultStyle(Guid viewGuid)
        {
            if (ParentDocument != null && ParentDocument.IsOpened)
            {
                // Copy value to default style
                WidgetStyle style = GetWidgetStyle(viewGuid) as WidgetStyle;

                if (style != null)
                {
                    List <string> excludingList = new List <string>()
                    {
                        StylePropertyNames.IS_FIXED_PROP,
                        StylePropertyNames.IS_VISIBLE_PROP,
                        StylePropertyNames.X_Prop,
                        StylePropertyNames.Y_Prop,
                        StylePropertyNames.Z_PROP,
                        StylePropertyNames.HEIGHT_PROP,
                        StylePropertyNames.WIDTH_PROP
                    };

                    Style.CopyStyle(style, WidgetDefaultStyle, null, excludingList);
                }
            }
        }
コード例 #7
0
 internal override void RebuildStyleChain(WidgetStyle newBaseStyle)
 {
     base.RebuildStyleChain(newBaseStyle);
     _button.RebuildStyleChain(newBaseStyle);
 }
コード例 #8
0
        internal void PlaceWidgetInternal(Widget widget, bool placeToChild)
        {
            if (widget != null && !_widgetGuidList.Contains(widget.Guid) &&
                ParentDocument != null && ParentDocument.IsOpened)
            {
                _widgetGuidList.Add(widget.Guid);

                if (_widgets != null)
                {
                    _widgets.Add(widget.Guid, widget as Widget);
                }

                // If this widget is never placed in base view before.
                if (widget.HasBeenPlacedInBaseView == false)
                {
                    // If this view is base view, set the flag
                    if (_viewGuid == ParentDocument.AdaptiveViewSet.Base.Guid)
                    {
                        widget.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 (widget.CreatedViewGuid != ParentDocument.AdaptiveViewSet.Base.Guid)
                        {
                            WidgetStyle createdViewStyle = widget.GetWidgetStyle(widget.CreatedViewGuid) as WidgetStyle;
                            WidgetStyle baseViewStyle    = widget.WidgetStyle as WidgetStyle;
                            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.PlaceWidgetInternal(widget, true);
                            }
                        }
                    }
                }
            }
        }
コード例 #9
0
        internal static string BuildRichText(string simpleText, WidgetStyle style)
        {
            Section section = new Section();

            //section.FontFamily = new FontFamily(style.FontFamily);
            //section.Foreground = new SolidColorBrush(Color.FromArgb((byte)(style.FontColor.ARGB >> 24),
            //                (byte)(style.FontColor.ARGB >> 16),
            //                (byte)(style.FontColor.ARGB >> 8),
            //                (byte)(style.FontColor.ARGB)));

            //if (style.Bold)
            //{
            //    section.FontWeight = FontWeights.Bold;
            //}

            section.FontSize = style.FontSize;

            Paragraph para = new Paragraph();

            Run run = new Run(simpleText);

            if (style.Underline)
            {
                run.TextDecorations.Add(TextDecorations.Underline);
            }

            if (style.Strikethrough)
            {
                run.TextDecorations.Add(TextDecorations.Strikethrough);
            }

            if (style.Italic)
            {
                run.FontStyle = FontStyles.Italic;
            }

            if (style.Bold)
            {
                run.FontWeight = FontWeights.Bold;
            }

            run.FontFamily = new FontFamily(style.FontFamily);

            run.FontSize = style.FontSize;

            run.Foreground = new SolidColorBrush(Color.FromArgb((byte)(style.FontColor.ARGB >> 24),
                                                                (byte)(style.FontColor.ARGB >> 16),
                                                                (byte)(style.FontColor.ARGB >> 8),
                                                                (byte)(style.FontColor.ARGB)));

            para.Inlines.Add(run);

            if (style.HorzAlign == Alignment.Left)
            {
                para.TextAlignment = TextAlignment.Left;
            }
            else if (style.HorzAlign == Alignment.Center)
            {
                para.TextAlignment = TextAlignment.Center;
            }
            else
            {
                para.TextAlignment = TextAlignment.Right;
            }

            section.Blocks.Add(para);

            string rValue = System.Windows.Markup.XamlWriter.Save(section);

            return(rValue);
        }