Beispiel #1
0
 public void OnMouseUp(int x, int y, MouseButtons button)
 {
     if (_buttonPress.IsTracked)
     {
         int id = HitTest(x, y);
         if (id == _buttonPress.Index)
         {
             ButtonClick.Raise(this, new ViewButtonClickEventArgs(_buttonPress.Item.Type));
         }
         _buttonPress.Drop();
     }
 }
Beispiel #2
0
        public HudMenu(Widget parent) : base(parent)
        {
            this.Resize(background.Width, (background.Height - 1) * buttonCount);

            int y = 0;

            for (int i = 0; i < buttonCount; i++)
            {
                var btn = new ImageButton(this)
                {
                    Image        = images[i * 2],
                    PressedImage = images[i * 2 + 1]
                };
                btn.Resize(images[i * 2].Size);
                btn.Move(1, y + 1);
                btn.Tooltip = new Tooltip(tooltips[i]);
                y          += background.Height - 1;

                var button = (Button)i;
                btn.Click += () => ButtonClick.Raise(button);
            }
        }
Beispiel #3
0
 public void Activate(Button button)
 {
     ButtonClick.Raise(button);
 }