private void _consoleTextView_OnPopulateContextMenu(object o, PopulatePopupArgs e) { Menu textViewContextMenu = (Menu)e.Args[0]; SeparatorMenuItem _contextMenuSeperator = new SeparatorMenuItem(); CheckMenuItem _autoscrollMenuItem = new CheckMenuItem() { Name = "_autoscrollMenuItem", Label = "Auto Scroll", TooltipText = "Enable or disable console autoscrolling", Active = _autoscroll }; _autoscrollMenuItem.Toggled += delegate(object sender, EventArgs args) { // it has to be written this way to get around a crash. // don't know why, but i do what must be done. var button = sender as CheckMenuItem; _autoscroll = button.Active; }; textViewContextMenu.Append(_contextMenuSeperator); textViewContextMenu.Append(_autoscrollMenuItem); textViewContextMenu.ShowAll(); }
public override void PopupMenu() { var menu = new Menu(); if (!this.relationType.DomainWhereDeclaredRelationType.IsSuperDomain) { var pullUpMenuItem = new MenuItem("Pull Up"); pullUpMenuItem.Activated += this.PullUpMenuItemActivated; menu.Add(pullUpMenuItem); var separator = new SeparatorMenuItem(); menu.Append(separator); var deleteMenuItem = new MenuItem("Delete"); deleteMenuItem.Activated += this.DeleteMenuItemActivated; menu.Add(deleteMenuItem); } else { var pushDownMenuItem = new MenuItem("Push Down"); pushDownMenuItem.Activated += this.PushDownMenuItemActivated; menu.Add(pushDownMenuItem); } menu.ShowAll(); menu.Popup(); }
private void BuildHeader() { source_actions_align = new Gtk.Alignment(0f, .5f, 1f, 0f) { RightPadding = 0, LeftPadding = 0, NoShowAll = true }; if (Hyena.PlatformDetection.IsMeeGo) { source_actions_align.RightPadding = 5; source_actions_align.TopPadding = 5; } footer = new VBox(); source_actions_box = new EventBox() { Visible = true }; BuildSearchEntry(); InterfaceActionService uia = ServiceManager.Get <InterfaceActionService> (); if (uia != null) { Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"]; if (action != null) { MenuItem item = new SeparatorMenuItem(); item.Show(); search_entry.Menu.Append(item); item = new ImageMenuItem(Stock.Help, null); item.Activated += delegate { action.Activate(); }; item.Show(); search_entry.Menu.Append(item); } } source_actions_box.ShowAll(); source_actions_align.Add(source_actions_box); source_actions_align.Hide(); search_entry.Show(); context_pane = new Banshee.ContextPane.ContextPane(); context_pane.ExpandHandler = b => { SetChildPacking(content.Widget, !b, true, 0, PackType.Start); SetChildPacking(context_pane, b, b, 0, PackType.End); }; // Top to bottom, their order is reverse of this: PackEnd(footer, false, false, 0); PackEnd(context_pane, false, false, 0); PackEnd(source_actions_align, false, false, 0); PackEnd(new ConnectedMessageBar(), false, true, 0); }
/// <summary> /// Add an action (on context menu) on the series grid. /// </summary> public MenuItem AddContextSeparator() { MenuItem result = new SeparatorMenuItem(); popupMenu.Append(result); return(result); }
public MenuBarController() { MenuBar mb = new MenuBar(); Menu filemenu = new Menu(); MenuItem file = new MenuItem("File"); file.Submenu = filemenu; ImageMenuItem importDirectoryMenuItem = new ImageMenuItem("Import Directory"); importDirectoryMenuItem.Activated += ImportDirectoryMenuItemOnActivated; filemenu.Append(importDirectoryMenuItem); ImageMenuItem open = new ImageMenuItem(Stock.Open); filemenu.Append(open); SeparatorMenuItem sep = new SeparatorMenuItem(); filemenu.Append(sep); ImageMenuItem exit = new ImageMenuItem(Stock.Quit); exit.Activated += (sender, args) => Application.Quit(); filemenu.Append(exit); mb.Append(file); View = mb; }
public override void PopupMenu() { var menu = new Menu(); if (!this.inheritance.DomainWhereDeclaredInheritance.IsSuperDomain) { var pullUpMenuItem = new MenuItem("Pull Up"); pullUpMenuItem.Activated += this.PullUpMenuItemActivated; menu.Add(pullUpMenuItem); var separator = new SeparatorMenuItem(); menu.Append(separator); var removeMenuItem = new MenuItem("Remove"); removeMenuItem.Activated += this.RemoveMenuItemActivated; menu.Add(removeMenuItem); } else { var pushDownMenuItem = new MenuItem("Push Down"); pushDownMenuItem.Activated += this.PushDownMenuItemActivated; menu.Add(pushDownMenuItem); } menu.ShowAll(); menu.Popup(); }
protected void OnTreeviewImagesButtonReleaseEvent(object o, ButtonReleaseEventArgs args) { if ((int)args.Event.Button == 3) { Gtk.Menu jBox = new Gtk.Menu(); Gtk.MenuItem MenuItem1; if (treeviewImages.Selection.CountSelectedRows() == 1) { foreach (object[] row in (ListStore)comboType.Model) { MenuItem1 = new MenuItem((string)row[0]); MenuItem1.Activated += OnImageListPopupDocType; jBox.Add(MenuItem1); } MenuItem1 = new SeparatorMenuItem(); jBox.Add(MenuItem1); TreeIter iter, parentIter; if (treeviewImages.Selection.GetSelected(out iter) && (ImageList.IterParent(out parentIter, iter)) && (ImageList.IterNChildren(parentIter) > 1)) { MenuItem1 = new MenuItem("Добавить в новый док."); MenuItem1.Activated += OnImageListPopupNewDoc; jBox.Add(MenuItem1); } MenuItem1 = new MenuItem("Удалить"); MenuItem1.Activated += OnImageListPopupDelete; jBox.Add(MenuItem1); } MenuItem1 = new MenuItem("Выбрать для всех"); Gtk.Menu jBox2 = new Gtk.Menu(); Gtk.MenuItem MenuItem2; MenuItem1.Submenu = jBox2; foreach (object[] row in (ListStore)comboType.Model) { MenuItem2 = new MenuItem((string)row[0]); MenuItem2.ButtonPressEvent += OnImageListPopupDocTypeAll; jBox2.Append(MenuItem2); } jBox.Append(MenuItem1); MenuItem1 = new MenuItem("Повернуть все"); jBox2 = new Gtk.Menu(); MenuItem1.Submenu = jBox2; MenuItem2 = new MenuItem("на 90°"); MenuItem2.ButtonPressEvent += OnImageListPopupRotate90All; jBox2.Append(MenuItem2); MenuItem2 = new MenuItem("на 180°"); MenuItem2.ButtonPressEvent += OnImageListPopupRotate180All; jBox2.Append(MenuItem2); MenuItem2 = new MenuItem("на 270°"); MenuItem2.ButtonPressEvent += OnImageListPopupRotate270All; jBox2.Append(MenuItem2); jBox.Append(MenuItem1); jBox.ShowAll(); jBox.Popup(); } }
public static void AppendSeparator(this Menu menu) { SeparatorMenuItem smi = new SeparatorMenuItem(); smi.Show(); menu.Append(smi); }
public ColorToolButton(Color color, string name) : base(new ColorBlockWidget(color), name) { Menu = new Menu(); SeparatorMenuItem sep = new SeparatorMenuItem(); (Menu as Menu).Append(sep); sep.Show(); // TODO: Figure out how to replace "new AccelGroup()" ImageMenuItem colors = new ImageMenuItem(Stock.ColorPicker, new AccelGroup()); if (colors.Child is Label) { (colors.Child as Label).Text = "More Colors..."; } colors.Activated += MoreColorsActivated; (Menu as Menu).Append(colors); colors.Show(); SetMainColor(AddColor(color, name)); numCustomItems = 0; }
public ImageMenuItem AddCustomColor(Color color) { ImageMenuItem item = CreateImageMenuItem(color, "Custom"); if(!(Menu is Menu)) { Menu = new Menu(); } Menu m = Menu as Menu; if(numCustomItems == 0) { SeparatorMenuItem sep = new SeparatorMenuItem(); m.Prepend(sep); sep.Show(); } m.Prepend(item); numCustomItems++; if(numCustomItems > 5) { m.Remove(m.Children[5]); numCustomItems--; } item.ShowAll(); return item; }
public ImageMenuItem AddCustomColor(Color color) { ImageMenuItem item = CreateImageMenuItem(color, "Custom"); if (!(Menu is Menu)) { Menu = new Menu(); } Menu m = Menu as Menu; if (numCustomItems == 0) { SeparatorMenuItem sep = new SeparatorMenuItem(); m.Prepend(sep); sep.Show(); } m.Prepend(item); numCustomItems++; if (numCustomItems > 5) { m.Remove(m.Children[5]); numCustomItems--; } item.ShowAll(); return(item); }
public override MenuItem Generate(Generator generator) { var mi = new SeparatorMenuItem(generator); if (!string.IsNullOrEmpty(MenuItemStyle)) mi.Style = MenuItemStyle; return mi; }
void UpdateGlobalWarningLabel() { KeyBindingConflict[] conflicts = currentBindings.CheckKeyBindingConflicts(IdeApp.CommandService.GetCommands()); if (conflicts.Length == 0) { globalWarningBox.Hide(); return; } globalWarningBox.Show(); conflicButton.MenuCreator = delegate { Menu menu = new Menu(); foreach (KeyBindingConflict conf in conflicts) { if (menu.Children.Length > 0) { SeparatorMenuItem it = new SeparatorMenuItem(); it.Show(); menu.Insert(it, -1); } foreach (Command cmd in conf.Commands) { string txt = currentBindings.GetBinding(cmd) + " - " + cmd.Text; MenuItem item = new MenuItem(txt); Command localCmd = cmd; item.Activated += delegate { SelectCommand(localCmd); }; item.Show(); menu.Insert(item, -1); } } return(menu); }; }
void OnPopulatePopup(object o, PopulatePopupArgs args) { Menu menu = args.Menu; MenuItem item; item = new SeparatorMenuItem(); item.Show(); menu.Prepend(item); item = new ImageMenuItem(Stock.Redo, null) { Sensitive = UndoManager.CanRedo }; item.Activated += delegate { UndoManager.Redo(); }; item.AddAccelerator("activate", accel_group, (uint)Gdk.Key.z, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask, AccelFlags.Visible); item.Show(); menu.Prepend(item); item = new ImageMenuItem(Stock.Undo, null) { Sensitive = UndoManager.CanUndo }; item.Activated += delegate { UndoManager.Undo(); }; item.AddAccelerator("activate", accel_group, (uint)Gdk.Key.z, Gdk.ModifierType.ControlMask, AccelFlags.Visible); item.Show(); menu.Prepend(item); }
public SearchEntry() { BuildSearchEntry(); InterfaceActionService uia = ServiceManager.Get <InterfaceActionService> (); if (uia != null) { Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"]; if (action != null) { MenuItem item = new SeparatorMenuItem(); item.Show(); Menu.Append(item); item = new ImageMenuItem(Stock.Help, null); item.Activated += delegate { action.Activate(); }; item.Show(); Menu.Append(item); } } SearchSensitive = true; Show(); }
private void ShowPopupMenu () { Gtk.Menu menu = new Gtk.Menu (); // Add the default 'Open' menu item TileAction open = new TileAction (Catalog.GetString ("Open"), Stock.Open, Open); ActionMenuItem open_menu_item = new ActionMenuItem (open); menu.Append (open_menu_item); if (EnableOpenWith) { // FIXME: Not sure if going with the parent is // the right thing to do in all cases. string mimetype = Utils.GetFirstPropertyOfParent (hit, "beagle:MimeType"); OpenWithMenu owm = new OpenWithMenu (mimetype); owm.ApplicationActivated += OpenWith; owm.AppendToMenu (menu); } if (Actions.Count > 0) { SeparatorMenuItem separator = new SeparatorMenuItem (); menu.Append (separator); foreach (TileAction action in Actions) { ActionMenuItem item = new ActionMenuItem (action); menu.Append (item); } } menu.ShowAll (); menu.Popup (); }
// ============================================ // PRIVATE Methods // ============================================ private void InitializeMenuBar() { MenuItem item; // File Menu Menu fileMenu = new Gtk.Menu(); item = new ImageMenuItem("Proxy Settings"); ((ImageMenuItem)item).Image = StockIcons.GetImage("Proxy", 20); item.Activated += new EventHandler(OnProxySettings); fileMenu.Append(item); item = new SeparatorMenuItem(); fileMenu.Append(item); item = new ImageMenuItem(Gtk.Stock.Quit, null); item.Activated += new EventHandler(OnQuit); fileMenu.Append(item); item = new MenuItem("_File"); item.Submenu = fileMenu; this.menuBar.Append(item); // Help Menu Menu helpMenu = new Gtk.Menu(); item = new ImageMenuItem(Gtk.Stock.About, null); item.Activated += new EventHandler(OnAbout); helpMenu.Append(item); item = new MenuItem("_Help"); item.Submenu = helpMenu; this.menuBar.Append(item); }
//build menubar void BuildMenuBar() { //create new menu bar menuBar = new MenuBar(); //create 'file' dropdown filemenu = new Gtk.Menu(); file = new Gtk.MenuItem("File"); file.Submenu = filemenu; agr = new AccelGroup(); mainWindowTracker.AddAccelGroup(agr); //add new button to file dropdown newi = new ImageMenuItem(Stock.New, agr); newi.AddAccelerator("activate", agr, new AccelKey( Gdk.Key.n, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); newi.Activated += NewCrop; filemenu.Append(newi); //add hr line sep = new SeparatorMenuItem(); filemenu.Append(sep); //add close button exit = new ImageMenuItem(Stock.Quit, agr); exit.AddAccelerator("activate", agr, new AccelKey( Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); //set up exit button exit.Activated += OnActivated; filemenu.Append(exit); //add to menu bar menuBar.Append(file); //add new vbox vbox = new VBox(false, 2); vbox.PackStart(menuBar, true, true, 0); //add our event box that contains our image vbox.PackStart(toCropBox); //add our upload button hbox = new HBox(); uploadButton = new Gtk.Button(); uploadButton.Label = "Upload Image"; uploadButton.Clicked += UploadCroppedImage; hbox.PackEnd(uploadButton, false, false, 2); vbox.PackEnd(hbox, false, false, 5); //finally add to main window mainWindowTracker.Add(vbox); mainWindowTracker.ShowAll(); }
public override MenuItem Generate(Generator generator) { var mi = new SeparatorMenuItem(generator); if (!string.IsNullOrEmpty(MenuItemStyle)) { mi.Style = MenuItemStyle; } return(mi); }
private void CreatePopupMenu() { menu = new Gtk.Menu(); MenuItem itDownload = new MenuItem("Download"); SeparatorMenuItem itSeparator = new SeparatorMenuItem(); MenuItem itCopy = new MenuItem("Copy elink to clipboard"); menu.Append(itDownload); menu.Append(itSeparator); menu.Append(itCopy); }
Menu CreateMenu(bool importantOnly) { if (TagModel != null) { Menu menu = new Menu(); bool itemsAdded = false; bool needsSeparator = false; foreach (StringTagDescription[] tags in TagModel.GetTagsGrouped()) { itemsAdded = false; foreach (StringTagDescription tag in tags) { if (tag.Important != importantOnly) { continue; } if (itemsAdded && needsSeparator) { SeparatorMenuItem sep = new SeparatorMenuItem(); needsSeparator = false; menu.Add(sep); } MenuItem item = new MenuItem(tag.Description); string tagString = tag.Name; item.ButtonPressEvent += delegate { InsertTag(tagString); }; menu.Add(item); itemsAdded = true; } needsSeparator = true; } if (importantOnly) { Menu subMenu = CreateMenu(false); if (subMenu.Children.Length > 0) { SeparatorMenuItem sep = new SeparatorMenuItem(); menu.Add(sep); MenuItem item = new MenuItem(GettextCatalog.GetString("More")); item.Submenu = subMenu; menu.Add(item); } } menu.ShowAll(); return(menu); } return(null); }
private void LoadBookmarks() { separator = new SeparatorMenuItem(); foreach (Bookmark bookmark in Bookmark.LoadAll()) { AddBookmark(bookmark); } bookmark_item.ShowAll(); }
void TextViewPopulatePopup (object o, PopulatePopupArgs args) { MenuItem item = new MenuItem (GettextCatalog.GetString ("Clear")); SeparatorMenuItem sep = new SeparatorMenuItem (); item.Activated += ClearActivated; item.Show (); sep.Show (); args.Menu.Add (sep); args.Menu.Add (item); }
public void Initalize(MainWindow window, MenuItem treerebuild, PropertiesView propertiesView) { this.window = window; this.propertiesView = propertiesView; menu = new Menu (); treenewitem = new MenuItem ("New Item..."); treenewitem.Activated += window.OnNewItemActionActivated; menu.Add (treenewitem); treeadditem = new MenuItem ("Add Item..."); treeadditem.Activated += window.OnAddItemActionActivated; menu.Add (treeadditem); treedelete = new MenuItem ("Delete"); treedelete.Activated += window.OnDeleteActionActivated; menu.Add (treedelete); seperator = new SeparatorMenuItem (); menu.Add (seperator); treeopenfile = new MenuItem ("Open File"); treeopenfile.Activated += delegate { List<TreeIter> iters; List<Gdk.Pixbuf> icons; GetSelectedTreePath(out iters, out icons); if(icons[0] != ICON_BASE) Process.Start(window._controller.GetFullPath(GetPathFromIter(iters[0]))); else Process.Start(openedProject); }; menu.Add (treeopenfile); treeopenfilelocation = new MenuItem ("Open File Location"); treeopenfilelocation.Activated += delegate { List<TreeIter> iters; List<Gdk.Pixbuf> icons; GetSelectedTreePath(out iters, out icons); if(icons[0] != ICON_BASE) Process.Start(System.IO.Path.GetDirectoryName(window._controller.GetFullPath(GetPathFromIter(iters[0])))); else Process.Start(System.IO.Path.GetDirectoryName(window._controller.GetFullPath(""))); }; menu.Add (treeopenfilelocation); seperator2 = new SeparatorMenuItem (); menu.Add (seperator2); menu.Add (treerebuild); }
void TextViewPopulatePopup(object o, PopulatePopupArgs args) { MenuItem item = new MenuItem(GettextCatalog.GetString("Clear")); SeparatorMenuItem sep = new SeparatorMenuItem(); item.Activated += ClearActivated; item.Show(); sep.Show(); args.Menu.Add(sep); args.Menu.Add(item); }
private void BuildHeader () { source_actions_align = new Gtk.Alignment (0f, .5f, 1f, 0f) { RightPadding = 0, LeftPadding = 0, NoShowAll = true }; if (Hyena.PlatformDetection.IsMeeGo) { source_actions_align.RightPadding = 5; source_actions_align.TopPadding = 5; } footer = new VBox (); source_actions_box = new EventBox () { Visible = true }; BuildSearchEntry (); InterfaceActionService uia = ServiceManager.Get<InterfaceActionService> (); if (uia != null) { Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"]; if (action != null) { MenuItem item = new SeparatorMenuItem (); item.Show (); search_entry.Menu.Append (item); item = new ImageMenuItem (Stock.Help, null); item.Activated += delegate { action.Activate (); }; item.Show (); search_entry.Menu.Append (item); } } source_actions_box.ShowAll (); source_actions_align.Add (source_actions_box); source_actions_align.Hide (); search_entry.Show (); context_pane = new Banshee.ContextPane.ContextPane (); context_pane.ExpandHandler = b => { SetChildPacking (content.Widget, !b, true, 0, PackType.Start); SetChildPacking (context_pane, b, b, 0, PackType.End); }; // Top to bottom, their order is reverse of this: PackEnd (footer, false, false, 0); PackEnd (context_pane, false, false, 0); PackEnd (source_actions_align, false, false, 0); PackEnd (new ConnectedMessageBar (), false, true, 0); }
private void ConfigureOsxMainMenu() { var osx_app = new GtkOsxApplication(); // remove the "Quit" item as this is auto-added by gtk-mac-integration to the AppMenu var quit_item = ((MenuItem)interface_action_service.UIManager.GetWidget("/MainMenu/MediaMenu/Quit")); if (quit_item != null) { quit_item.Hide(); } MenuShell shell = (MenuShell)interface_action_service.UIManager.GetWidget("/MainMenu"); if (shell != null) { osx_app.SetMenu(shell); } // place the "about" and "preferences" menu items into the OS X application menu // as every OS X app uses this convention var about_item = interface_action_service.UIManager.GetWidget("/MainMenu/HelpMenu/About") as MenuItem; if (about_item != null) { osx_app.InsertIntoAppMenu(about_item, 0); } // place a separator between the About and the Preferences dialog var separator = new SeparatorMenuItem(); osx_app.InsertIntoAppMenu(separator, 1); var preferences_item = interface_action_service.UIManager.GetWidget("/MainMenu/EditMenu/Preferences") as MenuItem; if (preferences_item != null) { osx_app.InsertIntoAppMenu(preferences_item, 2); } // remove unnecessary separator as we have moved the preferences item var preferences_seperator = interface_action_service.UIManager.GetWidget("/MainMenu/EditMenu/PreferencesSeparator") as SeparatorMenuItem; if (preferences_seperator != null) { preferences_seperator.Destroy(); } // actually performs the menu binding osx_app.Ready(); }
private void ConstruirPopupMenu() { popupMenu = new Menu(); MenuItem menuInformacoesDiretorioArquivo = new MenuItem("Informações do Diretório / Arquivo"); menuInformacoesDiretorioArquivo.Activated += new EventHandler(OnInformacoesDiretorioArquivoActivated); menuInformacoesDiretorioArquivo.Show(); popupMenu.Append(menuInformacoesDiretorioArquivo); MenuItem menuExcluirDiretorioSelecionado = new MenuItem("Excluir Diretório Selecionado"); menuExcluirDiretorioSelecionado.Activated += new EventHandler(OnExcluirDiretorioSelecionadoActivated); menuExcluirDiretorioSelecionado.Show(); popupMenu.Append(menuExcluirDiretorioSelecionado); MenuItem menuExpandirDiretorios2 = new MenuItem("Expandir Diretórios"); menuExpandirDiretorios2.Activated += new EventHandler(OnExpandirDiretorios2Activated); menuExpandirDiretorios2.Show(); popupMenu.Append(menuExpandirDiretorios2); MenuItem menuColapsarDiretorios2 = new MenuItem("Colapsar Diretórios"); menuColapsarDiretorios2.Activated += new EventHandler(OnColapsarDiretorios2Activated); menuColapsarDiretorios2.Show(); popupMenu.Append(menuColapsarDiretorios2); SeparatorMenuItem separador2 = new SeparatorMenuItem(); separador2.Show(); popupMenu.Append(separador2); MenuItem menuIncluirNovaAba2 = new MenuItem("Incluir nova aba"); menuIncluirNovaAba2.Activated += new EventHandler(OnIncluirNovaAba2Activated); menuIncluirNovaAba2.Show(); popupMenu.Append(menuIncluirNovaAba2); MenuItem menuAlterarNomeAbaAtiva2 = new MenuItem("Alterar nome da aba ativa"); menuAlterarNomeAbaAtiva2.Activated += new EventHandler(OnAlterarNomeAbaAtiva2Activated); menuAlterarNomeAbaAtiva2.Show(); popupMenu.Append(menuAlterarNomeAbaAtiva2); MenuItem menuExcluirAbaAtiva2 = new MenuItem("Excluir aba ativa"); menuExcluirAbaAtiva2.Activated += new EventHandler(OnExcluirAbaAtiva2Activated); menuExcluirAbaAtiva2.Show(); popupMenu.Append(menuExcluirAbaAtiva2); }
public MenuBuilderContext AddSeparator() { var separator = new SeparatorMenuItem(); var menuData = new MenuData { Level = _current.Level, Item = separator, Type = MenuType.Separator }; _current = menuData; _menuDatas.Add(menuData); return(this); }
void AddMenu() { var mb = new MenuBar(); var filemenu = new Menu(); var file = new MenuItem("文件") { Submenu = filemenu }; var agr = new AccelGroup(); AddAccelGroup(agr); var newi = new ImageMenuItem(Stock.New, agr); newi.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.n, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); filemenu.Append(newi); var open = new ImageMenuItem(Stock.Open, agr); open.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.n, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); filemenu.Append(open); var sep = new SeparatorMenuItem(); filemenu.Append(sep); var exit = new ImageMenuItem(Stock.Quit, agr); exit.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); //var exit = new MenuItem("退出"); exit.Activated += (sender, args) => { Application.Quit(); }; filemenu.Append(exit); mb.Append(file); //var _windowBox = new VBox(false, 2); _windowBox.PackStart(mb, false, false, 0); //_windowBox.PackStart(new Label("2333"), false, false, 0); //Add(_windowBox); }
public ZoomWidget(ScaleRange range, double startScale) { _range = range; _scale = startScale; zoomSlider = new HScale (range.Minimum, range.Maximum, range.Step); zoomEntry = new Entry (startScale.ToString ()); seperator = new SeparatorMenuItem (); zoomSlider.Value = startScale; zoomSlider.ValueChanged += OnSliderChangeValue;; zoomEntry.TextInserted += OnEntryTextInserted; Add (zoomSlider); Add (seperator); Add (zoomEntry); }
private void LoadBookmarks() { separator = new SeparatorMenuItem(); foreach (var bookmark in Bookmark.Provider.FetchAllMatching("Type IS NULL")) { if (bookmark.Track != null) { AddBookmark(bookmark); } else { Hyena.Log.DebugFormat("Removing bookmark that points to missing track ({0})", bookmark.Position); bookmark.Remove(); } } bookmark_item.ShowAll(); }
protected override bool OnButtonPressEvent(Gdk.EventButton ev) { base.OnButtonPressEvent(ev); status.Pop(1); TreeIter iter; Selection.GetSelected(out iter); if (HasParent(Model, iter)) { IFactory f = Model.GetValue(iter, 1) as IFactory; status.Push(1, String.Format(Catalog.GetString("{0} plugin selected"), f.Info.Name)); if (ev.Button == 3) { Menu m = new Menu(); ImageMenuItem m1 = new ImageMenuItem(Catalog.GetString("A_dd")); m1.Image = new Image(null, "list-add.png"); m1.Activated += delegate(object sender, EventArgs e) { Plugin.Base p = f.Create(); p.Source = PluginDB.Origin[f]; schematic.Add(p); }; m.Append(m1); SeparatorMenuItem s = new SeparatorMenuItem(); m.Append(s); ImageMenuItem m2 = new ImageMenuItem(Catalog.GetString("_About")); m2.Image = new Image(null, "help-browser.png"); m2.Activated += delegate(object sender, EventArgs e) { new PluginAbout(f); }; m.Append(m2); m.ShowAll(); m.Popup(); } } return(true); }
void TextViewPopulatePopup(object o, PopulatePopupArgs args) { //ReplaceGtkIconsByOwnOnes(args.Menu); SeparatorMenuItem sep = new SeparatorMenuItem(); sep.Show(); args.Menu.Add(sep); TaggedLocalizedImageMenuItem newitem = new TaggedLocalizedImageMenuItem("Clear"); newitem.Image = new Image(Gdk.Pixbuf.LoadFromResource("Docking.Framework.Resources.Broom-16.png")); newitem.Activated += (object sender, EventArgs e) => Clear(); newitem.ShowAll(); args.Menu.Add(newitem); Localization.LocalizeMenu(args.Menu); }
public ColorToolButton(Color color, string name) : base(new ColorBlockWidget(color), name) { Menu = new Menu(); SeparatorMenuItem sep = new SeparatorMenuItem(); (Menu as Menu).Append(sep); sep.Show(); // TODO: Figure out how to replace "new AccelGroup()" ImageMenuItem colors = new ImageMenuItem(Stock.ColorPicker, new AccelGroup()); if(colors.Child is Label) (colors.Child as Label).Text = "More Colors..."; colors.Activated += MoreColorsActivated; (Menu as Menu).Append(colors); colors.Show(); SetMainColor(AddColor(color, name)); numCustomItems = 0; }
void SetupMenu() { activated = new CheckMenuItem(Catalog.GetString("Activate")); menu = new Menu(); activated.Active = true; MenuItem now = new MenuItem(Catalog.GetString("Show now")); SeparatorMenuItem separator = new SeparatorMenuItem(); MenuItem preferences = new ImageMenuItem(Gtk.Stock.Preferences, null); MenuItem quit = new ImageMenuItem(Gtk.Stock.Quit, null); quit.Activated += QuitAction; preferences.Activated += PreferencesActivated; activated.Activated += EnableActivated; now.Activated += ShowNowActivated; menu.Add(activated); menu.Add(now); menu.Add(separator); menu.Add(preferences); menu.Add(quit); }
Menu CreateMenu (bool importantOnly) { if (TagModel != null) { Menu menu = new Menu (); bool itemsAdded = false; foreach (StringTagDescription[] tags in TagModel.GetTagsGrouped ()) { if (itemsAdded) { SeparatorMenuItem sep = new SeparatorMenuItem (); menu.Add (sep); } foreach (StringTagDescription tag in tags) { if (tag.Important != importantOnly) continue; MenuItem item = new MenuItem (tag.Description); string tagString = tag.Name; item.ButtonPressEvent += delegate { InsertTag (tagString); }; menu.Add (item); itemsAdded = true; } } if (importantOnly) { Menu subMenu = CreateMenu (false); if (subMenu.Children.Length > 0) { SeparatorMenuItem sep = new SeparatorMenuItem (); menu.Add (sep); MenuItem item = new MenuItem (GettextCatalog.GetString ("More")); item.Submenu = subMenu; menu.Add (item); } } menu.ShowAll (); return menu; } return null; }
protected override void InsertProxy(Gtk.Action menuAction, Widget parent, Widget afterItem) { int position = 0; Widget item = null; if (parent is MenuItem || parent is Menu) { Menu parent_menu = ((parent is MenuItem) ? (parent as MenuItem).Submenu : parent) as Menu; position = (afterItem != null) ? Array.IndexOf(parent_menu.Children, afterItem as MenuItem) + 1 : 0; item = GetNewMenuItem(); if (item != null) { var separator1 = new SeparatorMenuItem(); var separator2 = new SeparatorMenuItem(); //fix for separators that potentially already exist below the insert position bool alreadyHasSeparator2 = ((parent_menu.Children [position]) as SeparatorMenuItem != null); parent_menu.Insert(separator2, position); parent_menu.Insert(item, position); parent_menu.Insert(separator1, position); item.Shown += (o, e) => { separator1.Show(); if (!alreadyHasSeparator2) { separator2.Show(); } }; item.Hidden += (o, e) => { separator1.Hide(); separator2.Hide(); }; } } var activatable = item as IActivatable; if (activatable != null) { activatable.RelatedAction = action; } }
public SearchEntry () { BuildSearchEntry (); InterfaceActionService uia = ServiceManager.Get<InterfaceActionService> (); if (uia != null) { Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"]; if (action != null) { MenuItem item = new SeparatorMenuItem (); item.Show (); Menu.Append (item); item = new ImageMenuItem (Stock.Help, null); item.Activated += delegate { action.Activate (); }; item.Show (); Menu.Append (item); } } SearchSensitive = true; Show (); }
private void OnPopupMenu(object o, PopupMenuArgs args) { Menu popupMenu = new Menu(); ImageMenuItem targets = new ImageMenuItem( Services.PlatformService.GetString("Giver Recipients ...")); targets.Image = new Gtk.Image(Utilities.GetIcon("giver-24", 24)); targets.Activated += OnShowTargets; popupMenu.Add(targets); SeparatorMenuItem separator = new SeparatorMenuItem(); popupMenu.Add(separator); ImageMenuItem preferences = new ImageMenuItem(Gtk.Stock.Preferences, null); preferences.Activated += OnPreferences; popupMenu.Add(preferences); ImageMenuItem about = new ImageMenuItem(Gtk.Stock.About, null); about.Activated += OnAbout; popupMenu.Add(about); separator = new SeparatorMenuItem(); popupMenu.Add(separator); ImageMenuItem quit = new ImageMenuItem(Gtk.Stock.Quit, null); quit.Activated += OnQuit; popupMenu.Add(quit); popupMenu.ShowAll(); // shows everything popupMenu.Popup(null, null, null, 3, Gtk.Global.CurrentEventTime); }
void Populate (Menu container, string caption, string pdir, string collection, string [] elements) { string profiledir = System.IO.Path.Combine (monodir, pdir); string MONO_GAC_PREFIX = Environment.GetEnvironmentVariable ("MONO_GAC_PREFIX"); string[] gac_prefixes = null; if (!string.IsNullOrEmpty (MONO_GAC_PREFIX)) gac_prefixes = MONO_GAC_PREFIX.Split (':'); MenuItem item = new MenuItem (caption); Menu sub = new Menu (); item.Submenu = sub; MenuItem child = null; foreach (string e in elements){ if (e == String.Empty){ // Avoid inserting separators twice if (child is SeparatorMenuItem || sub.Children.Length == 0) continue; child = new SeparatorMenuItem (); } else { string assemblyfile = null; bool found = false; if (gac_prefixes == null) { assemblyfile = System.IO.Path.Combine (profiledir, e + ".dll"); found = System.IO.File.Exists (assemblyfile); } else { foreach (string prefix in gac_prefixes) { assemblyfile = System.IO.Path.Combine ( System.IO.Path.Combine ( System.IO.Path.Combine ( System.IO.Path.Combine (prefix, "lib"), "mono"), pdir), e + ".dll"); found = System.IO.File.Exists (assemblyfile); if (found) break; } } if (!found) { assemblyfile = System.IO.Path.Combine (moondir, e + ".dll"); found = System.IO.File.Exists (assemblyfile); } if (!found) { Console.WriteLine ("Skipping {0} for profile {1}, could not locate it in profile dir or MONO_GAC_PREFIX", e, pdir); continue; } string element = e; child = new MenuItem (e); child.Activated += delegate { StartPresetCompare (assemblyfile, collection, element, caption); }; } sub.Add (child); } if (sub.Children.Length > 0) { item.ShowAll (); container.Add (item); } }
void DoPopUp() { popup = new Menu(); ImageMenuItem newItem = new ImageMenuItem ("New"); Gtk.Image newImage = new Gtk.Image (Stock.New, IconSize.Menu); newItem.Image = newImage; newItem.Activated += new EventHandler (OnNewEntryActivate); newItem.Show (); popup.Append (newItem); Gdk.Pixbuf pb = Gdk.Pixbuf.LoadFromResource ("document-save.png"); ImageMenuItem exportItem = new ImageMenuItem ("Export"); exportItem.Image = new Gtk.Image (pb); exportItem.Activated += new EventHandler (OnExportActivate); exportItem.Show (); popup.Append (exportItem); ImageMenuItem deleteItem = new ImageMenuItem ("Delete"); Gtk.Image deleteImage = new Gtk.Image (Stock.Delete, IconSize.Menu); deleteItem.Image = deleteImage; deleteItem.Activated += new EventHandler (OnDeleteActivate); deleteItem.Show (); popup.Append (deleteItem); ImageMenuItem propItem = new ImageMenuItem ("Properties"); Gtk.Image propImage = new Gtk.Image (Stock.Properties, IconSize.Menu); propItem.Image = propImage; propItem.Activated += new EventHandler (OnEditActivate); propItem.Show (); popup.Append (propItem); bool users = false; if (viewPlugin.Name.ToLower() == "users") { SeparatorMenuItem sm = new SeparatorMenuItem (); sm.Show (); popup.Append (sm); Gdk.Pixbuf pwdImage = Gdk.Pixbuf.LoadFromResource ("locked16x16.png"); ImageMenuItem pwdItem = new ImageMenuItem ("Change password"); pwdItem.Image = new Gtk.Image (pwdImage); pwdItem.Activated += new EventHandler (OnPwdActivate); pwdItem.Show (); popup.Append (pwdItem); users = true; } if (users || viewPlugin.Name.ToLower() == "contacts") { if (!users) { SeparatorMenuItem sm = new SeparatorMenuItem (); sm.Show (); popup.Append (sm); } pb = Gdk.Pixbuf.LoadFromResource ("mail-message-new.png"); ImageMenuItem mailItem = new ImageMenuItem ("Send email"); mailItem.Image = new Gtk.Image (pb); mailItem.Activated += new EventHandler (OnEmailActivate); mailItem.Show (); popup.Append (mailItem); Gdk.Pixbuf wwwImage = Gdk.Pixbuf.LoadFromResource ("go-home.png"); ImageMenuItem wwwItem = new ImageMenuItem ("Open home page"); wwwItem.Image = new Gtk.Image (wwwImage); wwwItem.Activated += new EventHandler (OnWWWActivate); wwwItem.Show (); popup.Append (wwwItem); } popup.Popup(null, null, null, 3, Gtk.Global.CurrentEventTime); }
// // Constructor // public InfoManager (MainWindow main) { this.main = main; string corlibdir = System.IO.Path.GetDirectoryName (typeof (int).Assembly.Location); monodir = System.IO.Path.GetFullPath (System.IO.Path.Combine (corlibdir, "..")); moondir = System.IO.Path.Combine (monodir, @"../moonlight/plugin"); // Work around limitation in Stetic, there is no way // of getting a handle on the menu (!!!) // Populate File/Recent Comparisons, this would be so much // easier if Stetic had any support for this. recentmenu = new Menu (); MenuItem filemenuitem = (main.MenuBar.Children [0]) as MenuItem; Menu filesub = (Menu) filemenuitem.Submenu; MenuItem recentmenuitem = new MenuItem ("Recent Comparisons"); recentmenuitem.Submenu = recentmenu; recentmenuitem.ShowAll (); filesub.Insert (recentmenuitem, 0); MenuItem sep = new MenuItem (); sep.ShowAll (); filesub.Insert (sep, 1); PopulateRecent (); // Populate the list of profile comparisons Menu sub = null; foreach (MenuItem mi in main.MenuBar.AllChildren){ AccelLabel a = mi.Child as AccelLabel; if (a == null || a.LabelProp != "_Compare") continue; if (a.LabelProp == "Recent Comparisons"){ } sub = (Menu) mi.Submenu; break; } if (sub == null){ Console.WriteLine ("Unable to found Compare submenu"); return; } MenuItem separator = new SeparatorMenuItem (); separator.ShowAll (); sub.Add (separator); Populate (sub, "API 1.1", GetVersionPath ("1.0", "net_1_1"), "1.0", api_1_1); Populate (sub, "API 2.0 sp2", GetVersionPath ("2.0", "net_2_0"), "2.0", api_2_0); Populate (sub, "API 3.0 sp1", GetVersionPath ("2.0", "net_2_0"), "3.0", api_3_0); Populate (sub, "API 3.5 sp1", GetVersionPath ("2.0", "net_2_0"), "3.5", api_3_5); Populate (sub, "API 4.0", GetVersionPath ("4.0", "net_4_0"), "4.0", api_4_0); Populate (sub, "API 4.5", GetVersionPath ("4.5", "net_4_5"), "4.5", api_4_5); // Populate (sub, "Silverlight 2.0", GetVersionPath ("2.1", "net_2_1"), "SL2", api_sl2); // Populate (sub, "Silverlight 3.0", GetVersionPath ("2.1", "net_2_1"), "SL3", api_sl2); Populate (sub, "Silverlight 4.0", GetVersionPath ("2.1", "net_2_1"), "SL4", api_sl4); }
public static void AppendSeparator(this Menu menu) { SeparatorMenuItem smi = new SeparatorMenuItem (); smi.Show (); menu.Append (smi); }
private void LoadBookmarks () { separator = new SeparatorMenuItem (); foreach (var bookmark in Bookmark.Provider.FetchAllMatching ("Type IS NULL")) { if (bookmark.Track != null) { AddBookmark (bookmark); } else { Hyena.Log.DebugFormat ("Removing bookmark that points to missing track ({0})", bookmark.Position); bookmark.Remove (); } } bookmark_item.ShowAll (); }
protected void OnTreeviewImagesButtonReleaseEvent(object o, ButtonReleaseEventArgs args) { if((int)args.Event.Button == 3) { Gtk.Menu jBox = new Gtk.Menu(); Gtk.MenuItem MenuItem1; if(treeviewImages.Selection.CountSelectedRows () == 1) { foreach(object[] row in (ListStore)comboType.Model) { MenuItem1 = new MenuItem((string)row[0]); MenuItem1.Activated += OnImageListPopupDocType; jBox.Add(MenuItem1); } MenuItem1 = new SeparatorMenuItem(); jBox.Add(MenuItem1); TreeIter iter, parentIter; if(treeviewImages.Selection.GetSelected(out iter) && (ImageList.IterParent(out parentIter, iter)) && (ImageList.IterNChildren(parentIter) > 1)) { MenuItem1 = new MenuItem("Добавить в новый док."); MenuItem1.Activated += OnImageListPopupNewDoc; jBox.Add(MenuItem1); } MenuItem1 = new MenuItem("Удалить"); MenuItem1.Activated += OnImageListPopupDelete; jBox.Add(MenuItem1); } MenuItem1 = new MenuItem("Выбрать для всех"); Gtk.Menu jBox2 = new Gtk.Menu(); Gtk.MenuItem MenuItem2; MenuItem1.Submenu = jBox2; foreach(object[] row in (ListStore)comboType.Model) { MenuItem2 = new MenuItem((string)row[0]); MenuItem2.ButtonPressEvent += OnImageListPopupDocTypeAll; jBox2.Append(MenuItem2); } jBox.Append(MenuItem1); MenuItem1 = new MenuItem("Повернуть все"); jBox2 = new Gtk.Menu(); MenuItem1.Submenu = jBox2; MenuItem2 = new MenuItem("на 90°"); MenuItem2.ButtonPressEvent += OnImageListPopupRotate90All; jBox2.Append(MenuItem2); MenuItem2 = new MenuItem("на 180°"); MenuItem2.ButtonPressEvent += OnImageListPopupRotate180All; jBox2.Append(MenuItem2); MenuItem2 = new MenuItem("на 270°"); MenuItem2.ButtonPressEvent += OnImageListPopupRotate270All; jBox2.Append(MenuItem2); jBox.Append(MenuItem1); jBox.ShowAll(); jBox.Popup(); } }
private void treeviewPersonsContextMenu(Person myPerson) { Menu myMenu = new Menu (); Gtk.MenuItem myItem; myItem = new MenuItem ( Catalog.GetString("Edit") + " " + myPerson.Name); myItem.Activated += on_edit_current_person_clicked; myMenu.Attach( myItem, 0, 1, 0, 1 ); myItem = new MenuItem ( Catalog.GetString("Show all tests of") + " " + myPerson.Name); myItem.Activated += on_show_all_person_events_activate; myMenu.Attach( myItem, 0, 1, 1, 2 ); Gtk.SeparatorMenuItem mySep = new SeparatorMenuItem(); myMenu.Attach( mySep, 0, 1, 2, 3 ); myItem = new MenuItem ( string.Format(Catalog.GetString("Delete {0} from this session"),myPerson.Name)); myItem.Activated += on_delete_current_person_from_session_clicked; myMenu.Attach( myItem, 0, 1, 3, 4 ); myMenu.Popup(); myMenu.ShowAll(); }
public SeparatorMenuItem AddSeparator(Menu subMenu) { SeparatorMenuItem item = new SeparatorMenuItem(); item.Submenu = subMenu; Append(item); return(item); }
public ViewerMenuBar() : base() { /* File menu */ fileOpenSeparator = new SeparatorMenuItem (); saveAsSeparator = new SeparatorMenuItem (); saveAsMenuItem = new ImageMenuItem (Catalog. GetString ("Save _As")); saveAsMenuItem.Image = new Image (Stock.Refresh, IconSize.Menu); printMenuItem = new ImageMenuItem (Catalog. GetString ("_Print")); printMenuItem.Image = new Image (Stock.Print, IconSize.Menu); Menu menu = fileMenuItem.Submenu as Menu; int i = 0; menu.Insert (fileOpenSeparator, i++); menu.Insert (saveAsMenuItem, i++); menu.Insert (saveAsSeparator, i++); menu.Insert (printMenuItem, i++); /* Action menu */ actionMenuItem = new MenuItem (Catalog. GetString ("_Action")); AppendAfter (fileMenuItem, actionMenuItem); menu = new Menu (); actionMenuItem.Submenu = menu; switchSideMenuItem = new ImageMenuItem (Catalog. GetString ("_Switch Side")); switchSideMenuItem.Image = new Image (Stock.Refresh, IconSize.Menu); menu.Append (switchSideMenuItem); /* Edit menu */ menu = editMenuItem.Submenu as Menu; moveCommentMenuItem = new MenuItem (Catalog. GetString ("Move _Comment")); menu.Append (moveCommentMenuItem); /* Export As menu */ exportAsMenuItem = new MenuItem (Catalog. GetString ("_Export As")); AppendAfter (editMenuItem, exportAsMenuItem); /* View menu */ menu = viewMenuItem.Submenu as Menu; highlightMoveMenuItem = new CheckMenuItem (Catalog. GetString ("_Highlight Move")); menu.Append (highlightMoveMenuItem); ShowAll (); }
void UpdateGlobalWarningLabel () { KeyBindingConflict[] conflicts = currentBindings.CheckKeyBindingConflicts (IdeApp.CommandService.GetCommands ()); if (conflicts.Length == 0) { globalWarningBox.Hide (); return; } globalWarningBox.Show (); conflicButton.MenuCreator = delegate { Menu menu = new Menu (); foreach (KeyBindingConflict conf in conflicts) { if (menu.Children.Length > 0) { SeparatorMenuItem it = new SeparatorMenuItem (); it.Show (); menu.Insert (it, -1); } foreach (Command cmd in conf.Commands) { string txt = currentBindings.GetBinding (cmd) + " - " + cmd.Text; MenuItem item = new MenuItem (txt); Command localCmd = cmd; item.Activated += delegate { SelectCommand (localCmd); }; item.Show (); menu.Insert (item, -1); } } return menu; }; }
void TextViewPopulatePopup(object o, PopulatePopupArgs args) { MenuItem item = new MenuItem (GettextCatalog.GetString ("Clear")); SeparatorMenuItem sep = new SeparatorMenuItem (); item.Activated += ClearActivated; item.Show (); sep.Show (); args.Menu.Add (sep); args.Menu.Add (item); foreach (var menu_command in menuCommands) { var tmp = new MenuItem(menu_command.Item1); tmp.Activated += menu_command.Item2; tmp.Show(); args.Menu.Add(tmp); } }
void TextViewPopulatePopup(object o, PopulatePopupArgs args) { //ReplaceGtkIconsByOwnOnes(args.Menu); SeparatorMenuItem sep = new SeparatorMenuItem(); sep.Show(); args.Menu.Add(sep); TaggedLocalizedImageMenuItem newitem = new TaggedLocalizedImageMenuItem("Clear"); newitem.Image = Docking.Tools.ResourceLoader_Docking.LoadImage("Broom-16.png"); newitem.Activated += (object sender, EventArgs e) => Clear(); newitem.ShowAll(); args.Menu.Add(newitem); Localization.LocalizeMenu(args.Menu); }
private void treeviewJumpsContextMenu(Jump myJump) { Menu myMenu = new Menu (); Gtk.MenuItem myItem; /* myItem = new MenuItem ( Catalog.GetString("Play Video") + " " + myJump.Type + " (" + myJump.PersonName + ")"); if(File.Exists(Util.GetVideoFileName(currentSession.UniqueID, Constants.TestTypes.JUMP, myTreeViewJumps.EventSelectedID))) { myItem.Activated += on_video_play_selected_jump_clicked; myItem.Sensitive = true; } else myItem.Sensitive = false; myMenu.Attach( myItem, 0, 1, 0, 1 ); */ myItem = new MenuItem ( Catalog.GetString("Edit selected") + " " + myJump.Type + " (" + myJump.PersonName + ")"); myItem.Activated += on_edit_selected_jump_clicked; myMenu.Attach( myItem, 0, 1, 0, 1 ); Gtk.SeparatorMenuItem mySep = new SeparatorMenuItem(); myMenu.Attach( mySep, 0, 1, 1, 2 ); myItem = new MenuItem ( Catalog.GetString("Delete selected") + " " + myJump.Type + " (" + myJump.PersonName + ")"); myItem.Activated += on_delete_selected_jump_clicked; myMenu.Attach( myItem, 0, 1, 2, 3 ); myMenu.Popup(); myMenu.ShowAll(); }
private void treeviewRunsIntervalContextMenu(RunInterval myRun) { Menu myMenu = new Menu (); Gtk.MenuItem myItem; /* myItem = new MenuItem ( Catalog.GetString("Play Video") + " " + myRun.Type + " (" + myRun.PersonName + ")"); if(File.Exists(Util.GetVideoFileName(currentSession.UniqueID, Constants.TestTypes.RUN_I, myTreeViewRunsInterval.EventSelectedID))) { myItem.Activated += on_video_play_selected_run_interval_clicked; myItem.Sensitive = true; } else myItem.Sensitive = false; myMenu.Attach( myItem, 0, 1, 0, 1 ); */ myItem = new MenuItem ( Catalog.GetString("Edit selected") + " " + myRun.Type + " (" + myRun.PersonName + ")"); myItem.Activated += on_edit_selected_run_interval_clicked; myMenu.Attach( myItem, 0, 1, 0, 1 ); myItem = new MenuItem ( Catalog.GetString("Repair selected") + " " + myRun.Type + " (" + myRun.PersonName + ")"); myItem.Activated += on_repair_selected_run_interval_clicked; myMenu.Attach( myItem, 0, 1, 1, 2 ); Gtk.SeparatorMenuItem mySep = new SeparatorMenuItem(); myMenu.Attach( mySep, 0, 1, 2, 3 ); myItem = new MenuItem ( Catalog.GetString("Delete selected") + " " + myRun.Type + " (" + myRun.PersonName + ")"); myItem.Activated += on_delete_selected_run_interval_clicked; myMenu.Attach( myItem, 0, 1, 3, 4 ); myMenu.Popup(); myMenu.ShowAll(); }
/// <summary> /// Initializes all GUI components. /// </summary> /// <history> /// [Curtis_Beard] 11/03/2006 Created /// </history> private void InitializeComponent() { this.SetDefaultSize (Core.GeneralSettings.WindowWidth, Core.GeneralSettings.WindowHeight); if (Core.GeneralSettings.WindowLeft == -1 && Core.GeneralSettings.WindowTop == -1) this.SetPosition(WindowPosition.Center); else this.Move(Core.GeneralSettings.WindowLeft, Core.GeneralSettings.WindowTop); this.DeleteEvent += new DeleteEventHandler(OnWindowDelete); this.Title = Constants.ProductName; this.Icon = Images.GetPixbuf("AstroGrep_Icon.ico"); MainTooltips = new Tooltips(); VBox vbox = new VBox(); vbox.BorderWidth = 0; Frame leftFrame = new Frame(); leftFrame.Shadow = ShadowType.In; leftFrame.WidthRequest = 200; VBox searchBox = new VBox(); VBox searchOptionsBox = new VBox(); searchBox.BorderWidth = 3; searchOptionsBox.BorderWidth = 3; lblSearchStart = new Label("Search Path"); lblSearchStart.SetAlignment(0,0); btnBrowse = new Button(); btnBrowse.SetSizeRequest(32, 20); Gtk.Image img = new Image(); img.Pixbuf = Images.GetPixbuf("folder-open.png"); VBox browseBox = new VBox(); browseBox.PackStart(img, false, false, 0); MainTooltips.SetTip(btnBrowse, "Select the folder to start the search", ""); btnBrowse.Clicked += new EventHandler(btnBrowse_Clicked); btnBrowse.Add(browseBox); cboSearchStart = ComboBoxEntry.NewText(); cboSearchFilter = ComboBoxEntry.NewText(); cboSearchText = ComboBoxEntry.NewText(); LoadComboBoxEntry(cboSearchStart, Core.GeneralSettings.SearchStarts, true); LoadComboBoxEntry(cboSearchFilter, Core.GeneralSettings.SearchFilters, false); LoadComboBoxEntry(cboSearchText, Core.GeneralSettings.SearchTexts, false); cboSearchStart.Changed += new EventHandler(cboSearchStart_Changed); lblSearchFilter = new Label("File Types"); lblSearchFilter.SetAlignment(0,0); lblSearchText = new Label("Search Text"); lblSearchText.SetAlignment(0,0); // search path VBox startVBox = new VBox(); startVBox.BorderWidth = 0; cboSearchStart.WidthRequest = 100; SetActiveComboBoxEntry(cboSearchStart); HBox startHBox = new HBox(); startHBox.BorderWidth = 0; startHBox.PackStart(cboSearchStart, true, true, 0); startHBox.PackEnd(btnBrowse, false, false, 0); startVBox.PackStart(lblSearchStart, false, false, 0); startVBox.PackStart(startHBox, true, false, 0); searchBox.PackStart(startVBox, true, false, 0); // search filter VBox filterVBox = new VBox(); cboSearchFilter.Active = 0; filterVBox.BorderWidth = 0; filterVBox.PackStart(lblSearchFilter, false, false, 0); filterVBox.PackStart(cboSearchFilter, true, false, 0); searchBox.PackStart(filterVBox, true, false, 0); // search text VBox textVBox = new VBox(); cboSearchText.Active = 0; textVBox.BorderWidth = 0; textVBox.PackStart(lblSearchText, false, false, 0); textVBox.PackStart(cboSearchText, true, false, 0); searchBox.PackStart(textVBox, true, false, 0); // Search/Cancel buttons searchBox.PackStart(CreateButtons(), false, false, 0); // Search Options chkRegularExpressions = new CheckButton("Regular Expressions"); chkCaseSensitive = new CheckButton("Case Sensitive"); chkWholeWord = new CheckButton("Whole Word"); chkRecurse = new CheckButton("Recurse"); chkFileNamesOnly = new CheckButton("Show File Names Only"); chkFileNamesOnly.Clicked += new EventHandler(chkFileNamesOnly_Clicked); chkNegation = new CheckButton("Negation"); chkNegation.Clicked += new EventHandler(chkNegation_Clicked); chkLineNumbers = new CheckButton("Line Numbers"); cboContextLines = ComboBox.NewText(); cboContextLines.WidthRequest = 100; cboContextLines.WrapWidth = 3; for (int i = 0; i <= Constants.MAX_CONTEXT_LINES; i++) cboContextLines.AppendText(i.ToString()); lblContextLines = new Label("Context Lines"); HBox cxtBox = new HBox(); cxtBox.BorderWidth = 0; cxtBox.PackStart(cboContextLines, false, false, 3); cxtBox.PackStart(lblContextLines, false, false, 3); searchOptionsBox.PackStart(chkRegularExpressions, true, false, 0); searchOptionsBox.PackStart(chkCaseSensitive, true, false, 0); searchOptionsBox.PackStart(chkWholeWord, true, false, 0); searchOptionsBox.PackStart(chkRecurse, true, false, 0); searchOptionsBox.PackStart(chkFileNamesOnly, true, false, 0); searchOptionsBox.PackStart(chkNegation, true, false, 0); searchOptionsBox.PackStart(chkLineNumbers, true, false, 0); searchOptionsBox.PackStart(cxtBox, true, false, 0); searchBox.PackEnd(searchOptionsBox, true, true, 0); leftFrame.Add(searchBox); panelLeft = new HPaned(); panelLeft.BorderWidth = 0; panelRight = new VPaned(); panelRight.BorderWidth = 0; // File List Gtk.Frame treeFrame = new Gtk.Frame(); treeFrame.Shadow = ShadowType.In; Gtk.ScrolledWindow treeWin = new Gtk.ScrolledWindow(); tvFiles = new Gtk.TreeView (); SetColumnsText(); tvFiles.Model = new ListStore(typeof (string), typeof (string), typeof (string), typeof (string), typeof (int)); (tvFiles.Model as ListStore).DefaultSortFunc = new TreeIterCompareFunc(DefaultTreeIterCompareFunc); tvFiles.Selection.Changed += new EventHandler(Tree_OnSelectionChanged); tvFiles.RowActivated += new RowActivatedHandler(tvFiles_RowActivated); tvFiles.RulesHint = true; tvFiles.HeadersClickable = true; tvFiles.HeadersVisible = true; tvFiles.Selection.Mode = SelectionMode.Multiple; SetSortingFunctions(); treeWin.Add(tvFiles); treeFrame.BorderWidth = 0; treeFrame.Add(treeWin); // txtHits Gtk.Frame ScrolledWindowFrm = new Gtk.Frame(); ScrolledWindowFrm.Shadow = ShadowType.In; Gtk.ScrolledWindow TxtViewWin = new Gtk.ScrolledWindow(); txtViewer = new Gtk.TextView(); txtViewer.Buffer.Text = ""; txtViewer.Editable = false; TxtViewWin.Add(txtViewer); ScrolledWindowFrm.BorderWidth = 0; ScrolledWindowFrm.Add(TxtViewWin); // Add file list and txtHits to right panel panelRight.Pack1(treeFrame, true, true); panelRight.Pack2(ScrolledWindowFrm, true, true); // TLW //Notebook notebook = new Notebook(); // Table table = new Table(3, 6); // Create a new notebook, place the position of the tabs // table.attach(notebook, 0, 6, 0, 1); // Status Bar sbStatus = new Statusbar(); #region Menu bar agMenuAccel = new AccelGroup(); this.AddAccelGroup(agMenuAccel); mbMain = new Gtk.MenuBar(); // File menu mnuFile = new Menu(); MenuItem mnuFileItem = new MenuItem("_File"); mnuFileItem.Submenu = mnuFile; mnuFile.AccelGroup = agMenuAccel; mnuFile.Shown += new EventHandler(mnuFile_Shown); // Edit menu mnuEdit = new Menu(); MenuItem mnuEditItem = new MenuItem("_Edit"); mnuEditItem.Submenu = mnuEdit; mnuEdit.AccelGroup = agMenuAccel; mnuEdit.Shown += new EventHandler(mnuEdit_Shown); // Tools menu mnuTools = new Menu(); MenuItem mnuToolsItem = new MenuItem("_Tools"); mnuToolsItem.Submenu = mnuTools; mnuTools.AccelGroup = agMenuAccel; // Help menu mnuHelp = new Menu(); MenuItem mnuHelpItem = new MenuItem("_Help"); mnuHelpItem.Submenu = mnuHelp; mnuHelp.AccelGroup = agMenuAccel; // File Save menu item SaveMenuItem = new ImageMenuItem(Stock.Save, agMenuAccel); SaveMenuItem.Activated += new EventHandler(SaveMenuItem_Activated); mnuFile.Append(SaveMenuItem); // File Print menu item PrintMenuItem = new ImageMenuItem(Stock.Print, agMenuAccel); PrintMenuItem.Activated += new EventHandler(PrintMenuItem_Activated); mnuFile.Append(PrintMenuItem); // File Separator menu item SeparatorMenuItem Separator1MenuItem = new SeparatorMenuItem(); mnuFile.Append(Separator1MenuItem); // File Exit menu item ExitMenuItem = new ImageMenuItem(Stock.Quit, agMenuAccel); ExitMenuItem.Activated += new EventHandler(ExitMenuItem_Activated); mnuFile.Append(ExitMenuItem); // Edit Select All menu item SelectAllMenuItem = new ImageMenuItem("_Select All Files", agMenuAccel); SelectAllMenuItem.Activated += new EventHandler(SelectAllMenuItem_Activated); mnuEdit.Append(SelectAllMenuItem); // Edit Open Selected menu item OpenSelectedMenuItem = new ImageMenuItem("_Open Selected Files", agMenuAccel); OpenSelectedMenuItem.Activated += new EventHandler(OpenSelectedMenuItem_Activated); mnuEdit.Append(OpenSelectedMenuItem); // Create preferences for every other os except windows if (!Common.IsWindows) { Separator1MenuItem = new SeparatorMenuItem(); mnuEdit.Append(Separator1MenuItem); // Preferences Gtk.ImageMenuItem OptionsMenuItem = new ImageMenuItem(Stock.Preferences, agMenuAccel); OptionsMenuItem.Activated += new EventHandler(OptionsMenuItem_Activated); mnuEdit.Append(OptionsMenuItem); } // Clear MRU List Gtk.ImageMenuItem ClearMRUsMenuItem = new ImageMenuItem("_Clear Most Recently Used Lists", agMenuAccel); ClearMRUsMenuItem.Activated += new EventHandler(ClearMRUsMenuItem_Activated); mnuTools.Append(ClearMRUsMenuItem); Separator1MenuItem = new SeparatorMenuItem(); mnuTools.Append(Separator1MenuItem); // Save Search Options Gtk.ImageMenuItem SaveOptionsMenuItem = new ImageMenuItem("_Save Search Options", agMenuAccel); SaveOptionsMenuItem.Activated += new EventHandler(SaveOptionsMenuItem_Activated); mnuTools.Append(SaveOptionsMenuItem); // Create Options menu for windows if (Common.IsWindows) { // Options menu item Gtk.ImageMenuItem OptionsMenuItem = new ImageMenuItem("_Options...", agMenuAccel); OptionsMenuItem.Activated += new EventHandler(OptionsMenuItem_Activated); OptionsMenuItem.Image = new Gtk.Image(Stock.Preferences, IconSize.Menu); mnuTools.Append(OptionsMenuItem); } // Help About menu item MenuItem AboutMenuItem = new ImageMenuItem(Stock.About, agMenuAccel); AboutMenuItem.Activated += new EventHandler(AboutMenuItem_Activated); mnuHelp.Append(AboutMenuItem); // Add the menus to the menubar mbMain.Append(mnuFileItem); mbMain.Append(mnuEditItem); mbMain.Append(mnuToolsItem); mbMain.Append(mnuHelpItem); // Add the menubar to the Menu panel vbox.PackStart(mbMain, false, false, 0); #endregion // add items to container panelLeft.Pack1(leftFrame, true, false); // TLW //panelLeft.Pack2(tabControl, true, false); panelLeft.Pack2(panelRight, true, false); // set starting position of splitter panelLeft.Position = Core.GeneralSettings.WindowSearchPanelWidth; panelRight.Position = Core.GeneralSettings.WindowFilePanelHeight; vbox.PackStart(panelLeft, true, true, 0); vbox.PackEnd(sbStatus, false, true, 3); this.Add (vbox); this.ShowAll (); }
public Browser (string basedir, IEnumerable<string> sources, string engine) { #if MACOS try { InitMacAppHandlers(); } catch (Exception ex) { Console.Error.WriteLine ("Installing Mac AppleEvent handlers failed. Skipping.\n" + ex); } #endif this.engine = engine; ui = new Glade.XML (null, "browser.glade", "window1", null); ui.Autoconnect (this); MainWindow = (Gtk.Window) ui["window1"]; MainWindow.DeleteEvent += new DeleteEventHandler (delete_event_cb); MainWindow.KeyPressEvent += new KeyPressEventHandler (keypress_event_cb); MainWindow.KeyReleaseEvent += new KeyReleaseEventHandler (keyrelease_event_cb); Stream icon = GetResourceImage ("monodoc.png"); if (icon != null) { monodoc_pixbuf = new Gdk.Pixbuf (icon); MainWindow.Icon = monodoc_pixbuf; } //ellipsizing label for the title title_label = new ELabel (""); title_label.Xalign = 0; Pango.FontDescription fd = new Pango.FontDescription (); fd.Weight = Pango.Weight.Bold; title_label.ModifyFont (fd); title_label.Layout.FontDescription = fd; title_label_box.Add (title_label); title_label.Show (); //colour the bar according to the current style bar_style = bar_eb.Style.Copy (); bar_eb.Style = bar_style; MainWindow.StyleSet += new StyleSetHandler (BarStyleSet); BarStyleSet (null, null); help_tree = Driver.LoadTree (basedir, sources); tree_browser = new TreeBrowser (help_tree, reference_tree, this); // Bookmark Manager init; bookmark_manager = new BookmarkManager(this); // // Tab Notebook and first tab // tabs_nb = new Notebook(); //the Notebook that holds tabs tabs_nb.Scrollable = true; tabs_nb.SwitchPage += new SwitchPageHandler(ChangeTab); help_container.Add(tabs_nb); AddTab(); if ((capabilities & Capabilities.Fonts) != 0) { // Add Menu entries for changing the font Menu aux = (Menu) view1.Submenu; MenuItem sep = new SeparatorMenuItem (); sep.Show (); aux.Append (sep); AccelGroup accel = new AccelGroup (); MainWindow.AddAccelGroup (accel); textLarger = new MenuItem ("_Larger text"); textLarger.Activated += new EventHandler (TextLarger); textLarger.Show (); aux.Append (textLarger); AccelKey ak = new AccelKey (Gdk.Key.plus, Gdk.ModifierType.ControlMask, AccelFlags.Visible); textLarger.AddAccelerator ("activate", accel, ak); textSmaller = new MenuItem ("_Smaller text"); textSmaller.Activated += new EventHandler (TextSmaller); textSmaller.Show (); aux.Append (textSmaller); ak = new AccelKey (Gdk.Key.minus, Gdk.ModifierType.ControlMask, AccelFlags.Visible); textSmaller.AddAccelerator ("activate", accel, ak); textNormal = new MenuItem ("_Original size"); textNormal.Activated += new EventHandler (TextNormal); textNormal.Show (); aux.Append (textNormal); ak = new AccelKey (Gdk.Key.Key_0, Gdk.ModifierType.ControlMask, AccelFlags.Visible); textNormal.AddAccelerator ("activate", accel, ak); } // restore the editing setting editing1.Active = SettingsHandler.Settings.EnableEditing; comments1.Active = SettingsHandler.Settings.ShowComments; cut1.Sensitive = false; paste1.Sensitive = false; // // Other bits // search_index = help_tree.GetSearchIndex(); if (search_index == null) { ppanel = new ProgressPanel ("<b>No Search index found</b>", "Generate", RootTree.MakeSearchIndex, CreateSearchPanel); search_vbox.Add (ppanel); search_vbox.Show (); } else { CreateSearchPanel (); } bookList = new ArrayList (); index_browser = IndexBrowser.MakeIndexBrowser (this); MainWindow.ShowAll(); #if MACOS try { InstallMacMainMenu (); ((MenuBar)ui["menubar1"]).Hide (); } catch (Exception ex) { Console.Error.WriteLine ("Installing Mac IGE Main Menu failed. Skipping.\n" + ex); } #endif }
private void CreatePopupMenu() { menu = new Gtk.Menu (); MenuItem itDownload = new MenuItem ("Download"); SeparatorMenuItem itSeparator = new SeparatorMenuItem(); MenuItem itCopy = new MenuItem ("Copy elink to clipboard"); menu.Append (itDownload); menu.Append (itSeparator); menu.Append (itCopy); }
public SeparatorMenuItem AddSeparator() { SeparatorMenuItem item = new SeparatorMenuItem(); Append(item); return(item); }
private void treeviewMultiChronopicContextMenu(MultiChronopic mc) { Menu myMenu = new Menu (); Gtk.MenuItem myItem; /* myItem = new MenuItem ( Catalog.GetString("Play Video") + " " + mc.Type + " (" + mc.PersonName + ")"); if(File.Exists(Util.GetVideoFileName(currentSession.UniqueID, Constants.TestTypes.MULTICHRONOPIC, myTreeViewMultiChronopic.EventSelectedID))) { myItem.Activated += on_video_play_selected_multi_chronopic_clicked; myItem.Sensitive = true; } else myItem.Sensitive = false; myMenu.Attach( myItem, 0, 1, 0, 1 ); */ myItem = new MenuItem ( Catalog.GetString("Edit selected") + " " + mc.Type + " (" + mc.PersonName + ")"); myItem.Activated += on_edit_selected_multi_chronopic_clicked; myMenu.Attach( myItem, 0, 1, 0, 1 ); /* myItem = new MenuItem ( Catalog.GetString("Repair selected") + " " + mc.Type + " (" + mc.PersonName + ")"); myItem.Activated += on_repair_selected_multi_chronopic_clicked; myMenu.Attach( myItem, 0, 1, 2, 3 ); */ Gtk.SeparatorMenuItem mySep = new SeparatorMenuItem(); myMenu.Attach( mySep, 0, 1, 1, 2 ); myItem = new MenuItem ( Catalog.GetString("Delete selected") + " " + mc.Type + " (" + mc.PersonName + ")"); myItem.Activated += on_delete_selected_multi_chronopic_clicked; myMenu.Attach( myItem, 0, 1, 2, 3 ); myMenu.Popup(); myMenu.ShowAll(); }
public void Initalize(MainWindow window, MenuItem treerebuild, PropertiesView propertiesView) { this.window = window; this.propertiesView = propertiesView; menu = new Menu (); addmenu = new Menu(); treeadd = new MenuItem("Add"); treeadd.Submenu = addmenu; treeaddseperator = new SeparatorMenuItem (); treenewitem = new MenuItem ("New Item..."); treenewitem.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) { menu.Popdown(); window.OnNewItemActionActivated(o, args); }; treenewfolder = new MenuItem ("New Folder..."); treenewfolder.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) { menu.Popdown(); window.OnNewFolderActionActivated(o, args); }; treeadditem = new MenuItem ("Existing Item..."); treeadditem.ButtonPressEvent += window.OnAddItemActionActivated; treeaddfolder = new MenuItem ("Existing Folder..."); treeaddfolder.ButtonPressEvent += window.OnAddFolderActionActivated; treerename = new MenuItem ("Rename"); treerename.Activated += window.OnRenameActionActivated; treerenameseparator = new SeparatorMenuItem(); treedelete = new MenuItem ("Delete"); treedelete.Activated += window.OnDeleteActionActivated; treeopenfile = new MenuItem ("Open"); treeopenfile.Activated += delegate { List<TreeIter> iters; List<string> ids; GetSelectedTreePath(out iters, out ids); if (ids.Count != 1) return; string start = openedProject; if(ids[0] != ID_BASE) start = window._controller.GetFullPath(GetPathFromIter(iters[0])); #if LINUX Process.Start("mimeopen", "-n " + start); #else Process.Start(start); #endif }; treeopenfilelocation = new MenuItem ("Open Item Directory"); treeopenfilelocation.Activated += delegate { List<TreeIter> iters; List<string> ids; GetSelectedTreePath(out iters, out ids); if(ids[0] != ID_BASE) Process.Start(System.IO.Path.GetDirectoryName(window._controller.GetFullPath(GetPathFromIter(iters[0])))); else Process.Start(System.IO.Path.GetDirectoryName(window._controller.GetFullPath(""))); }; addmenu.Add (treenewitem); addmenu.Add (treenewfolder); addmenu.Add (new SeparatorMenuItem ()); addmenu.Add (treeadditem); addmenu.Add (treeaddfolder); menu.Add (treeopenfile); menu.Add (treeadd); menu.Add (treeaddseperator); menu.Add (treeopenfilelocation); menu.Add (treerebuild); menu.Add (new SeparatorMenuItem ()); menu.Add (treerename); menu.Add (treerenameseparator); menu.Add (treedelete); }