Exemple #1
0
 public OverlayContainer(string name, Docking dock, IWidgetStyle style)
     : base(name, dock, style)
 {
     ZIndex     = 10000;
     AutoScroll = true;
     CanFocus   = true;
 }
        public TextWidget(string name, Docking dock, IWidgetStyle style, string text, IGUIFont font)
            : base(name, dock, style)
        {
            this.m_Padding = new Padding(3);

            this.HAlign = Alignment.Near;
            this.VAlign = Alignment.Center;

            if (text == null)
            {
                m_Text = String.Empty;
            }
            else
            {
                m_Text = text;
            }

            if (font == null)
            {
                m_Font = SummerGUIWindow.CurrentContext.FontManager.DefaultFont;
            }
            else
            {
                m_Font = font;
            }

            m_IconFont = SummerGUIWindow.CurrentContext.FontManager.SmallIcons;
            Format     = FontFormat.DefaultSingleLineCentered;
            CanFocus   = false;
        }
 protected SliderBase(string name, Docking dock, IWidgetStyle style)
     : base(name, dock, style)
 {
     MinValue = 0;
     MaxValue = 1;
     Value    = 0;
 }
        public ComplexSplitContainer(string name, Docking dock, IWidgetStyle style)
            : base(name, dock, style)
        {
            /***
             * PanelLeft = new ScrollableContainer ("panelleft", Docking.Fill, new SplitContainerPanelStyle ());
             * PanelCenter = new ScrollableContainer ("panelcenter", Docking.Fill, new SplitContainerPanelStyle ());
             * PanelBottom = new ScrollableContainer ("panelbottom", Docking.Fill, new SplitContainerPanelStyle ());
             * PanelRight = new ScrollableContainer ("panelright", Docking.Fill, new SplitContainerPanelStyle ());
             ***/

            PanelLeft   = new ScrollableContainer("panelleft", Docking.Fill, new SplitContainerPanelStyle());
            PanelCenter = new ScrollableContainer("panelcenter", Docking.Fill, new EmptyWidgetStyle());
            PanelBottom = new ScrollableContainer("panelbottom", Docking.Fill, new EmptyWidgetStyle());
            PanelRight  = new ScrollableContainer("panelright", Docking.Fill, new EmptyWidgetStyle());

            SplitterLeft   = new VerticalSplitter("leftsplitter", new SplitContainerTransparentSplitterStyle());
            SplitterBottom = new HorizontalSplitter("bottomsplitter", new SplitContainerTransparentSplitterStyle());
            SplitterRight  = new VerticalSplitter("rightsplitter", new SplitContainerTransparentSplitterStyle());

            PanelCenter.Dock = Docking.Fill;

            Children.Add(SplitterLeft);
            Children.Add(SplitterBottom);
            Children.Add(SplitterRight);

            Children.Add(PanelLeft);
            Children.Add(PanelCenter);
            Children.Add(PanelBottom);
            Children.Add(PanelRight);

            SplitterLeft.Distance   = 0.25f;
            SplitterBottom.Distance = -0.25f;
            SplitterRight.Distance  = -0.25f;
        }
        public override void OnPaint(IGUIContext ctx, RectangleF bounds)
        {
            ComboBoxBase parent = Parent as ComboBoxBase;

            if (parent == null)
            {
                return;
            }

            float scrollOffsetY = 0;

            if (VScrollBar != null && VScrollBar.IsVisibleEnabled)
            {
                scrollOffsetY = VScrollBar.Value;
            }

            float itemHeight = parent.ItemHeight;

            for (int i = 0; i < parent.Items.Count; i++)
            {
                RectangleF itemBounds = new RectangleF(bounds.Left, (i * itemHeight) + bounds.Top - scrollOffsetY,
                                                       bounds.Width, itemHeight);

                if (i == SelectedIndex)
                {
                    IWidgetStyle style = Styles.GetStyle(WidgetStates.Selected);
                    ctx.FillRectangle(style.BackColorBrush, itemBounds);
                    parent.DrawItem(ctx, itemBounds, parent.Items[i], style);
                }
                else
                {
                    parent.DrawItem(ctx, itemBounds, parent.Items[i], Style);
                }
            }
        }
