Ejemplo n.º 1
0
		public WindowPage()
			: base("Window")
		{
			WindowWidget widow = new WindowWidget(new RectangleDouble(20, 20, 400, 400));
			AddChild(widow);

			GroupBox groupBox = new GroupBox("Radio Group");
			groupBox.LocalBounds = new RectangleDouble(0, 0, 300, 100);
			groupBox.OriginRelativeParent = new Vector2(0, 0);
			groupBox.AddChild(new RadioButton(0, 40, "Simple Radio Button 1"));
			groupBox.AddChild(new RadioButton(0, 20, "Simple Radio Button 2"));
			groupBox.AddChild(new RadioButton(0, 0, "Simple Radio Button 3"));
			widow.AddChild(groupBox);
		}
Ejemplo n.º 2
0
        /// <summary>
        /// Creates or connects a PlatformWindow to the given SystemWindow
        /// </summary>
        public virtual void ShowSystemWindow(SystemWindow systemWindow)
        {
            if (_openWindows.Count == 0)
            {
                this._openWindows.Add(systemWindow);
            }
            else
            {
                if (systemWindow.PlatformWindow != null)
                {
                    return;
                }

                var overlayWindow = new SystemWindow(_openWindows.FirstOrDefault().Width, _openWindows.FirstOrDefault().Height)
                {
                    PlatformWindow = platformWindow
                };

                systemWindow.HAnchor = HAnchor.Stretch;
                systemWindow.VAnchor = VAnchor.Stretch;

                var theme = ApplicationController.Instance.Theme;

                var movable = new WindowWidget(systemWindow)
                {
                    WindowBorderColor = new Color(theme.Colors.PrimaryAccentColor, 175)
                };
                overlayWindow.AddChild(movable);

                var closeButton = theme.CreateSmallResetButton();
                closeButton.HAnchor     = HAnchor.Right;
                closeButton.ToolTipText = "Close".Localize();
                closeButton.Click      += (s, e) =>
                {
                    systemWindow.Close();
                };

                var titleBarRow = new Toolbar(theme, closeButton)
                {
                    HAnchor = HAnchor.Stretch,
                    VAnchor = VAnchor.Fit | VAnchor.Center,
                };

                titleBarRow.AddChild(new ImageWidget(AggContext.StaticData.LoadIcon("mh.png", 16, 16, theme.InvertIcons))
                {
                    Margin  = new BorderDouble(4, 0, 6, 0),
                    VAnchor = VAnchor.Center
                });

                titleBarRow.ActionArea.AddChild(new TextWidget(systemWindow.Title ?? "", pointSize: theme.DefaultFontSize - 1, textColor: theme.Colors.PrimaryTextColor)
                {
                    VAnchor = VAnchor.Center,
                });

                movable.TitleBar.BackgroundColor = theme.TabBarBackground;

                movable.TitleBar.AddChild(titleBarRow);

                systemWindow.Closed += (s, e) =>
                {
                    overlayWindow.Close();
                };

                movable.Width += 1;

                movable.Position = new VectorMath.Vector2((overlayWindow.Width - movable.Width) / 2, (overlayWindow.Height - movable.Height) / 2);

                this._openWindows.Add(overlayWindow);
            }

            TopWindow = _openWindows.LastOrDefault();

            platformWindow.ShowSystemWindow(TopWindow);
        }