protected void ChooseItem_Clicked(object o, EventArgs args) { using (ChooseEditItem dialog = new ChooseEditItem(true, Item != null && Item.Name == txtItem.Text ? string.Empty : txtItem.Text)) { if (dialog.Run() != ResponseType.Ok || dialog.SelectedItems.Length <= 0) { return; } Item = dialog.SelectedItems [0]; txtItem.Text = Item.Name; sbAmount.GrabFocus(); } }
public ResizeImageDialog() : base(Catalog.GetString("Resize Image"), PintaCore.Chrome.MainWindow, DialogFlags.Modal, Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, Gtk.Stock.Ok, Gtk.ResponseType.Ok) { Build(); aspectCheckbox.Active = true; widthSpinner.Value = PintaCore.Workspace.ImageSize.Width; heightSpinner.Value = PintaCore.Workspace.ImageSize.Height; percentageRadio.Toggled += new EventHandler(percentageRadio_Toggled); absoluteRadio.Toggled += new EventHandler(absoluteRadio_Toggled); percentageRadio.Toggle(); percentageSpinner.Value = 100; percentageSpinner.ValueChanged += new EventHandler(percentageSpinner_ValueChanged); widthSpinner.ValueChanged += new EventHandler(widthSpinner_ValueChanged); heightSpinner.ValueChanged += new EventHandler(heightSpinner_ValueChanged); AlternativeButtonOrder = new int[] { (int)Gtk.ResponseType.Ok, (int)Gtk.ResponseType.Cancel }; DefaultResponse = Gtk.ResponseType.Ok; widthSpinner.ActivatesDefault = true; heightSpinner.ActivatesDefault = true; percentageSpinner.ActivatesDefault = true; percentageSpinner.GrabFocus(); }
public ResizeImageDialog() : base(Translations.GetString("Resize Image"), PintaCore.Chrome.MainWindow, DialogFlags.Modal, Core.GtkExtensions.DialogButtonsCancelOk()) { Build(); aspectCheckbox.Active = true; widthSpinner.Value = PintaCore.Workspace.ImageSize.Width; heightSpinner.Value = PintaCore.Workspace.ImageSize.Height; percentageRadio.Toggled += new EventHandler(percentageRadio_Toggled); absoluteRadio.Toggled += new EventHandler(absoluteRadio_Toggled); percentageRadio.Toggle(); percentageSpinner.Value = 100; percentageSpinner.ValueChanged += new EventHandler(percentageSpinner_ValueChanged); widthSpinner.ValueChanged += new EventHandler(widthSpinner_ValueChanged); heightSpinner.ValueChanged += new EventHandler(heightSpinner_ValueChanged); DefaultResponse = Gtk.ResponseType.Ok; widthSpinner.ActivatesDefault = true; heightSpinner.ActivatesDefault = true; percentageSpinner.ActivatesDefault = true; percentageSpinner.GrabFocus(); }
private void BuildControl(string textEntry, string textLabel, bool onlyInt, Gtk.Window parent) { this.onlyInt = onlyInt; this.TransientFor = parent; HBox hbox = new HBox(false, 8); hbox.BorderWidth = 8; this.VBox.PackStart(hbox, false, false, 0); Image stock = new Image(Stock.DialogQuestion, IconSize.Dialog); hbox.PackStart(stock, false, false, 0); Table table = new Table(2, 2, false); table.RowSpacing = 4; table.ColumnSpacing = 4; hbox.PackStart(table, true, true, 0); Label label = new Label(textLabel); table.Attach(label, 0, 1, 0, 1); if (!onlyInt) { localEntry1 = new Entry(); localEntry1.Text = textEntry; //textEntry; //localEntry1.Changed += delegate(object sender, EventArgs e) { textEntry = localEntry1.Text; }; table.Attach(localEntry1, 1, 2, 0, 1); label.MnemonicWidget = localEntry1; localEntry1.KeyPressEvent += new KeyPressEventHandler(OnKeyPress); localEntry1.GrabFocus(); } else { localSpin = new SpinButton(1, 10000, 10); localSpin.Digits = 0; localSpin.Numeric = true; localSpin.KeyPressEvent += new KeyPressEventHandler(OnKeyPress); table.Attach(localSpin, 1, 2, 0, 1); label.MnemonicWidget = localSpin; localSpin.GrabFocus(); } this.AddButton(MainClass.Languages.Translate("cancel"), ResponseType.Cancel); this.AddButton(MainClass.Languages.Translate("ok"), ResponseType.Ok); this.ShowAll(); }
private void OnTimeChanged(SpinButton spbDate) { if (changingFilter) { return; } if (!spbDate.Sensitive) { return; } int cursorPosition = spbDate.CursorPosition; OnFilterChanged(EventArgs.Empty); spbDate.GrabFocus(); spbDate.SelectRegion(cursorPosition, cursorPosition); }
public ResizeCanvasDialog() : base(Catalog.GetString("Resize Canvas"), PintaCore.Chrome.MainWindow, DialogFlags.Modal, Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, Gtk.Stock.Ok, Gtk.ResponseType.Ok) { Build(); Icon = PintaCore.Resources.GetIcon("Menu.Image.CanvasSize.png"); aspectCheckbox.Active = true; widthSpinner.Value = PintaCore.Workspace.ImageSize.Width; heightSpinner.Value = PintaCore.Workspace.ImageSize.Height; percentageRadio.Toggled += new EventHandler(percentageRadio_Toggled); absoluteRadio.Toggled += new EventHandler(absoluteRadio_Toggled); percentageRadio.Toggle(); percentageSpinner.Value = 100; percentageSpinner.ValueChanged += new EventHandler(percentageSpinner_ValueChanged); widthSpinner.ValueChanged += new EventHandler(widthSpinner_ValueChanged); heightSpinner.ValueChanged += new EventHandler(heightSpinner_ValueChanged); NWButton.Clicked += HandleNWButtonClicked; NButton.Clicked += HandleNButtonClicked; NEButton.Clicked += HandleNEButtonClicked; WButton.Clicked += HandleWButtonClicked; CenterButton.Clicked += HandleCenterButtonClicked; EButton.Clicked += HandleEButtonClicked; SWButton.Clicked += HandleSWButtonClicked; SButton.Clicked += HandleSButtonClicked; SEButton.Clicked += HandleSEButtonClicked; SetAnchor(Anchor.Center); AlternativeButtonOrder = new int[] { (int)Gtk.ResponseType.Ok, (int)Gtk.ResponseType.Cancel }; DefaultResponse = Gtk.ResponseType.Ok; widthSpinner.ActivatesDefault = true; heightSpinner.ActivatesDefault = true; percentageSpinner.ActivatesDefault = true; percentageSpinner.GrabFocus(); }
private bool Validate() { if (chkValueFrom.Active) { valueFrom = spbValueFrom.Value; } if (chkValueTo.Active) { valueTo = spbValueTo.Value; } if (!valueFrom.HasValue || !valueTo.HasValue || !(valueFrom.Value > valueTo.Value)) { return(true); } MessageError.ShowDialog(Translator.GetString("The minimum number cannot be greater than the maximum number."), ErrorSeverity.Error); spbValueFrom.GrabFocus(); return(false); }
private bool Validate() { if (chkTimeFrom.Active) { timeFrom = new DateTime(DateTime.MinValue.Year, DateTime.MinValue.Month, DateTime.MinValue.Day, spbHoursFrom.ValueAsInt, spbMinutesFrom.ValueAsInt, 0); } if (chkTimeTo.Active) { timeTo = new DateTime(DateTime.MinValue.Year, DateTime.MinValue.Month, DateTime.MinValue.Day, spbHoursTo.ValueAsInt, spbMinutesTo.ValueAsInt, 0); } if (timeFrom == null || timeTo == null || timeFrom <= timeTo) { return(true); } MessageError.ShowDialog(Translator.GetString("The minimum time cannot be greater than the maximum time."), ErrorSeverity.Error); spbHoursFrom.GrabFocus(); return(false); }