Exemple #6
0
 public PanelCaption(string name, string text, IWidgetStyle style)
     : base(name, Docking.Top, style, text, null)
 {
     Styles.SetStyle(new ActiveCaptionPanelStyle(), WidgetStates.Active);
     Format  = FontFormat.DefaultSingleLine;
     Padding = new Padding(6);
 }
        /***
         * public MultiLineTextWidget (string name, string text = null)
         *      : this(name, text, new DefaultTextWidgetStyle())
         * {
         * }
         ***/

        public MultiLineTextWidget(string name, string text = null, IWidgetStyle style = null)
            : base(name, Docking.Fill, style)
        {
            Text = text;
            this.SetFontByTag(CommonFontTags.Default);
            m_Format = FontFormat.DefaultMultiLine;
        }
Exemple #8
0
 public JsWidgetStyle(JsWidget parentJsWidget, IWidgetStyle widgetStyle, IPageView pageView, bool bIsSetMD5)
 {
     _parentJsWidget = parentJsWidget;
     _widgetStyle    = widgetStyle;
     _pageView       = pageView;
     IsSetMD5        = bIsSetMD5;
 }
Exemple #9
0
        protected Widget(string name, Docking dock, IWidgetStyle style)
        {
            unchecked {
                ID = Interlocked.Increment(ref NextID);
            }

            if (name == null)
            {
                Name = String.Empty;
            }
            else
            {
                Name = name;
            }

            if (style != null)
            {
                Styles = new WidgetStyleProvider(style);
            }
            else
            {
                Styles = new WidgetStyleProvider(new EmptyWidgetStyle());
            }

            Dock        = dock;
            ScaleFactor = 1f;

            CanSelect = true;
            // we want to compare sizes fast and implizit
            m_MaxSize       = SizeMax;
            m_Visible       = true;
            Enabled         = true;
            AutoContextMenu = true;
        }
Exemple #10
0
        public MultiLineTextBox(string name, IWidgetStyle style)
            : base(name, Docking.Fill, style)
        {
            m_Font          = SummerGUIWindow.CurrentContext.FontManager.MonoFont;
            RowManager      = new MultiLineTextManager(this, SpecialCharacterFlags.All);
            UndoRedoManager = new UndoRedoStack(this, 100);
            CursorOptions   = CursorFlags.Default;
            CanFocus        = true;
            HideSelection   = true;
            AutoScroll      = true;
            ScrollBars      = ScrollBars.Vertical;
            VScrollBar.SetColorScheme(ScrollBarColorSchemes.Dark);

            Padding   = new Padding(Font.Height, Font.LineHeight / 2);
            CursorPen = new Pen(Theme.Colors.White, 1.5f);

            BreakWidthRulerVisible = true;

            RowManager.LoadingCompleted += delegate {
                RowManager.MoveHome();
                ScrollOffsetX = 0;
                ScrollOffsetY = 0;
                IsLoading     = false;
                OnEnabledChanged();

                RowManager.Paragraphs.UpdateCompleted += delegate {
                    try {
                        EnsureCurrentRowVisible();
                        Invalidate(1);
                    } catch (Exception ex) {
                        ex.LogError();
                    }
                };
            };
        }
Exemple #11
0
 public Panel(string name, Docking dock, IWidgetStyle style)
     : base(name, dock, style)
 {
     // ToDo: GUG BUG BUG
     //CanFocus = false;
     TabIndex = -1;
 }
 public TableLayoutContainer(string name, IWidgetStyle style)
     : base(name, Docking.Fill, style)
 {
     Layout             = new TableLayout(this);
     Layout.CellPadding = new SizeF(12f, 6f);
     Margin             = Padding.Empty;
     Padding            = Padding.Empty;
 }
