Esempio n. 1
0
        private GuiList(Rectangle bounds, List <GuiLabel> labels) : base(bounds)
        {
            // Create the up-button
            up = new GuiButton(new Rectangle(new Point(0, 0), new Point(16)), "testure");
            up.ClickHandler = () => scroll(true);
            up.loadContent(RPGGame.AssetManager);

            // Create the down-button
            down = new GuiButton(new Rectangle(new Point(0, 0), new Point(16)), "testure");
            down.ClickHandler = () => scroll(false);
            down.loadContent(RPGGame.AssetManager);

            // Create the list-related variables
            labelList  = labels;
            currentTop = 0;

            // Make sure all labels know this is their parent
            foreach (GuiLabel label in labelList)
            {
                label.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 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);
        }