Esempio n. 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            float textXOffset = _PADDING;

            if (imageName != null)
            {
                imageValue = new DImage(_guiManager, _PADDING, _PADDING, imageName, (int)(Size.X - (2 * _PADDING)), (int)(Size.Y - (2 * _PADDING)));
                imageValue.Initialize();

                this.Children.Add(imageValue);

                textXOffset += imageValue.Position.X + imageValue.Size.X;
            }

            textValue = new DText(_guiManager);
            textValue.Text = text;
            textValue.FontName = "Miramonte";
            // Left justified
            textValue.HorizontalAlignment = DText.DHorizontalAlignment.Left;
            textValue.VerticalAlignment = DText.DVerticalAlignment.Center;
            textValue.Size = new Vector2(Size.X, Size.Y);
            textValue.Initialize();
            textValue.Position = new Vector2(textXOffset, _PADDING);
            this.AddPanel(textValue);

            dropDownButton = new DToggleButton(_guiManager);
            dropDownButton.Text = "";
            dropDownButton.Size = new Vector2(Size.Y, Size.Y);
            dropDownButton.Initialize();
            dropDownButton.Position = new Vector2(Size.X - Size.Y, 0);
            this.AddPanel(dropDownButton);

            dropDownButton.OnToggle += new ToggleButtonEventHandler(dropDownButton_OnToggle);

            dropDownList = new DListBox(_guiManager);
            dropDownList.Size = new Vector2(Size.X, DEFAULT_LIST_HEIGHT);
            dropDownList.Initialize();
            dropDownList.Position = new Vector2(0, this.Position.Y + Size.Y);
            dropDownList.Visible = false;
            dropDownList.ApplyChildClipping = false;

            dropDownList.OnItemSelect += new ListBoxChangeEventHandler(dropDownList_OnItemSelect);
            listShown = false;

            this.FillColor = Color.White;

            base.LoadContent();
        }
Esempio n. 2
0
        protected void UpdateImage()
        {
            // Also set our image value if we can
            if (imageValue != null)
                this.Children.Remove(imageValue);
            imageValue = new DImage(_guiManager, 3, 3, imageName, (int)(Size.X - 6), (int)(Size.Y - 6));
            imageValue.Initialize();
            this.Children.Add(imageValue);

            // Shift text over
            if (imageName != null && textValue.Position.X == 5f)
            {
                textValue.Position = new Vector2(imageValue.Position.X + imageValue.Size.X + 5f, textValue.Position.Y);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            imagePos = new Vector2(PADDING, PADDING);

            if (imageName != null)
            {
                image = new DImage(_guiManager, (int) imagePos.X, (int) imagePos.Y, imageName, (int) (Size.Y - (2*PADDING)), (int) (Size.Y - (2*PADDING)));
                this.AddPanel(image);
            }

            // Align text centered vertically
            if (image != null)
                textPos = new Vector2(Size.Y + PADDING, Size.Y / 2);
            else
                textPos = new Vector2(PADDING + PADDING, Size.Y / 2);

            // Text label
            label = new DText(_guiManager);
            label.Text = text;
            label.FontName = "Miramonte";
            label.HorizontalAlignment = DText.DHorizontalAlignment.Left;
            label.VerticalAlignment = DText.DVerticalAlignment.Center;
            label.Position = textPos;
            //label.Parent = this;
            this.AddPanel(label);

            base.LoadContent();
        }