protected void InitText(string message, ColorContexts colorContext) { Message = message; TW = new MultiLineTextWidget("message", message, new WidgetStyle(Color.Empty, Theme.GetContextForeColor(colorContext), Color.Empty)); TW.Padding = new Padding(16); TW.VAlign = Alignment.Center; TW.HAlign = Alignment.Center; this.OnLayout(CTX, CTX.Bounds); // Layout the text RectangleF bounds = ContentPanel.ClientRectangle; SizeF sz = TW.PreferredSize(CTX, bounds.Size); if (sz.Height > bounds.Height) { ScrollableContainer container = ContentPanel.AddChild(new ScrollableContainer("scroller")); container.ScrollBars = ScrollBars.Vertical; container.AutoScroll = true; TW.Dock = Docking.Top; container.AddChild(TW); } else { ContentPanel.AddChild(TW); } }
protected virtual void InitIconImage(char icon, ColorContexts colorContext) { IconText = new TextWidget("icon", Docking.Top, new EmptyWidgetStyle(), null, null); IconText.IconFont = CTX.FontManager.FontByTag(CommonFontTags.LargeIcons); IconText.Icon = icon; IconText.ForeColor = Color.White; ContentPanel.AddChild(IconText); }
public MessageBoxOverlay(IGUIContext ctx, ColorContexts colorContext) : base("messagebox") { CTX = ctx; ColorContext = colorContext; CanFocus = true; ContentPanel = AddChild(new Panel("contents", Docking.Fill, new WidgetStyle(Theme.GetContextColor(colorContext), Theme.GetContextForeColor(colorContext), Color.Empty))); // panel ButtonContainer = ContentPanel.AddChild(new ButtonContainer("buttoncontainer", Docking.Bottom, new EmptyWidgetStyle())); ButtonContainer.FlexDirection = FlexDirections.RowCenter; }