Exemple #13
0
 public SideMenuContainer(string name, IGuiMenu menu, IWidgetStyle style = null)
     : base(name, Docking.Fill, style ?? new EmptyGradientWidgetStyle())
 {
     IsMenu = true;
     Menu   = menu;
     Style.BackColorBrush = new LinearGradientBrush(Theme.Colors.Base00, Theme.Colors.Base0, GradientDirections.BackwardDiagonal);
     //Style.BackColorBrush = new LinearGradientBrush (Theme.Colors.Base0, Theme.Colors.Base00);
 }
        /// <summary>
        /// Add a highlighting theme into the collection
        /// of highlighting themes stored in this object.
        /// </summary>
        /// <param name="styleName"></param>
        /// <param name="style"></param>
        public void AddWidgetStyle(string styleName, IWidgetStyle style)
        {
            if (this.mGlobalStyles == null)
            {
                this.mGlobalStyles = new Dictionary <string, IWidgetStyle>();
            }

            this.mGlobalStyles.Add(styleName, style);
        }
Exemple #15
0
 public override void DrawItem(IGUIContext ctx, RectangleF bounds,
                               ComboBoxItem item, IWidgetStyle style)
 {
     if (item == null)
     {
         return;
     }
     // ToDo: DPI Scaling
     bounds.Inflate(-TextMargin.Width, 0);
     ctx.DrawString(item.Text, TB.Font, style.ForeColorBrush, bounds, FontFormat.DefaultSingleLine);
 }
Exemple #16
0
        public ConsoleOutputWidget(string name, Docking dock, IWidgetStyle style)
            : base(name, dock, style)
        {
            //Font = ApplicationWindow.CurrentContext.FontManager.MonoFont;
            Padding            = new Padding(16);
            IsAnimationRunning = false;

            Logger           = new EventLogger(LogLevels.Verbose);
            Logger.LogEvent += (sender, e) => AddParagraph(e.Message.Replace("\t", "  "));
            Logging.RegisterLogger(Logger);
        }
Exemple #17
0
		protected SplitterBase(string name, SplitOrientation orientation, IWidgetStyle style)
			: base(name, Docking.None, style)
		{			
			//Styles.SetStyle (new SplitContainerSplitterStyle (), WidgetStates.Pressed);
			Styles.SetStyle (style, WidgetStates.Pressed);
			ZIndex = 1100;	// must be above Scrollbars!
			Orientation = orientation;
			SplitterWidth = 4;
			MinDistanceNear = 100;		
			MinDistanceFar = 50;
			Distance = 0.25f;
		}
Exemple #18
0
        public IObjectContainer AddMasterPageObject(Guid masterPageGuid, Guid viewGuid, double x = 0, double y = 0)
        {
            IObjectContainer container = ParentPage.AddMasterPageObject(masterPageGuid, viewGuid);

            IMasterPage masterPage = ParentDocument.MasterPages[masterPageGuid];

            masterPage.Open();

            PageView masterPageView = masterPage.PageViews[viewGuid] as PageView;

            if (masterPageView == null)
            {
                masterPageView = masterPage.PageViews[ParentDocument.AdaptiveViewSet.Base.Guid] as PageView;
            }

            double xDelta = masterPageView.PageViewStyle.X - x;
            double yDelta = masterPageView.PageViewStyle.Y - y;

            foreach (Widget widget in container.WidgetList)
            {
                // Set the created view as the current view because this is the first time when the widget
                // is added in the current document.
                widget.CreatedViewGuid = _viewGuid;

                // Set this flag to false. PlaceWidgetInternal method will set this flag base on checking
                // if this is base view.
                widget.HasBeenPlacedInBaseView = false;

                // Get widget style in this view.
                IWidgetStyle widgetViewStyle = widget.GetWidgetStyle(_viewGuid);

                // Widgets in master page should have same relative location, so make them have the same delta.
                widgetViewStyle.X -= xDelta;
                widgetViewStyle.Y -= yDelta;

                if (widget is IHamburgerMenu)
                {
                    IHamburgerMenu       menu   = widget as IHamburgerMenu;
                    IHamburgerMenuButton button = menu.MenuButton;

                    IWidgetStyle buttonViewStyle = button.GetWidgetStyle(_viewGuid);
                    buttonViewStyle.X -= xDelta;
                    buttonViewStyle.Y -= yDelta;
                }

                PlaceWidgetInternal(widget, true);
            }

            // Master Page doesn't contain masters, so we don't handle container.MasterList.

            return(container);
        }
