private GuiList(Rectangle bounds, List <GuiElement> elements) : base(bounds) { // Create the up-button up = new GuiButton(new Rectangle(new Point(0, 0), new Point(16)), "ArrowUp"); up.ClickHandler = () => scroll(true); up.loadContent(AssetManager.Instance); // Create the down-button down = new GuiButton(new Rectangle(new Point(0, 0), new Point(16)), "ArrowDown"); down.ClickHandler = () => scroll(false); down.loadContent(AssetManager.Instance); // Create the list-related variables allElements = elements; currentTop = 0; // Make sure all labels know this is their parent foreach (GuiElement element in allElements) { element.Parent = this; } // Make sure the buttons know this is their parent up.Parent = this; down.Parent = this; maxWidth = bounds.Width; }
public static GuiButton createButtonWithLabel(GuiLabel label, string spriteName) { Rectangle bounds = new Rectangle(label.Bounds.Location - new Point(2, 2), label.Bounds.Size + new Point(4, 4)); GuiButton retVal = new GuiButton(bounds, spriteName); retVal.label = label; return(retVal); }