Esempio n. 1
0
        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;
        }
Esempio n. 2
0
 public override void loadContent(AssetManager content)
 {
     up.loadContent(content);
     down.loadContent(content);
     foreach (GuiElement element in allElements)
     {
         element.loadContent(content);
     }
 }