Exemple #19
0
        public void SetRichText(string simpleText, IWidgetStyle style = null)
        {
            if (style == null)
            {
                _richText = BuildRichText(simpleText, _widgetStyle);
            }
            else
            {
                _richText = BuildRichText(simpleText, style as WidgetStyle);
            }

            _text = simpleText;
        }
Exemple #20
0
        public override void AppendSpecificTypeStyle(StringBuilder builder, IWidgetStyle widgetStyle)
        {
            base.AppendSpecificTypeStyle(builder, widgetStyle);

            ITextBase textBase = widgetStyle.OwnerWidget as ITextBase;

            if (textBase.HideBorder)
            {
                builder.Append("\"border-color\":\"transparent\",");
            }

            builder.AppendFormat("\"background-color\":\"{0}\",", JsHelper.GetRGBAColor(widgetStyle.FillColor));
        }
Exemple #21
0
        public static void AppendRichTextStyle(StringBuilder builder, IWidgetStyle widgetStyle)
        {
            if (widgetStyle.VertAlign == Alignment.Center || widgetStyle.VertAlign == Alignment.Middle)
            {
                builder.Append("\"vertical-align\":\"middle\",");
            }
            else
            {
                builder.AppendFormat("\"vertical-align\":\"{0}\",", widgetStyle.VertAlign.ToString().ToLower());
            }

            // Text Alignment
            builder.AppendFormat("\"text-align\":\"{0}\",", widgetStyle.HorzAlign.ToString().ToLower());
        }
Exemple #22
0
        public static string GetHash(IWidgetStyle style, bool bIsPlaced, bool bIsSetTarget = false)
        {
            if (style == null)
            {
                return(string.Empty);
            }
            SerialWidgetStyle target = new SerialWidgetStyle(style, bIsPlaced);
            string            md5    = CreaetMD5Hash(target, bIsSetTarget);

            if (bIsSetTarget == true)
            {
                style.MD5 = md5;
            }
            return(md5);
        }
Exemple #23
0
        public Button(string name, string text, char icon, IWidgetStyle style)
            : base(name, Docking.Left, style, text, SummerGUIWindow.CurrentContext.GetFont(CommonFontTags.Status))
        {
            Padding = new Padding(10, 4, 10, 4);

            //TextOffsetY = -1;
            Text = text;
            OnTextChanged();
            Icon = icon;

            //Font = SummerGUIWindow.CurrentContext.GetFont(CommonFontTags.Status);
            //IconFontTag = CommonFontTags.SmallIcons.ToString ();

            CanFocus        = true;
            HandlesEnterKey = true;
        }
Exemple #24
0
        public ApplicationToolBar(string name, IGuiMenu menu, IWidgetStyle style)
            : base(name, menu, style)
        {
            HamburgerMenu          = new ToolBarButton("hamburger", null, (char)FontAwesomeIcons.fa_navicon);
            HamburgerMenu.Dock     = Docking.Right;
            HamburgerMenu.ZIndex  += 100;
            HamburgerMenu.Margin   = new Padding(6, 3, 6, 3);
            HamburgerMenu.CanFocus = false;
            HamburgerMenu.Tooltip  = "Sidebar Menu";
            //HamburgerMenu.IsToggleButton = true;

            //HamburgerMenu.Margin = new Padding (4);
            HamburgerMenu.SetIconFontByTag(CommonFontTags.MediumIcons);
            AddChild(HamburgerMenu);

            RefreshMenu();
        }
Exemple #25
0
        public override void AppendSpecificTypeStyle(StringBuilder builder, IWidgetStyle widgetStyle)
        {
            // Set the image file hash value for styles
            string hash = _service.ImagesStreamManager.GetConsumerStreamHash(_widget.Guid, widgetStyle.ViewGuid);

            if (String.IsNullOrEmpty(hash) &&
                widgetStyle.ViewGuid == _widget.ParentDocument.AdaptiveViewSet.Base.Guid)
            {
                // If not find and it is base view, try to load again with empty view guid.
                hash = _service.ImagesStreamManager.GetConsumerStreamHash(_widget.Guid, Guid.Empty);
            }

            if (!String.IsNullOrEmpty(hash))
            {
                builder.AppendFormat("\"hash\":\"{0}\",", hash);
            }
        }
