private MessageBox(Rectangle rect, string caption, string text, bool visible = true)
     : base(null, null, visible)
 {
     BorderSize = 4;
     _text      = CachedString.Create(_font, text);
     _caption   = CachedString.Create(_font, caption);
     SetRect(rect);
     _draggable = new Draggable(MouseButton.Left, 1);
     _draggable.SetRect(_mBoxCaptionBarRect);
     _button = new SmallButton(null, null, new Rectangle(0, 0, 40, ButtonHeight - 2), "OK")
     {
         OnClick = Close
     };
     IsDirty = true;
 }
Esempio n. 2
0
        public DialogWindow(Point size, string caption) : base(null, null)
        {
            BorderSize   = 4;
            _spriteSheet = Ui.SpriteSheet;
            SetRect(new Rectangle(Point.Zero, size));
            _caption     = CachedString.Create(IoC.Get <IFont>(), caption);
            _closeButton = new SmallButton(IoC.Get <IWindow>(), this, Ui.Button.CloseButtonNormal, Ui.Button.CloseButtonPressed,
                                           new Rectangle(), null)
            {
                OnClick = Close,
            };
            var cbWidth  = Ui.Button.CloseButtonNormal.Width;
            var cbHeight = Ui.Button.CloseButtonNormal.Height;

            _closeButton.SetRect(new Rectangle(CleanRect.Width - cbWidth - (BorderSize * 2), -Ui.CaptionHeight, cbWidth, cbHeight));
            _draggable = new Draggable(MouseButton.Left, 1);
            IsDirty    = true;
        }
 private ConfirmationBox(Rectangle rect, string caption, string text, Action onYes, bool visible = true)
     : base(null, null, visible)
 {
     BorderSize          = 4;
     _mBoxCaptionBarRect = new Rectangle(rect.X, rect.Y, rect.Width, CaptionHeight);
     _mBoxMainRect       = new Rectangle(rect.X, rect.Y + CaptionHeight, rect.Width, rect.Height - CaptionHeight);
     _text    = CachedString.Create(_font, text);
     _caption = CachedString.Create(_font, caption);
     SetRect(rect);
     _draggable = new Draggable(MouseButton.Left, 1);
     _draggable.SetRect(_mBoxCaptionBarRect);
     IsDirty    = true;
     _buttonYes = new SmallButton(_mBoxWindow, null,
                                  new Rectangle(0, 0, 40, ButtonHeight - 2), "Yes");
     _buttonYes.OnClick = () =>
     {
         Close();
         onYes?.Invoke();
     };
     _buttonNo = new SmallButton(_mBoxWindow, null,
                                 new Rectangle(0, 0, 40, ButtonHeight - 2), "No");
     _buttonNo.OnClick = Close;
 }