/// <summary> /// Create a toolbar button for a command. /// </summary> /// <param name="command">The command for which a toolbar button is to be created.</param> /// <returns>The toolbar button for the command.</returns> public static Gtk.ToolButton CreateToolbarButtonForCommand(this VisualRelayCommand command) { var toolbarButton = new Gtk.ToolButton(new Gtk.Image(command.LargeIcon), command.Name); command.InitializeToolbarButtonForCommand(toolbarButton, true); return(toolbarButton); }
internal override Gtk.ToolItem CreateToolItem(CommandManager manager) { Gtk.ToolButton item = new Gtk.ToolButton(text); item.StockId = icon; item.Clicked += new EventHandler(HandleActivation); return(item); }
private void Build() { this.ToolbarStyle = Gtk.ToolbarStyle.Both; //buttons var newNoteButton = new Gtk.ToolButton(Gtk.Stock.Add); newNoteButton.Label = "New Note"; newNoteButton.Clicked += this.OnNewNoteClicked; var newExerciseButton = new Gtk.ToolButton(Gtk.Stock.Add); newExerciseButton.Label = "New Exercise"; newExerciseButton.Clicked += this.OnNewExerciseClicked; var newMeasureButton = new Gtk.ToolButton(Gtk.Stock.Add); newMeasureButton.Label = "New Measure"; newMeasureButton.Clicked += this.OnNewMeasureClicked; this.Insert(newNoteButton, 0); this.Insert(newExerciseButton, 1); this.Insert(newMeasureButton, 2); this.OnViewBuilt(); }
void CreateUI(string name) { Caption = new Gtk.Label(name); Close = new Gtk.ToolButton(img, ""); PackStart(Caption); PackStart(Close); ShowAll(); Close.Hide(); }
public static Gtk.ToolButton ToolButtonFromTheme(string theme_id, string label, bool important) { Gtk.ToolButton button = new Gtk.ToolButton(null, null); button.Label = label; button.IconName = theme_id; button.IsImportant = important; button.UseUnderline = true; return(button); }
public static Gtk.ToolButton ToolButtonFromTheme (string theme_id, string label, bool important) { Gtk.ToolButton button = new Gtk.ToolButton (null, null); button.Label = label; button.IconName = theme_id; button.IsImportant = important; button.UseUnderline = true; return button; }
public static Gtk.ToolButton ToolButtonFromTheme(string theme_id, string label, bool important) { var button = new Gtk.ToolButton(null, null) { Label = label, IconName = theme_id, IsImportant = important, UseUnderline = true }; return(button); }
public override void Wrap(object obj, bool initialized) { base.Wrap(obj, initialized); Gtk.ToolButton toolbutton = (Gtk.ToolButton)Wrapped; if (toolbutton.StockId != null) { stockId = toolbutton.StockId; type = ButtonType.StockItem; } else { type = ButtonType.TextAndIcon; } }
protected virtual void AddActionCommands(Wrapper.Action action) { if (allowBinding) { Gtk.ToolButton bindButton = new Gtk.ToolButton(null, Catalog.GetString("Bind to Field")); bindButton.IsImportant = true; bindButton.Show(); Insert(bindButton, -1); if (action == null) { bindButton.Sensitive = false; } bindButton.Clicked += delegate { frontend.NotifyBindField(); }; } }
void Initialize(ActionGroupDesignerFrontend frontend, Wrapper.ActionGroupCollection actionGroups, bool singleGroupMode) { this.frontend = frontend; this.singleGroupMode = singleGroupMode; IconSize = Gtk.IconSize.SmallToolbar; Orientation = Gtk.Orientation.Horizontal; ToolbarStyle = Gtk.ToolbarStyle.BothHoriz; combo = Gtk.ComboBox.NewText(); if (!singleGroupMode) { combo.Changed += OnActiveChanged; Gtk.ToolItem comboItem = new Gtk.ToolItem(); Gtk.HBox cbox = new Gtk.HBox(); cbox.PackStart(new Gtk.Label(Catalog.GetString("Action Group:") + " "), false, false, 3); cbox.PackStart(combo, true, true, 3); comboItem.Add(cbox); comboItem.ShowAll(); Insert(comboItem, -1); internalButtons.Add(comboItem); addButton = new Gtk.ToolButton(Gtk.Stock.Add); addButton.Clicked += OnAddGroup; Insert(addButton, -1); internalButtons.Add(addButton); removeButton = new Gtk.ToolButton(Gtk.Stock.Remove); removeButton.Clicked += OnRemoveGroup; Insert(removeButton, -1); internalButtons.Add(removeButton); ActionGroups = actionGroups; if (actionGroups != null && actionGroups.Count > 0) { combo.Active = 0; } } else { UpdateActionCommands(null); } ShowAll(); }
void Initialize (ActionGroupDesignerFrontend frontend, Wrapper.ActionGroupCollection actionGroups, bool singleGroupMode) { this.frontend = frontend; this.singleGroupMode = singleGroupMode; IconSize = Gtk.IconSize.SmallToolbar; Orientation = Gtk.Orientation.Horizontal; ToolbarStyle = Gtk.ToolbarStyle.BothHoriz; combo = Gtk.ComboBox.NewText (); if (!singleGroupMode) { combo.Changed += OnActiveChanged; Gtk.ToolItem comboItem = new Gtk.ToolItem (); Gtk.HBox cbox = new Gtk.HBox (); cbox.PackStart (new Gtk.Label (Catalog.GetString ("Action Group:") + " "), false, false, 3); cbox.PackStart (combo, true, true, 3); comboItem.Add (cbox); comboItem.ShowAll (); Insert (comboItem, -1); internalButtons.Add (comboItem); addButton = new Gtk.ToolButton (Gtk.Stock.Add); addButton.Clicked += OnAddGroup; Insert (addButton, -1); internalButtons.Add (addButton); removeButton = new Gtk.ToolButton (Gtk.Stock.Remove); removeButton.Clicked += OnRemoveGroup; Insert (removeButton, -1); internalButtons.Add (removeButton); ActionGroups = actionGroups; if (actionGroups != null && actionGroups.Count > 0) combo.Active = 0; } else { UpdateActionCommands (null); } ShowAll (); }
Gtk.Widget CreateLabel(NotebookTab tab) { var vbox = new Gtk.HBox(); Gtk.Label label = new Gtk.Label(); /* INTRODUCED BY houen */ if (tab.Label.Contains("\\_")) { label.Text = tab.Label.Replace("\\_", "_"); } else { label.TextWithMnemonic = tab.Label.Replace("\\_", "_"); } /* INTRODUCED BY houen */ label.Show(); vbox.PackStart(label); if (!label.Text.StartsWith(char.ConvertFromUtf32(0x200B))) { var closeImage = new Gtk.Image(Assembly.GetExecutingAssembly(), "Xwt.GtkBackend.delete.png"); var button = new Gtk.ToolButton(closeImage, ""); vbox.PackEnd(button, false, false, 0); button.Show(); closeImage.Show(); var nativeWidget = GetWidget((IWidgetBackend)Toolkit.GetBackend(tab.Child)); button.Clicked += (object sender, EventArgs e) => { tab.OnClosing(); Widget.Remove(nativeWidget); }; } return(vbox); }
private void ConstructToolButtonOpen() { Debug.WriteLine("ConstructToolButtonOpen"); toolButtonOpen = new Gtk.ToolButton(null, null) { Name = "toolButtonOpen", }; actionGroupMain["File.Open"].ConnectProxy(toolButtonOpen); }
private void ConstructToolButtonPaste() { Debug.WriteLine("ConstructToolButtonPaste"); toolButtonPaste = new Gtk.ToolButton(null, null) { Name = "toolButtonPaste", }; actionGroupMain["Edit.Paste"].ConnectProxy(toolButtonPaste); }
/// <summary> /// Initializes the toolbar button for a command. /// </summary> /// <param name="command">The command to associate with the button.</param> /// <param name="toolbarButton">The Gtk.ToolButton to associate with the given command.</param> /// <param name="addCommandHandler">If set to <c>true</c> add command handler for button click to execute the command.</param> public static void InitializeToolbarButtonForCommand(this VisualRelayCommand command, Gtk.ToolButton toolbarButton, bool addCommandHandler) { toolbarButton.IsImportant = false; if (addCommandHandler) { toolbarButton.Clicked += HandleCommand; } var accelerator = string.Empty; if (!string.IsNullOrEmpty(command.KeyboardShortcutKey)) { var accelKey = command.GetAcceleratorKey(); accelerator = " (" + Gtk.Accelerator.GetLabel((uint)accelKey.Key, accelKey.AccelMods) + ')'; } toolbarButton.TooltipMarkup = string.Format("<span weight=\"bold\">{0}</span><span alpha=\"15%\">{1}</span>\n\n{2}", RemoveTrailingEllipses(command.Name), accelerator, command.ToolTipDescription); }
Gtk.Widget CreateLabel(NotebookTab tab) { var vbox = new Gtk.HBox(); Gtk.Label label = new Gtk.Label (); /* INTRODUCED BY houen */ if (tab.Label.Contains("\\_")) { label.Text = tab.Label.Replace("\\_", "_"); } else { label.TextWithMnemonic = tab.Label.Replace("\\_", "_"); } /* INTRODUCED BY houen */ label.Show (); vbox.PackStart(label); if(!label.Text.StartsWith(char.ConvertFromUtf32(0x200B))) { var closeImage = new Gtk.Image(Assembly.GetExecutingAssembly(), "Xwt.GtkBackend.delete.png"); var button = new Gtk.ToolButton(closeImage, ""); vbox.PackEnd(button, false, false, 0); button.Show(); closeImage.Show(); var nativeWidget = GetWidget((IWidgetBackend)Toolkit.GetBackend(tab.Child)); button.Clicked += (object sender, EventArgs e) => { tab.OnClosing(); Widget.Remove(nativeWidget); }; } return vbox; }
private void ConstructToolButtonNew() { Debug.WriteLine("ConstructToolButtonNew"); toolButtonNew = new Gtk.ToolButton(null, null) { Name = "toolButtonNew", }; actionGroupMain["File.New"].ConnectProxy(toolButtonNew); }
public override Gtk.ToolItem GetToolItem() { Gtk.ToolButton but = new Gtk.ToolButton(icon); but.Clicked += OnClicked; return(but); }
private void ConstructToolButtonSave() { Debug.WriteLine("ConstructToolButtonSave"); toolButtonSave = new Gtk.ToolButton(null, null) { Name = "toolButtonSave", }; actionGroupMain["File.Save"].ConnectProxy(toolButtonSave); }
public override Gtk.ToolItem GetToolItem () { Gtk.ToolButton but = new Gtk.ToolButton (icon); but.Clicked += OnClicked; return but; }
private void ConstructToolButtonUndo() { Debug.WriteLine("ConstructToolButtonUndo"); toolButtonUndo = new Gtk.ToolButton(null, null) { Name = "toolButtonUndo", }; actionGroupMain["Edit.Undo"].ConnectProxy(toolButtonUndo); }
public static void Main(string[] args) { Gtk.Application.Init(); string method; if (args.Length < 1) method = "train"; else method = args[0]; StrongClassifier? classifier; if (method == "load") classifier = StrongClassifier.LoadFromFile(args[1]); else if (method == "train") { string trainingDir = args[1]; classifier = StrongClassifier.Train(trainingDir); if (args.Length > 2) classifier.Value.Save(args[2]); } var win = new Gtk.Window("Détecteur de visages"); win.DefaultHeight = 350; win.DefaultWidth = 400; var toolbar = new Gtk.Toolbar(); var openButton = new Gtk.ToolButton(Gtk.Stock.Open); toolbar.Add(openButton); var image = new Gtk.Image(); openButton.Clicked += (sender, eventArgs) => { var fileDialog = new Gtk.FileChooserDialog("Choisissez une photo", null, Gtk.FileChooserAction.Open, "Open", Gtk.ResponseType.Accept); fileDialog.Run(); var photo = new Gdk.Pixbuf(fileDialog.Filename); fileDialog.Destroy(); // var photo = new Gdk.Pixbuf("/home/rapha/Bureau/300px-Thief_-_Radiohead.jpg"); // var photo = new IntegralImage("/home/rapha/Bureau/The_Beatles_Abbey_Road.jpg").Pixbuf; var detector = new Detector(photo, classifier.Value); foreach (var rect in detector.Detect()) { rect.Draw(photo); Console.WriteLine(rect); } image.Pixbuf = photo; }; var vbox = new Gtk.VBox(); vbox.PackStart(toolbar, false, false, 0); vbox.PackStart(image, true, true, 0); win.Add(vbox); win.ShowAll(); Gtk.Application.Run(); }
private void ConstructToolButtonQuit() { Debug.WriteLine("ConstructToolButtonQuit"); toolButtonQuit = new Gtk.ToolButton(null, null) { Name = "toolButtonQuit", }; actionGroupMain["File.Quit"].ConnectProxy(toolButtonQuit); }
protected virtual void AddActionCommands (Wrapper.Action action) { if (allowBinding) { Gtk.ToolButton bindButton = new Gtk.ToolButton (null, Catalog.GetString ("Bind to Field")); bindButton.IsImportant = true; bindButton.Show (); Insert (bindButton, -1); if (action == null) bindButton.Sensitive = false; bindButton.Clicked += delegate { frontend.NotifyBindField (); }; } }
internal protected override Gtk.ToolItem CreateToolItem (CommandManager manager) { Gtk.ToolButton item = new Gtk.ToolButton (text); item.StockId = icon; item.Clicked += new EventHandler (HandleActivation); return item; }
private void ConstructToolButtonCopy() { Debug.WriteLine("ConstructToolButtonCopy"); toolButtonCopy = new Gtk.ToolButton(null, null) { Name = "toolButtonCopy", }; actionGroupMain["Edit.Copy"].ConnectProxy(toolButtonCopy); }