Пример #1
0
        public ScrollPanel(Rectangle bounds, string label = null) : base(bounds, label)
        {
            Button scrollUpButton = new Button(new Rectangle(bounds.Width - SCROLLBAR_WIDTH, 0, SCROLLBAR_WIDTH, SCROLL_BUTTON_HEIGHT), "^", ScrollDown, this);

            Add(scrollUpButton);

            Button scrollDownButton = new Button(new Rectangle(bounds.Width - SCROLLBAR_WIDTH, bounds.Height - SCROLL_BUTTON_HEIGHT, SCROLLBAR_WIDTH, SCROLL_BUTTON_HEIGHT), "v", ScrollUp, this);

            Add(scrollDownButton);

            int labelHeight = (int)(font.MeasureString(label).Y *scale);

            innerOffset     = new Point(0, labelHeight);
            scrollContainer = new GUIContainer(new Rectangle(bounds.X, bounds.Y + labelHeight, bounds.Width - SCROLLBAR_WIDTH, bounds.Height - labelHeight));
        }
Пример #2
0
        public ConfirmationPopup(Rectangle bounds, GUIContainer parentContainer, string label, Action yesAction, Action noAction) : base(bounds, parentContainer, label)
        {
            Button yesButton = new Button(new Rectangle(BUTTON_SPACING, BUTTON_VERTICAL_OFFSET, BUTTON_WIDTH, BUTTON_HEIGHT), "Yes", () => { yesAction(); Close(); }, parentContainer);

            Add(yesButton);

            Button noButton = new Button(new Rectangle(2 * BUTTON_SPACING + BUTTON_WIDTH, BUTTON_VERTICAL_OFFSET, BUTTON_WIDTH, BUTTON_HEIGHT), "No", () => { noAction(); Close(); }, parentContainer);

            Add(noButton);

            //if (cancelAction != null)
            //{
            Button cancelButton = new Button(new Rectangle(3 * BUTTON_SPACING + 2 * BUTTON_WIDTH, BUTTON_VERTICAL_OFFSET, BUTTON_WIDTH, BUTTON_HEIGHT), "Cancel", Close, parentContainer);             //cancelAction);

            Add(cancelButton);
            //}
        }
Пример #3
0
 public PopupPanel(Rectangle bounds, GUIContainer parentContainer, string label = null) : base(bounds, label)
 {
     this.parentContainer = parentContainer;
 }
Пример #4
0
        public ContainerPanel(Rectangle bounds, string label = null) : base(bounds, label)
        {
            contents = new GUIContainer(bounds);

            RefreshBounds();
        }