Ejemplo n.º 1
0
        private void setContextList(ContextMenuItem[] options)
        {
            //Set the individual element heights to the largest of the textboxes, 100px width min
            float maxWidth  = 100f;
            float maxHeight = 0f;

            for (int i = 0; i < options.Length; i++)
            {
                ContextMenuItem item = options[i];
                item.LoadContent();

                if (item.TextBox.Height > maxHeight)
                {
                    maxHeight = item.TextBox.Height;
                }
                if (item.TextBox.Width > maxWidth)
                {
                    maxWidth = item.TextBox.Width;
                }
            }

            //Set the menu's size based on the biggest element width and the height of them all together
            this.Size = new Vector2(maxWidth, maxHeight * Children.Count);

            //Update the element's position and size based on the max sizes
            for (int i = 0; i < Children.Count; i++)
            {
                Children[i].Position = new Vector2(5f, i * maxHeight);
                Children[i].Size     = new Vector2(maxWidth, maxHeight);
            }
        }
Ejemplo n.º 2
0
        public void SetMenuOptions(params ContextInfo[] options)
        {
            clearChildren();

            ContextMenuItem[] items = new ContextMenuItem[options.Length];
            for (int i = 0; i < options.Length; i++)
            {
                items[i] = new ContextMenuItem(this, options[i]);
            }

            setContextList(items);
        }
Ejemplo n.º 3
0
 public ContextMenuItemSelectedArgs(ContextMenuItem item)
 {
     Item = item;
 }