コード例 #1
0
 protected virtual void InitIconImage(char icon, ColorContexts colorContext)
 {
     ImagePanelContainer = Controls.AddChild(new Panel("imagecontainer", Docking.Left, new BrightPanelWidgetStyle()));
     IconText            = ImagePanelContainer.AddChild(new TextWidget("icon", Docking.Top, new EmptyWidgetStyle(), null, null));
     IconText.SetIconFontByTag(CommonFontTags.LargeIcons);
     IconText.Icon = icon;
     IconText.Style.ForeColorBrush.Color = Theme.GetContextColor(colorContext);
     IconText.Padding = new Padding(6, 18, 6, 6);
 }
コード例 #2
0
        protected virtual void InitTable()
        {
            Table         = Controls.AddChild(new TableLayoutContainer("table"));
            Table.Padding = new Padding(12, 6);

            ImageWidget          = Table.AddChild(new ImagePanel("image", Docking.Fill, String.Empty), 0, 0, 5);
            ImageWidget.Padding  = new Padding(0, 8, 8, 0);
            ImageWidget.VAlign   = Alignment.Near;
            ImageWidget.SizeMode = ImageSizeModes.None;

            TitleWidget = Table.AddChild(new TextWidget("title"), 0, 1, 1, 2);
            TitleWidget.SetFontByTag(CommonFontTags.ExtraLarge);
            TitleWidget.Format = FontFormat.DefaultMultiLine;
            // ToDo: DPI Scaling
            TitleWidget.Margin = new Padding(TitleWidget.Margin.Left, 8, TitleWidget.Margin.Right, TitleWidget.Margin.Bottom);

            SubTitleWidget        = Table.AddChild(new TextWidget("subtitle"), 1, 1, 1, 2);
            SubTitleWidget.Format = FontFormat.DefaultMultiLine;

            VersionWidget        = Table.AddChild(new TextWidget("version"), 2, 1, 1, 2);
            VersionWidget.Format = FontFormat.DefaultSingleLine;
            //VersionWidget.Margin = new Padding (VersionWidget.Margin.Left, 8, VersionWidget.Margin.Right, 8);
            VersionWidget.Text = GetVersion();

            LicenseInfoWidget         = Table.AddChild(new TextWidget("licinfo"), 3, 1, 1, 2);
            LicenseInfoWidget.Format  = FontFormat.DefaultMultiLine;
            LicenseInfoWidget.Margin  = new Padding(LicenseInfoWidget.Margin.Left, 0, LicenseInfoWidget.Margin.Right, 8);
            LicenseInfoWidget.Visible = false;

            CreditsCaptionWidget        = Table.AddChild(new TextWidget("creditscaption"), 4, 0);
            CreditsCaptionWidget.Format = FontFormat.DefaultSingleLine;
            CreditsCaptionWidget.Text   = "Credits:";

            UrlCaptionWidget         = Table.AddChild(new TextWidget("moreinfocaption"), 4, 1);
            UrlCaptionWidget.Format  = FontFormat.DefaultSingleLine;
            UrlCaptionWidget.Text    = "More Info:";
            UrlCaptionWidget.Visible = false;

            UrlWidget = Table.AddChild(new UrlTextWidget("url", ""), 4, 2);

            CreditsWidget = Table.AddChild(new ScrollingBox("credits"), 5, 0, 1, 3);
            CreditsWidget.SetFontByTag(CommonFontTags.Serif);

            CopyrightWidget        = Table.AddChild(new TextWidget("copyright"), 6, 0, 1, 3);
            CopyrightWidget.Format = FontFormat.DefaultMultiLine;

            // finally set some SizeModes
            Table.Columns [0].SizeMode = TableSizeModes.Content;
            Table.Columns [1].SizeMode = TableSizeModes.Content;
            Table.Rows [5].SizeMode    = TableSizeModes.Fill;
        }
