Inheritance: IContainer
Example #1
0
        public void PromptForCreation(string createType, EventHandler submit)
        {
            this.PromptName = new TextBox();

            var label = new Label();
            label.Text = "Enter the name of the new " + createType + ":";

            var form = new Form();
            form.AddControl("Name: ", this.PromptName);

            var submitButton = new Button();
            submitButton.Text = "Create";
            submitButton.Click += (sender, e) =>
            {
                submit(sender, e);
                this.m_CanvasEntity.Windows.Remove(this.PromptWindow);
                this.PromptWindow = null;
                this.PromptName = null;
            };

            var cancelButton = new Button();
            cancelButton.Text = "Cancel";
            cancelButton.Click += (sender, e) =>
            {
                this.m_CanvasEntity.Windows.Remove(this.PromptWindow);
                this.PromptWindow = null;
                this.PromptName = null;
            };

            var horizontalContainer = new HorizontalContainer();
            horizontalContainer.AddChild(submitButton, "50%");
            horizontalContainer.AddChild(cancelButton, "50%");

            var verticalContainer = new VerticalContainer();
            verticalContainer.AddChild(label, "24");
            verticalContainer.AddChild(form, "*");
            verticalContainer.AddChild(horizontalContainer, "24");

            this.PromptWindow = new Window();
            this.PromptWindow.Modal = true;
            this.PromptWindow.Bounds = new Microsoft.Xna.Framework.Rectangle(
                (int)this.m_CanvasEntity.Width / 2 - 150,
                (int)this.m_CanvasEntity.Height / 2 - 75,
                300,
                150);
            this.PromptWindow.SetChild(verticalContainer);
            this.m_CanvasEntity.Windows.Add(this.PromptWindow);

            this.MainMenu.Active = false;
            foreach (var item in this.MainMenu.Children.Cast<MenuItem>())
                item.Active = false;
        }
Example #2
0
 /// <summary>
 /// The draw form.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 /// <param name="layout">
 /// The layout.
 /// </param>
 /// <param name="form">
 /// The form.
 /// </param>
 public void DrawForm(IRenderContext context, Rectangle layout, Form form)
 {
     this.DrawFlat(context, layout);
 }
Example #3
0
 public void DrawForm(IRenderContext context, Rectangle layout, Form form)
 {
     this.m_BasicSkin.DrawForm(context, layout, form);
 }