public MessageBox(Window Owner, string Title, string Text = "", ButtonOptions options = ButtonOptions.OKOnly) { this.Title = Title; this.Owner = Owner; this.Width = 280; this.Height = 180; RichTextDisplay text = new RichTextDisplay(this.Width, 120, Owner.WM); text.SetText(Text); this.Controls.Add(text); switch (options) { case ButtonOptions.OKCancel: { Button okb = new Button("OK") { Width = 80, Height = 20, Y = 120, X = (Width - 165) / 2 }; okb.OnClick += Okb_OnClick; AddControl(okb); Button cancelb = new Button("Cancel") { Width = 80, Height = 20, Y = 120, X = (Width - 165) / 2 + 80 }; cancelb.OnClick += Cancelb_OnClick; AddControl(cancelb); break; } default: //OKOnly { Button okb = new Button("OK") { Width = 60, Height = 20, Y = 120, X = (Width - 60) / 2 }; okb.OnClick += Okb_OnClick; AddControl(okb); break; } } }
public StatusWindow(WindowManager WM, Interfaces.ISelectable Item) { this.item = Item; this.AnchorBottom = true; this.Width = 400; this.Height = 160; d = new RichTextDisplay(300, 32, WM); d.X = 2; d.Y = 2; this.Title = Item.Name; this.AddControl(d); }
public TextPrompt(Window Owner, string Title, string Text = "", string DefaultValue = "") { this.Title = Title; this.Owner = Owner; this.Width = 280; this.Height = 180; this.TextResult = DefaultValue; int textheight = 100; RichTextDisplay text = new RichTextDisplay(this.Width, textheight, Owner.WM); text.SetText(Text); this.Controls.Add(text); box = new TextBox(); box.Width = this.Width - 10; box.X = 0; box.Height = 20; box.Y = textheight + 5; box.Text = DefaultValue; AddControl(box); Button okb = new Button("OK") { Width = 80, Height = 20, Y = textheight + 5 + 20 + 5, X = (Width - 165) / 2 }; okb.OnClick += Okb_OnClick; AddControl(okb); Button cancelb = new Button("Cancel") { Width = 80, Height = 20, Y = textheight + 5 + 20 + 5, X = (Width - 165) / 2 + 75 }; cancelb.OnClick += Cancelb_OnClick; AddControl(cancelb); }