Exemple #26
0
        public static void AppendBorderStyle(StringBuilder builder, IWidgetStyle widgetStyle)
        {
            // There is no border
            if (widgetStyle.LineWidth < 1)
            {
                return;
            }

            builder.AppendFormat("\"width\":\"{0}px\",", Math.Round(widgetStyle.LineWidth));

            switch (widgetStyle.LineStyle)
            {
            case LineStyle.Solid:
            {
                builder.Append("\"type\":\"1\",");
                break;
            }

            case LineStyle.Dot:
            {
                builder.Append("\"type\":\"2\",");
                break;
            }

            case LineStyle.DashDot:
            {
                builder.Append("\"type\":\"3\",");
                break;
            }

            case LineStyle.DashDotDot:
            {
                builder.Append("\"type\":\"4\",");
                break;
            }

            default:
            {
                builder.Append("\"type\":\"0\",");
                break;
            }
            }

            builder.AppendFormat("\"color\":\"{0}\",", JsHelper.GetRGBAColor(widgetStyle.LineColor));
        }
        public QuatSplitter(string name, Docking dock, IWidgetStyle style)
            : base(name, dock, style)
        {
            Panel1 = new ScrollableContainer("panel1", Docking.Fill, new SplitContainerPanelStyle());
            Panel2 = new ScrollableContainer("panel2", Docking.Fill, new SplitContainerPanelStyle());
            Panel3 = new ScrollableContainer("panel3", Docking.Fill, new SplitContainerPanelStyle());
            Panel4 = new ScrollableContainer("panel4", Docking.Fill, new SplitContainerPanelStyle());

            Splitter1 = new HorizontalSplitter();
            Splitter2 = new VerticalSplitter();

            Children.Add(Splitter1);
            Children.Add(Splitter2);
            Children.Add(Panel1);
            Children.Add(Panel2);
            Children.Add(Panel3);
            Children.Add(Panel4);
        }
        public ScrollingBox(string name, Docking dock, IWidgetStyle style)
            : base(name, dock, style)
        {
            Font = SummerGUIWindow.CurrentContext.FontManager.DefaultFont;

            // ToDo: DPI Scaling: Faster ! (0 or 1)
            AnimationRate = 2;

            Padding = new Padding(12);

            Items = new ScrollingBoxCollection();

            Alignment = StringAlignment.Center;
            //Format = FontFormat.DefaultSingleLineCentered;
            Format             = FontFormat.DefaultMultiLine;
            ImagePadding       = new Padding(0, 21);
            IsAnimationRunning = true;
        }
Exemple #29
0
        public StatusBar(string name, IWidgetStyle style)
            : base(name, Docking.Bottom, style)
        {
            this.ZIndex  = 5000;
            this.Padding = new Padding(6, 3, 5, 3);
            this.Margin  = Padding.Empty;

            DefaultPanel = new StatusTextPanel("default", Docking.Fill, "");
            this.AddChild(DefaultPanel);

            ProgressPanel         = new StatusProgressPanel("progress");
            ProgressPanel.Visible = false;
            this.AddChild(ProgressPanel);

            RootControllerObserver = new Observer <EventMessage> (OnNext, OnError, OnCompleted);

            ReadyStatusString = "Ready.";
            ShowStatus();
        }
Exemple #30
0
        protected ToolBarBase(string name, IGuiMenu menu, IWidgetStyle style)
            : base(name, Docking.Top, style)
        {
            IsMenu = true;
            Menu   = menu;
            if (Menu == null)
            {
                Menu = new GuiMenu(name + "_menu");
            }

            this.ZIndex  = 1000;
            this.Padding = new Padding(3, 2, 3, 2);
            MinSize      = new Size(0, 16);

            CanFocus = false;
            TabIndex = -1;

            RefreshMenu();
        }