private void OpenList_OnClick(Gump g) { if (this.m_Dropdown != null) { Gumps.Destroy((Gump)this.m_Dropdown); } Point screen = this.PointToScreen(new Point(0, 0)); this.m_Dropdown = new GBackground(this.m_BackID, this.Width, this.m_Count * 20 + (this.Height - this.UseHeight), screen.X, screen.Y, true); this.m_Dropdown.DestroyOnUnfocus = true; int offsetY = this.m_Dropdown.OffsetY; int num1 = 0; for (int index = 0; index < this.m_Count; ++index) { GTextButton gtextButton = new GTextButton(this.m_List[index], this.m_Font, this.m_HRegular, this.m_HOver, this.m_Dropdown.OffsetX, offsetY, new OnClick(this.SetIndex_OnClick)); gtextButton.SetTag("Index", (object)index); this.m_Dropdown.Children.Add((Gump)gtextButton); offsetY += gtextButton.Height; if (gtextButton.Width + 3 > num1) { num1 = gtextButton.Width + 3; } } this.m_Dropdown.Height = offsetY + (this.m_Dropdown.Height - (this.m_Dropdown.OffsetY + this.m_Dropdown.UseHeight)); int num2 = num1 + (this.m_Dropdown.Width - this.m_Dropdown.UseWidth); if (num2 > this.m_Dropdown.Width) { this.m_Dropdown.Width = num2; } Gumps.Desktop.Children.Add((Gump)this.m_Dropdown); }
private Gump CreateLabel(string text, bool scroll) { text = text.Replace('\r', '\n'); GBackground gbackground = new GBackground(3004, 200, 100, true); GWrappedLabel gwrappedLabel = new GWrappedLabel(text, (IFont)Engine.GetFont(1), Hues.Load(1109), gbackground.OffsetX, gbackground.OffsetY, gbackground.UseWidth); gbackground.Height = gwrappedLabel.Height + (gbackground.Height - gbackground.UseHeight); gbackground.Children.Add((Gump)gwrappedLabel); gwrappedLabel.Center(); gbackground.SetMouseOverride((Gump)this); return((Gump)gbackground); }
public GUpdateScroll(string text) : base(5058, 100, 100, 40, 30, true) { GLabel glabel = new GLabel("Updates", Engine.DefaultFont, Hues.Load(496), this.OffsetX, this.OffsetY); GBackground gbackground = new GBackground(3004, 100, 100, this.OffsetX, glabel.Y + glabel.Height + 4, true); GWrappedLabel gwrappedLabel = new GWrappedLabel(text, (IFont)Engine.GetFont(1), Hues.Load(1109), gbackground.OffsetX + 2, gbackground.OffsetY + 2, 250); gbackground.Width = gbackground.Width - gbackground.UseWidth + gwrappedLabel.Width + 6; gbackground.Height = gbackground.Height - gbackground.UseHeight + gwrappedLabel.Height + 2; gbackground.Children.Add((Gump)gwrappedLabel); this.Width = this.Width - this.UseWidth + gbackground.Width; this.Height = this.Height - this.UseHeight + glabel.Height + 4 + gbackground.Height; glabel.X += (this.UseWidth - glabel.Width) / 2; this.m_CanDrag = true; this.m_QuickDrag = true; this.CanClose = true; gbackground.SetMouseOverride((Gump)this); this.m_Children.Add((Gump)glabel); this.m_Children.Add((Gump)gbackground); }