コード例 #3
0
        protected virtual void InitButtons()
        {
            // panel
            ButtonContainer           = Controls.AddChild(new ButtonContainer("buttoncontainer"));
            ButtonContainer.BackColor = Theme.Colors.Base01;

            DefaultButton btnOK = ButtonContainer.AddChild(new DefaultButton("okbutton", "&OK"));

            btnOK.Click += (sender, eOK) => OnOK();
            btnOK.MakeDefaultButton();                  // handle Enter-Key even when not focused
            btnOK.Update();

            //DefaultButton btnCancel = ButtonContainer.AddChild (new DefaultButton ("cancelbutton", "&Cancel"));
            DefaultButton btnCancel = ButtonContainer.AddChild(new DefaultButton("cancelbutton", "&Cancel"));

            btnCancel.Click += (sender, eCancel) => OnCancel();
            btnCancel.Update();

            //btnOK.Selected = true;	// make this the default button.
        }
コード例 #4
0
 protected MessageBoxWindow(string name, string caption, int width, int height, SummerGUIWindow parent)
     : base(name, caption, width, height, parent, true, GameWindowFlags.FixedWindow)
 {
     ButtonContainer = Controls.AddChild(new ButtonContainer("buttoncontainer"));
 }
コード例 #5
0
        protected virtual void InitTable()
        {
            MainContainer            = Controls.AddChild(new ScrollableContainer("main", Docking.Fill, new SilverPanelWidgetStyle()));
            MainContainer.AutoScroll = true;
            MainContainer.ScrollBars = ScrollBars.Vertical;

            Table = MainContainer.AddChild(new TableLayoutContainer("table"));

            // this should do the same:
            Table.Padding                 = new Padding(12, 6);
            Table.CellPadding             = new SizeF(12, 6);
            Table.CollapsibleColumnsWidth = 420;

            int row = 0;

            /***
             * Table.AddChild (new TextLabel ("lblGender", "Gender"), row, 0, 1, 2);
             * row++;
             * Table.AddChild (new ComboListBox ("Gender"), row, 0, 1, 2).CastTo<ComboListBox>().Do (cbo => {
             *      cbo.Items.Add("Male", 1);
             *      cbo.Items.Add("Female", 2);
             *      cbo.Items.Add("Not sure", 0);
             *      cbo.SelectedIndex = 0;
             * });
             * row++;
             ***/

            Table.AddChild(new TextLabel("lblFirstName", "First Name"), row, 0, 1, 2);
            Table.AddChild(new TextBox("FirstName"), row + 1, 0, 1, 2);

            Table.AddChild(new TextLabel("lblLastName", "Last Name"), row, 2);
            Table.AddChild(new TextBox("LastName"), row + 1, 2);

            row++;
            row++;
            Table.AddChild(new TextLabel("lblCompany", "Company"), row, 0, 1, 3);
            row++;
            Table.AddChild(new TextBox("Company"), row, 0, 1, 3);

            row++;
            Table.AddChild(new TextLabel("lblZip", "Zip"), row, 0);
            Table.AddChild(new TextBox("Zip"), row + 1, 0);

            Table.AddChild(new TextLabel("lblCity", "City"), row, 1);
            Table.AddChild(new TextBox("City"), row + 1, 1);

            Table.AddChild(new TextLabel("lblAddress", "Street Address"), row, 2);
            Table.AddChild(new TextBox("Address"), row + 1, 2);

            row++;
            row++;

            Table.AddChild(new TextLabel("lblPhone", "Phone"), row, 0, 1, 2);
            Table.AddChild(new ButtonTextBox("Phone", (char)FontAwesomeIcons.fa_phone, null, ColorContexts.Success), row + 1, 0, 1, 2);

            Table.AddChild(new TextLabel("lblEmail", "Email"), row, 2);
            Table.AddChild(new ButtonTextBox("Email", (char)FontAwesomeIcons.fa_envelope_o, null, ColorContexts.Success), row + 1, 2);

            row++;
            row++;
            Table.AddChild(new TextLabel("lblWeb", "Web"), row, 0, 1, 3);
            row++;
            Table.AddChild(new ButtonTextBox("Web", (char)FontAwesomeIcons.fa_chain, null, ColorContexts.Default), row, 0, 1, 3);

            LayoutDirtyFlag    = true;
            Table.AfterLayout += (sender, e) => UpdateTableSize();
        }