Пример #1
0
        public void SetButtons(IEnumerable <DialogButton> newButtons)
        {
            if (buttons != null)
            {
                foreach (var b in buttons)
                {
                    ((Gtk.Container)b.Parent).Remove(b);
                    b.Destroy();
                }
            }
            dialogButtons = newButtons
                            .OrderBy(b => b.PackOrigin)
                            .OrderBy(b => b == DefaultButton).ToArray();
            buttons = new Gtk.Button [dialogButtons.Length];

            for (int n = 0; n < dialogButtons.Length; n++)
            {
                var        db = dialogButtons[n];
                Gtk.Button b  = new Gtk.Button();
                b.Show();
                b.Label = db.Label;
                Window.ActionArea.Add(b);
                UpdateButton(db, b);
                buttons[n]          = b;
                buttons[n].Clicked += HandleButtonClicked;
                if (db == DefaultButton)
                {
                    b.CanDefault = true;
                    b.GrabDefault();
                }
            }
            UpdateActionAreaVisibility();
        }
Пример #2
0
        private void AddButton(Gtk.Button button, Gtk.ResponseType response, bool isDefault)
        {
            AddActionWidget(button, response);

            if (isDefault)
            {
                Default         = button;
                DefaultResponse = response;
                button.GrabDefault();
            }
        }
Пример #3
0
 public override void Initialize()
 {
     NeedsEventBox    = false;
     Widget           = new Gtk.Button();
     Widget.Realized += (o, arg) =>
     {
         if (Widget.IsRealized && Widget.CanDefault)
         {
             Widget.GrabDefault();
         }
     };
     base.Widget.Show();
 }
Пример #4
0
        public void SetButtons(IEnumerable<DialogButton> newButtons)
        {
            if (buttons != null) {
                foreach (var b in buttons) {
                    ((Gtk.Container)b.Parent).Remove (b);
                    b.Destroy ();
                }
            }
            dialogButtons = newButtons
                .OrderBy (b => b.PackOrigin)
                .OrderBy (b => b == DefaultButton).ToArray ();
            buttons = new Gtk.Button [dialogButtons.Length];

            for (int n=0; n<dialogButtons.Length; n++) {
                var db = dialogButtons[n];
                Gtk.Button b = new Gtk.Button ();
                b.Show ();
                b.Label = db.Label;
                Window.ActionArea.Add (b);
                UpdateButton (db, b);
                buttons[n] = b;
                buttons[n].Clicked += HandleButtonClicked;
                if (db == DefaultButton) {
                    b.CanDefault = true;
                    b.GrabDefault ();
                }
            }
            UpdateActionAreaVisibility ();
        }