public CheckMenuItem AddCheckItem(string label, EventHandler handler) { CheckMenuItem item = new CheckMenuItem(label); item.Activated += handler; Append(item); return(item); }
public TrackListHeaderMenuController(BaseTrackListViewController trackListViewController) { var visibleColumns = trackListViewController.GetColumnTrackProperties().ToHashSet(); Menu headerMenu = new Menu(); foreach (TrackProperty trackProperty in Enum.GetValues(typeof(TrackProperty))) { var trackPropertyMenuItem = new CheckMenuItem(Extensions.GetEnumDescription(trackProperty)); if (visibleColumns.Contains(trackProperty)) trackPropertyMenuItem.Active = true; TrackProperty property = trackProperty; trackPropertyMenuItem.Toggled += (sender, args) => { if (trackPropertyMenuItem.Active) trackListViewController.InsertColumn(property, ClickedProperty); else trackListViewController.RemoveColumn(property); }; headerMenu.Append(trackPropertyMenuItem); } View = headerMenu; View.ShowAll(); }
void ShowPopup(Gdk.EventButton evnt) { Gtk.TreeIter iter; if (!Selection.GetSelected(out iter)) { return; } var menu = new Gtk.Menu(); var newKey = new Gtk.MenuItem(GettextCatalog.GetString("New key")); newKey.Activated += widget.AddElement; menu.Append(newKey); if (widget.treeStore.GetValue(iter, 1) != null) { var removeKey = new Gtk.MenuItem(GettextCatalog.GetString("Remove key")); menu.Append(removeKey); removeKey.Activated += widget.RemoveElement; } if (widget.Scheme != PListScheme.Empty) { menu.Append(new Gtk.SeparatorMenuItem()); var showDescItem = new Gtk.CheckMenuItem(GettextCatalog.GetString("Show descriptions")); showDescItem.Active = widget.ShowDescriptions; showDescItem.Activated += delegate { widget.ShowDescriptions = !widget.ShowDescriptions; }; menu.Append(showDescItem); } menu.ShowAll(); IdeApp.CommandService.ShowContextMenu(this, evnt, menu, this); }
public AppWindowInfo (Window appWindow, MenuItem app, MenuItem window, CheckMenuItem fullscreen, CheckMenuItem maximize) { this.app_window = appWindow; this.app = app; this.window = window; this.fullscreen = fullscreen; this.maximize = maximize; }
public MainWindow() : base("Katahdin Debugger") { SetDefaultSize(500, 400); try { PathResolver pathResolver = new PathResolver(); SetIconFromFile(pathResolver.Resolve("katahdin.svg")); } catch { } Destroyed += delegate { if (runtimeThread != null) runtimeThread.Shutdown(); }; VBox vertical = new VBox(); Add(vertical); MenuBuilder menuBuilder = new MenuBuilder(); MenuBar menuBar = menuBuilder.StartMenuBar(); vertical.PackStart(menuBar, false, false, 0); menuBuilder.StartMenu("Debug"); debugRun = menuBuilder.Add("Run", OnDebugRun); menuBuilder.End(); menuBuilder.StartMenu("View"); viewGrammar = menuBuilder.AddCheck("Grammar", OnViewGrammarToggled); viewParseTrace = menuBuilder.AddCheck("Parse Trace", OnViewParseTraceToggled); viewParseTree = menuBuilder.AddCheck("Parse Tree", OnViewParseTreeToggled); menuBuilder.Separate(); menuBuilder.Add("View runtime object", OnViewRuntimeModule); menuBuilder.End(); menuBuilder.End(); console = new ConsoleWidget(); vertical.PackStart(console, true, true, 0); vertical.PackStart(new HSeparator(), false, false, 0); HBox statusBar = new HBox(); vertical.PackStart(statusBar, false, false, 1); progress = new ProgressBar(); statusBar.PackStart(progress, false, false, 1); statusLabel = new Label(); statusLabel.SetAlignment(0, (float) 0.5); statusLabel.LineWrap = true; statusBar.PackStart(statusLabel, true, true, 0); }
// creates the main menu bar public MainMenu(FuseApp fuse) : base(false, 0) { this.fuse = fuse; // the actual top menu MenuItem file_item = new MenuItem ("File"); MenuItem options_item = new MenuItem ("Options"); MenuItem help_item = new MenuItem ("Help"); bar.Append (file_item); bar.Append (options_item); bar.Append (help_item); this.PackStart (bar, true, true, 0); file_item.Submenu = file_menu; options_item.Submenu = options_menu; help_item.Submenu = help_menu; // the top menu's children such as quit and about ImageMenuItem quit_item = new ImageMenuItem (Stock.Quit, null); ImageMenuItem plugins_item = new ImageMenuItem ("Plugins"); ImageMenuItem engine_item = new ImageMenuItem ("Media Engines"); shuffle_item = new CheckMenuItem ("Shuffle"); crossfade_item = new CheckMenuItem ("Crossfade"); ImageMenuItem about_item = new ImageMenuItem (Stock.About, null); // change menu item properties plugins_item.Image = new Image (Stock.Connect, IconSize.Menu); engine_item.Image = new Image (Stock.Connect, IconSize.Menu); // add menu items file_menu.Append (quit_item); options_menu.Append (plugins_item); options_menu.Append (engine_item); options_menu.Append (new Gtk.SeparatorMenuItem ()); options_menu.Append (shuffle_item); options_menu.Append (crossfade_item); help_menu.Append (about_item); // event handling for the menu items plugins_item.Activated += plugins_item_activated; engine_item.Activated += engine_item_activated; shuffle_item.Toggled += shuffle_item_activated; crossfade_item.Toggled += crossfade_item_activated; about_item.Activated += about_item_activated; }
public CheckMenuItem AddCheck(string label, EventHandler toggled) { CheckMenuItem item = new CheckMenuItem(label); item.Toggled += toggled; if (stack.Count > 0) { MenuShell parent = stack.Peek(); parent.Append(item); } return item; }
public static Gtk.MenuItem MakeCheckMenuItem(Gtk.Menu menu, string label, EventHandler e, bool enabled, bool active, bool as_radio) { Gtk.CheckMenuItem i = new Gtk.CheckMenuItem(label); i.Activated += e; i.Sensitive = enabled; i.DrawAsRadio = as_radio; i.Active = active; menu.Append(i); i.Show(); return(i); }
Menu MakeMenu(IEnumerable<string> defs) { Menu tmp = new Menu(); /*tmp.Append(new MenuItem("Toggle language")); tmp.Append(new SeparatorMenuItem());*/ foreach (string langDef in defs) { CheckMenuItem cmi = new CheckMenuItem (langDef); cmi.Active = languageRepresentation.IsToggled (langDef); cmi.Activated += delegate { languageRepresentation.ToggleLangage(langDef); }; tmp.Append(cmi); } return tmp; }
// create the context menu public FeedContextMenu(Feed feed, MainPage page) : base() { this.feed = feed; this.page = page; ImageMenuItem refresh_feed = new ImageMenuItem (Stock.Refresh, null); ImageMenuItem remove_feed = new ImageMenuItem (Stock.Remove, null); CheckMenuItem autorefresh = new CheckMenuItem ("Auto-Refresh"); this.Add (refresh_feed); this.Add (autorefresh); this.Add (new SeparatorMenuItem ()); this.Add (remove_feed); autorefresh.Active = feed.AutoRefresh; refresh_feed.Activated += refresh_activated; remove_feed.Activated += remove_activated; autorefresh.Toggled += autorefresh_toggled; }
void HandleSearchEntryhandleRequestMenu (object sender, EventArgs e) { if (searchEntry.Menu != null) searchEntry.Menu.Destroy (); searchEntry.Menu = new Menu (); CheckMenuItem caseSensitive = new CheckMenuItem (GettextCatalog.GetString ("_Case sensitive")); caseSensitive.Active = IsCaseSensitive; caseSensitive.DrawAsRadio = false; caseSensitive.Toggled += delegate { SetIsCaseSensitive (caseSensitive.Active); UpdateSearchEntry (); }; searchEntry.Menu.Add (caseSensitive); CheckMenuItem wholeWordsOnly = new CheckMenuItem (GettextCatalog.GetString ("_Whole words only")); wholeWordsOnly.Active = IsWholeWordOnly; wholeWordsOnly.DrawAsRadio = false; wholeWordsOnly.Toggled += delegate { SetIsWholeWordOnly (wholeWordsOnly.Active); UpdateSearchEntry (); }; searchEntry.Menu.Add (wholeWordsOnly); CheckMenuItem regexSearch = new CheckMenuItem (GettextCatalog.GetString ("_Regex search")); regexSearch.Active = SearchEngine == RegexSearchEngine; regexSearch.DrawAsRadio = false; regexSearch.Toggled += delegate { SetIsRegexSearch (regexSearch.Active); UpdateSearchEntry (); }; searchEntry.Menu.Add (regexSearch); CheckMenuItem inselectionSearch = new CheckMenuItem (GettextCatalog.GetString ("_Search In Selection")); inselectionSearch.Active = IsInSelectionSearchMode; inselectionSearch.DrawAsRadio = false; inselectionSearch.Toggled += delegate { IsInSelectionSearchMode = inselectionSearch.Active; UpdateSearchEntry (); }; searchEntry.Menu.Add (inselectionSearch); List<string> history = GetHistory (seachHistoryProperty); if (history.Count > 0) { searchEntry.Menu.Add (new SeparatorMenuItem ()); MenuItem recentSearches = new MenuItem (GettextCatalog.GetString ("Recent Searches")); recentSearches.Sensitive = false; searchEntry.Menu.Add (recentSearches); foreach (string item in history) { if (item == searchEntry.Entry.Text) continue; MenuItem recentItem = new MenuItem (item); recentItem.Name = item; recentItem.Activated += delegate (object mySender, EventArgs myE) { MenuItem cur = (MenuItem)mySender; searchPattern = ""; // force that the current pattern is stored in history and not replaced searchEntry.Entry.Text = cur.Name; FilterHistory (seachHistoryProperty); }; searchEntry.Menu.Add (recentItem); } searchEntry.Menu.Add (new SeparatorMenuItem ()); MenuItem clearRecentSearches = new MenuItem (GettextCatalog.GetString ("Clear Recent Searches")); clearRecentSearches.Activated += delegate { StoreHistory (seachHistoryProperty, null); }; searchEntry.Menu.Add (clearRecentSearches); } }
public Menu CreateOptionsMenu () { Menu menu = new Menu (); MenuItem searchInMenu = new MenuItem (GettextCatalog.GetString ("_Search in")); Menu sub = new Menu (); searchInMenu.Submenu = sub; Gtk.RadioMenuItem original = null, translated = null, both = null; GLib.SList group = new GLib.SList (IntPtr.Zero); original = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Original")); group = original.Group; original.ButtonPressEvent += delegate { original.Activate (); }; sub.Append (original); translated = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Translated")); translated.ButtonPressEvent += delegate { translated.Activate (); }; group = translated.Group; sub.Append (translated); both = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Both")); both.ButtonPressEvent += delegate { both.Activate (); }; sub.Append (both); switch (DoSearchIn) { case SearchIn.Both: both.Activate (); break; case SearchIn.Original: original.Activate (); break; case SearchIn.Translated: translated.Activate (); break; } menu.Append (searchInMenu); both.Activated += delegate { if (DoSearchIn != SearchIn.Both) { DoSearchIn = SearchIn.Both; UpdateFromCatalog (); menu.Destroy (); } }; original.Activated += delegate { if (DoSearchIn != SearchIn.Original) { DoSearchIn = SearchIn.Original; UpdateFromCatalog (); menu.Destroy (); } }; translated.Activated += delegate { if (DoSearchIn != SearchIn.Translated) { DoSearchIn = SearchIn.Translated; UpdateFromCatalog (); menu.Destroy (); } }; Gtk.CheckMenuItem regexSearch = new Gtk.CheckMenuItem (MonoDevelop.Core.GettextCatalog.GetString ("_Regex search")); regexSearch.Active = RegexSearch; regexSearch.ButtonPressEvent += delegate { RegexSearch = !RegexSearch; UpdateFromCatalog (); }; menu.Append (regexSearch); Gtk.CheckMenuItem caseSensitive = new Gtk.CheckMenuItem (MonoDevelop.Core.GettextCatalog.GetString ("_Case sensitive")); caseSensitive.Active = IsCaseSensitive; caseSensitive.ButtonPressEvent += delegate { IsCaseSensitive = !IsCaseSensitive; UpdateFromCatalog (); }; menu.Append (caseSensitive); Gtk.CheckMenuItem wholeWordsOnly = new Gtk.CheckMenuItem (MonoDevelop.Core.GettextCatalog.GetString ("_Whole words only")); wholeWordsOnly.Active = IsWholeWordOnly; wholeWordsOnly.Sensitive = !RegexSearch; wholeWordsOnly.ButtonPressEvent += delegate { IsWholeWordOnly = !IsWholeWordOnly; UpdateFromCatalog (); }; menu.Append (wholeWordsOnly); menu.ShowAll (); return menu; }
private void CreateMenu_simple(object o, Gtk.PopulatePopupArgs e) { try { Gtk.SeparatorMenuItem separator1 = new Gtk.SeparatorMenuItem(); separator1.Show(); e.Menu.Append(separator1); Gtk.Menu m0 = new Gtk.Menu(); Gtk.MenuItem m1 = new Gtk.MenuItem("Transparency"); m1.Submenu = m0; m1.Show(); e.Menu.Append(m1); Gtk.MenuItem m2 = new Gtk.MenuItem("0%"); m2.Activated += new EventHandler(toolStripMenuItem6_Click); Gtk.MenuItem m3 = new Gtk.MenuItem("20%"); m3.Activated += new EventHandler(toolStripMenuItem5_Click); Gtk.MenuItem m4 = new Gtk.MenuItem("40%"); m4.Activated += new EventHandler(toolStripMenuItem4_Click); Gtk.MenuItem m6 = new Gtk.MenuItem("80%"); m6.Activated += new EventHandler(toolStripMenuItem2_Click); Gtk.MenuItem m5 = new Gtk.MenuItem("60%"); m5.Activated += new EventHandler(toolStripMenuItem3_Click); Gtk.CheckMenuItem ma = new Gtk.CheckMenuItem("On top"); ma.Active = OnTop; ma.Activated += new EventHandler(mx_Click); m0.Append(m2); m0.Append(m3); m0.Append(m4); m0.Append(m5); m0.Append(m6); m2.Show(); m3.Show(); m4.Show(); m5.Show(); m6.Show(); ma.Show(); e.Menu.Append(m1); e.Menu.Append(ma); } catch (Exception fail) { Core.handleException(fail); } }
MenuBar CreateMenuBar() { MenuBar mb = new MenuBar(); AccelGroup agrp = new AccelGroup(); AddAccelGroup(agrp); Menu fileMenu = new Menu(); MenuItem item = new MenuItem("_File"); item.Submenu = fileMenu; mb.Append(item); item = new ImageMenuItem(Stock.Quit, agrp); item.Activated += OnMenuQuit; fileMenu.Append(item); Menu viewMenu = new Menu(); item = new MenuItem("_View"); item.Submenu = viewMenu; mb.Append(item); item = new ImageMenuItem(Stock.ZoomIn, agrp); item.Activated += OnZoomIn; viewMenu.Append(item); item = new ImageMenuItem(Stock.ZoomOut, agrp); item.Activated += OnZoomOut; viewMenu.Append(item); item = new ImageMenuItem(Stock.Refresh, agrp); item.Activated += OnReload; viewMenu.Append(item); CheckMenuItem cmi = new CheckMenuItem("_Automatic reload"); cmi.Active = true; cmi.Toggled += OnToggleAuto; viewMenu.Append(cmi); return mb; }
private MenuBar BuildMenuBar() { MenuBar mb = new MenuBar (); Menu file_menu = new Menu (); MenuItem new_item = new MenuItem("New Window"); MenuItem open_item = new MenuItem("Open"); MenuItem save_item = new MenuItem("Save"); MenuItem save_as_item = new MenuItem("Save As"); MenuItem exit_item = new MenuItem("Exit"); new_item.Activated += new EventHandler (OnNew); open_item.Activated += new EventHandler (OnOpen); save_item.Activated += new EventHandler (OnSave); save_as_item.Activated += new EventHandler (OnSaveAs); exit_item.Activated += new EventHandler (OnExit); file_menu.Append (new_item); file_menu.Append (new MenuItem()); file_menu.Append (open_item); file_menu.Append (save_item); file_menu.Append (save_as_item); file_menu.Append (new MenuItem()); file_menu.Append (exit_item); Menu view_menu = new Menu(); CheckMenuItem lines_item = new CheckMenuItem("Line numbers"); CheckMenuItem eol_item = new CheckMenuItem("EOL marker"); CheckMenuItem tab_item = new CheckMenuItem("Tab marker"); CheckMenuItem ruler_item = new CheckMenuItem("Vertical ruler"); CheckMenuItem invalid_item = new CheckMenuItem("Invalid lines"); lines_item.Active = textEditor.ShowLineNumbers; eol_item.Active = textEditor.ShowEOLMarkers; tab_item.Active = textEditor.ShowTabs; ruler_item.Active = textEditor.ShowVRuler; invalid_item.Active = textEditor.ShowInvalidLines; lines_item.Toggled += new EventHandler (OnLineNumbersToggled); eol_item.Toggled += new EventHandler (OnEOLToggled); tab_item.Toggled += new EventHandler (OnTabToggled); ruler_item.Toggled += new EventHandler (OnRulerToggled); invalid_item.Toggled += new EventHandler (OnInvalidToggled); view_menu.Append(lines_item); view_menu.Append(invalid_item); view_menu.Append(tab_item); view_menu.Append(eol_item); view_menu.Append(ruler_item); Menu tools_menu = new Menu(); MenuItem font_item = new MenuItem("Font"); font_item.Activated += new EventHandler(OnFont); tools_menu.Append(font_item); MenuItem file_item = new MenuItem("File"); file_item.Submenu = file_menu; MenuItem view_item = new MenuItem("View"); view_item.Submenu = view_menu; MenuItem tools_item = new MenuItem("Tools"); tools_item.Submenu = tools_menu; mb.Append (file_item); mb.Append (view_item); mb.Append (tools_item); return mb; }
private Menu BuildSortMenu (Source source) { Menu menu = new Menu (); GLib.SList group = null; foreach (SourceSortType sort_type in source.ChildSortTypes) { RadioMenuItem item = new RadioMenuItem (group, sort_type.Label); group = item.Group; item.Active = (sort_type == source.ActiveChildSort); item.Toggled += BuildSortChangedHandler (source, sort_type); menu.Append (item); } menu.Append (new SeparatorMenuItem ()); CheckMenuItem sort_types_item = new CheckMenuItem (Catalog.GetString ("Separate by Type")); sort_types_item.Active = source.SeparateChildrenByType; sort_types_item.Toggled += OnSeparateTypesChanged; menu.Append (sort_types_item); return menu; }
void ShowPopup (Gdk.EventButton evnt) { Gtk.TreeIter iter; bool hasSelection = Selection.GetSelected (out iter); PObject obj = null; if (hasSelection) { obj = (PObject)widget.treeStore.GetValue (iter, 1); } else { return; } var menu = new Gtk.Menu (); var newKey = new Gtk.MenuItem (GettextCatalog.GetString ("New key")); menu.Append (newKey); newKey.Activated += delegate(object sender, EventArgs e) { var newObj = new PString (""); PObject parent; if (obj != null) { parent = obj.Parent; } else { Gtk.TreeIter parentIter; if (widget.treeStore.IterParent (out parentIter, iter)) parent = (PObject)widget.treeStore.GetValue (parentIter, 1); else parent = widget.nsDictionary; } if (parent is PArray) { var arr = (PArray)parent; arr.Add (newObj); return; } var dict = parent as PDictionary; if (dict == null) return; string name = "newNode"; while (dict.ContainsKey (name)) name += "_"; dict[name] = newObj; }; if (hasSelection && obj != null) { var removeKey = new Gtk.MenuItem (GettextCatalog.GetString ("Remove key")); menu.Append (removeKey); removeKey.Activated += delegate(object sender, EventArgs e) { //the change event handler removes it from the store obj.Remove (); }; } if (widget.scheme != null) { menu.Append (new Gtk.SeparatorMenuItem ()); var showDescItem = new Gtk.CheckMenuItem (GettextCatalog.GetString ("Show descriptions")); showDescItem.Active = widget.ShowDescriptions; showDescItem.Activated += delegate { widget.ShowDescriptions = !widget.ShowDescriptions; }; menu.Append (showDescItem); } menu.ShowAll (); IdeApp.CommandService.ShowContextMenu (this, evnt, menu, this); }
public static Gtk.MenuItem MakeCheckMenuItem (Gtk.Menu menu, string label, EventHandler e, bool enabled, bool active, bool as_radio) { Gtk.CheckMenuItem i = new Gtk.CheckMenuItem (label); i.Activated += e; i.Sensitive = enabled; i.DrawAsRadio = as_radio; i.Active = active; menu.Append(i); i.Show (); return i; }
private MenuBar CreateNormalMenu() { MenuBar menubar = new MenuBar (); AccelGroup agrp = new AccelGroup(); this.AddAccelGroup(agrp); Menu iFolderMenu = new Menu(); NewMenuItem = new ImageMenuItem (Util.GS("_Upload a folder...")); NewMenuItem.Image = new Image( new Gdk.Pixbuf(Util.ImagesPath("ifolder24.png"))); iFolderMenu.Append(NewMenuItem); NewMenuItem.AddAccelerator("activate", agrp, new AccelKey(Gdk.Key.N, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); NewMenuItem.Activated += new EventHandler(AddiFolderHandler); DownloadMenuItem = new MenuItem (Util.GS("_Download...")); iFolderMenu.Append(DownloadMenuItem); DownloadMenuItem.Activated += new EventHandler(DownloadAvailableiFolderHandler); DeleteMenuItem = new ImageMenuItem (Util.GS("Dele_te from server")); DeleteMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu); iFolderMenu.Append(DeleteMenuItem); DeleteMenuItem.Activated += new EventHandler(DeleteFromServerHandler); RemoveMenuItem = new ImageMenuItem (Util.GS("Re_move my membership")); RemoveMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu); iFolderMenu.Append(RemoveMenuItem); RemoveMenuItem.Activated += new EventHandler(RemoveMembershipHandler); iFolderMenu.Append(new SeparatorMenuItem()); OpenMenuItem = new ImageMenuItem ( Stock.Open, agrp ); iFolderMenu.Append(OpenMenuItem); OpenMenuItem.Activated += new EventHandler(OnOpenSynchronizedFolder); ShareMenuItem = new MenuItem (Util.GS("Share _with...")); iFolderMenu.Append(ShareMenuItem); ShareMenuItem.Activated += new EventHandler(OnShareSynchronizedFolder); ConflictMenuItem = new MenuItem (Util.GS("Resolve conflic_ts")); iFolderMenu.Append(ConflictMenuItem); ConflictMenuItem.Activated += new EventHandler(OnResolveConflicts); SyncNowMenuItem = new MenuItem(Util.GS("S_ynchronize now")); iFolderMenu.Append(SyncNowMenuItem); SyncNowMenuItem.Activated += new EventHandler(OnSynchronizeNow); RevertMenuItem = new ImageMenuItem (Util.GS("C_hange to a normal folder")); RevertMenuItem.Image = new Image(Stock.Undo, Gtk.IconSize.Menu); iFolderMenu.Append(RevertMenuItem); RevertMenuItem.Activated += new EventHandler(RemoveiFolderHandler); PropMenuItem = new ImageMenuItem (Stock.Properties, agrp); iFolderMenu.Append(PropMenuItem); PropMenuItem.Activated += new EventHandler(OnShowFolderProperties); iFolderMenu.Append(new SeparatorMenuItem()); CloseMenuItem = new ImageMenuItem (Stock.Close, agrp); iFolderMenu.Append(CloseMenuItem); CloseMenuItem.Activated += new EventHandler(CloseEventHandler); QuitMenuItem = new ImageMenuItem(Stock.Quit, agrp); iFolderMenu.Append(QuitMenuItem); QuitMenuItem.Activated += new EventHandler(QuitEventHandler); MenuItem iFolderMenuItem = new MenuItem(Util.GS("i_Folder")); iFolderMenuItem.Submenu = iFolderMenu; menubar.Append (iFolderMenuItem); Menu EditMenu = new Menu(); AccountsMenuItem = new MenuItem (Util.GS("_Account Settings...")); EditMenu.Append(AccountsMenuItem); AccountsMenuItem.Activated += new EventHandler(AccountsMenuItemHandler); PreferencesMenuItem = new ImageMenuItem(Util.GS("_Preferences")); PreferencesMenuItem.Image = new Image(Stock.Preferences, Gtk.IconSize.Menu); EditMenu.Append(PreferencesMenuItem); PreferencesMenuItem.Activated += new EventHandler(ShowPreferencesHandler); MenuItem EditMenuItem = new MenuItem(Util.GS("_Edit")); EditMenuItem.Submenu = EditMenu; menubar.Append(EditMenuItem); Menu ViewMenu = new Menu(); RefreshMenuItem = new ImageMenuItem(Stock.Refresh, agrp); ViewMenu.Append(RefreshMenuItem); RefreshMenuItem.Activated += new EventHandler(RefreshiFoldersHandler); ViewMenu.Append(new SeparatorMenuItem()); SyncLogMenuItem = new MenuItem (Util.GS("Synchronization _Log")); ViewMenu.Append(SyncLogMenuItem); SyncLogMenuItem.Activated += new EventHandler(SyncLogMenuItemHandler); ViewMenu.Append(new SeparatorMenuItem()); ViewServeriFoldersMenuItem = new CheckMenuItem(Util.GS("View _available iFolders")); ViewMenu.Append(ViewServeriFoldersMenuItem); ViewServeriFoldersMenuItem.Toggled += new EventHandler(OnToggleViewServeriFoldersMenuItem); MenuItem showColorPaletteMenuItem = new MenuItem("Show _Color Palette (FIXME: Remove this before shipping)..."); ViewMenu.Append(showColorPaletteMenuItem); showColorPaletteMenuItem.Activated += ShowColorPalette; MenuItem ViewMenuItem = new MenuItem(Util.GS("_View")); ViewMenuItem.Submenu = ViewMenu; menubar.Append(ViewMenuItem); Menu HelpMenu = new Menu(); HelpMenuItem = new ImageMenuItem(Stock.Help, agrp); HelpMenu.Append(HelpMenuItem); HelpMenuItem.Activated += new EventHandler(OnHelpMenuItem); AboutMenuItem = new ImageMenuItem(Util.GS("A_bout")); AboutMenuItem.Image = new Image(Gnome.Stock.About, Gtk.IconSize.Menu); HelpMenu.Append(AboutMenuItem); AboutMenuItem.Activated += new EventHandler(OnAbout); MenuItem MainHelpMenuItem = new MenuItem(Util.GS("_Help")); MainHelpMenuItem.Submenu = HelpMenu; menubar.Append(MainHelpMenuItem); return menubar; }
/// <summary> /// Add an action (on context menu) on the series grid. /// </summary> /// <param name="menuItemText">The text of the menu item</param> /// <param name="onClick">The event handler to call when menu is selected</param> public void AddContextOption(string menuItemText, System.EventHandler onClick, bool active) { CheckMenuItem item = new CheckMenuItem(menuItemText); item.DrawAsRadio = true; item.Active = active; item.Activated += onClick; Popup.Append(item); Popup.ShowAll(); }
protected void ShowContext() { var selected = Selection.GetSelectedRows(); if (selected.Length < 1) return; Menu context = new Menu(); MenuItem item = new MenuItem("Remove"); item.Activated += (sender, e) => { foreach (var p in selected) { TreeIter iter; if (Messages.GetIter(out iter, p)) { Messages.Remove(ref iter); } } Selection.UnselectAll(); }; context.Add(item); if (selected.Length == 1) { TreeIter iter; Messages.GetIter(out iter, selected[0]); var session = Messages.GetValue(iter, 0) as Session; if (session != null) { item = new MenuItem("Remove All " + session.Name); item.Activated += (sender, e) => { TreeIter delIter; Messages.GetIterFirst(out delIter); while (Messages.IterIsValid(delIter)) { var delSession = Messages.GetValue(delIter, 0) as Session; if (delSession != null && delSession.GetType() == session.GetType() && delSession.Name == session.Name) { Messages.Remove(ref delIter); } else { Messages.IterNext(ref delIter); } } }; context.Add(item); item = new MenuItem("Remove and Filter Out All " + session.Name); item.Activated += (sender, e) => { TreeIter delIter; Messages.GetIterFirst(out delIter); FilterItem filterOut = Main.GetFilter(session); if (filterOut != null) { filterOut.Enabled = false; } Main.RedrawFilters(); while (Messages.IterIsValid(delIter)) { var delSession = Messages.GetValue(delIter, 0) as Session; if (delSession != null && delSession.GetType() == session.GetType() && delSession.Name == session.Name) { Messages.Remove(ref delIter); } else { Messages.IterNext(ref delIter); } } }; context.Add(item); FilterItem filter = Main.GetFilter(session); if (filter != null) { var citem = new CheckMenuItem("Receive " + session.Name); citem.Active = filter.Enabled; citem.Toggled += (sender, e) => { filter.Enabled = !filter.Enabled; Main.RedrawFilters(); }; context.Add(citem); } } } context.Add(new SeparatorMenuItem()); item = new MenuItem("Select All"); item.Activated += (sender, e) => { Selection.SelectAll(); }; context.Add(item); item = new MenuItem("Deselect"); item.Activated += (sender, e) => { Selection.UnselectAll(); }; context.Add(item); context.Add(new SeparatorMenuItem()); item = new MenuItem("Copy"); item.Activated += (sender, e) => { System.Text.StringBuilder sb = new System.Text.StringBuilder(); foreach (var p in selected) { TreeIter iter; if (Messages.GetIter(out iter, p)) { var session = Messages.GetValue(iter, 0) as Session; if (session != null) { sb.AppendLine(string.Join(" | ", session.Columns)); } } Gtk.Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", false)).Text = sb.ToString().TrimEnd(); } }; context.Add(item); item = new MenuItem("Clear"); item.Activated += (sender, e) => { Selection.UnselectAll(); Messages.Clear(); }; context.Add(item); context.ShowAll(); context.Popup(); }
void ShowPopup (Gdk.EventButton evnt) { Gtk.TreeIter iter; if (!Selection.GetSelected (out iter)) return; var menu = new Gtk.Menu (); var newKey = new Gtk.MenuItem (GettextCatalog.GetString ("New key")); newKey.Activated += widget.AddElement; menu.Append (newKey); if (widget.treeStore.GetValue (iter, 1) != null) { var removeKey = new Gtk.MenuItem (GettextCatalog.GetString ("Remove key")); menu.Append (removeKey); removeKey.Activated += widget.RemoveElement; } if (widget.Scheme != PListScheme.Empty) { menu.Append (new Gtk.SeparatorMenuItem ()); var showDescItem = new Gtk.CheckMenuItem (GettextCatalog.GetString ("Show descriptions")); showDescItem.Active = widget.ShowDescriptions; showDescItem.Activated += delegate { widget.ShowDescriptions = !widget.ShowDescriptions; }; menu.Append (showDescItem); } menu.ShowAll (); IdeApp.CommandService.ShowContextMenu (this, evnt, menu, this); }
void ShowPopup(Gdk.EventButton evnt) { Gtk.TreeIter iter; bool hasSelection = Selection.GetSelected(out iter); PObject obj = null; if (hasSelection) { obj = (PObject)widget.treeStore.GetValue(iter, 1); } else { return; } var menu = new Gtk.Menu(); var newKey = new Gtk.MenuItem(GettextCatalog.GetString("New key")); menu.Append(newKey); newKey.Activated += delegate(object sender, EventArgs e) { var newObj = new PString(""); PObject parent; if (obj != null) { parent = obj.Parent; } else { Gtk.TreeIter parentIter; if (widget.treeStore.IterParent(out parentIter, iter)) { parent = (PObject)widget.treeStore.GetValue(parentIter, 1); } else { parent = widget.nsDictionary; } } if (parent is PArray) { var arr = (PArray)parent; arr.Add(newObj); return; } var dict = parent as PDictionary; if (dict == null) { return; } string name = "newNode"; while (dict.ContainsKey(name)) { name += "_"; } dict[name] = newObj; }; if (hasSelection && obj != null) { var removeKey = new Gtk.MenuItem(GettextCatalog.GetString("Remove key")); menu.Append(removeKey); removeKey.Activated += delegate(object sender, EventArgs e) { //the change event handler removes it from the store obj.Remove(); }; } if (widget.scheme != null) { menu.Append(new Gtk.SeparatorMenuItem()); var showDescItem = new Gtk.CheckMenuItem(GettextCatalog.GetString("Show descriptions")); showDescItem.Active = widget.ShowDescriptions; showDescItem.Activated += delegate { widget.ShowDescriptions = !widget.ShowDescriptions; }; menu.Append(showDescItem); } menu.ShowAll(); IdeApp.CommandService.ShowContextMenu(this, evnt, menu, this); }
/// <summary> /// Render a tray menu which is displayed when user click on pidgeon icon in tray only /// </summary> /// <param name="o"></param> /// <param name="args"></param> private void TrayMenu(object o, EventArgs args) { Menu menu = new Menu(); ImageMenuItem menuItemQuit = new ImageMenuItem(messages.Localize("[[common-quit]]")); Gtk.Image appimg = new Gtk.Image(Stock.Quit, IconSize.Menu); CheckMenuItem notifications = new CheckMenuItem(messages.Localize("[[tray-en]]")); menu.Add(notifications); notifications.Active = Configuration.Kernel.Notice; notifications.Activated += new EventHandler(itemNotification); if (!this.Visible) { MenuItem show = new MenuItem("Show"); menu.Add(show); show.Activated += new EventHandler(itemShow); } else { MenuItem hide = new MenuItem("Hide"); hide.Activated += new EventHandler(itemHide); menu.Add(hide); } menu.Add(new Gtk.SeparatorMenuItem()); menuItemQuit.Image = appimg; menu.Add(menuItemQuit); // Quit the application when quit has been clicked. menuItemQuit.Activated += new EventHandler(shutDownToolStripMenuItem_Click); menu.ShowAll(); menu.Popup(); }
// options menu for filterSearchEntry public Menu CreateOptionsMenu() { Menu menu = new Menu (); MenuItem searchInMenu = new MenuItem (GettextCatalog.GetString ("_Search in")); Menu sub = new Menu (); searchInMenu.Submenu = sub; Gtk.RadioMenuItem name = null, baseValue = null, value =null, comment = null, all = null; GLib.SList group = new GLib.SList (IntPtr.Zero); name = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Name")); group = name.Group; name.ButtonPressEvent += delegate { name.Activate (); }; sub.Append (name); baseValue = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Base Value")); baseValue.ButtonPressEvent += delegate { baseValue.Activate (); }; group = baseValue.Group; sub.Append (baseValue); value = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Value")); value.ButtonPressEvent += delegate { value.Activate (); }; group = value.Group; sub.Append (value); comment = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_Comment")); comment.ButtonPressEvent += delegate { comment.Activate (); }; group = comment.Group; sub.Append (comment); all = new Gtk.RadioMenuItem (group, GettextCatalog.GetString ("_All")); all.ButtonPressEvent += delegate { all.Activate (); }; sub.Append (all); switch (DoSearchIn) { case SearchIn.All: all.Activate (); break; case SearchIn.BaseValue: baseValue.Activate (); break; case SearchIn.Value: value.Activate (); break; case SearchIn.Name: name.Activate (); break; case SearchIn.Comment: comment.Activate (); break; } menu.Append (searchInMenu); all.Activated += delegate { if (DoSearchIn != SearchIn.All) { DoSearchIn = SearchIn.All; Refresh (); menu.Destroy (); } }; baseValue.Activated += delegate { if (DoSearchIn != SearchIn.BaseValue) { DoSearchIn = SearchIn.BaseValue; Refresh (); menu.Destroy (); } }; value.Activated += delegate { if (DoSearchIn != SearchIn.Value) { DoSearchIn = SearchIn.Value; Refresh (); menu.Destroy (); } }; name.Activated += delegate { if (DoSearchIn != SearchIn.Name) { DoSearchIn = SearchIn.Name; Refresh (); menu.Destroy (); } }; comment.Activated += delegate { if (DoSearchIn != SearchIn.Comment) { DoSearchIn = SearchIn.Comment; Refresh (); menu.Destroy (); } }; Gtk.CheckMenuItem regexSearch = new Gtk.CheckMenuItem (MonoDevelop.Core.GettextCatalog.GetString ("_Regex search")); regexSearch.Active = RegexSearch; regexSearch.ButtonPressEvent += delegate { RegexSearch = !RegexSearch; Refresh (); }; menu.Append (regexSearch); Gtk.CheckMenuItem caseSensitive = new Gtk.CheckMenuItem (MonoDevelop.Core.GettextCatalog.GetString ("_Case sensitive")); caseSensitive.Active = IsCaseSensitive; caseSensitive.ButtonPressEvent += delegate { IsCaseSensitive = !IsCaseSensitive; Refresh (); }; menu.Append (caseSensitive); Gtk.CheckMenuItem wholeWordsOnly = new Gtk.CheckMenuItem (MonoDevelop.Core.GettextCatalog.GetString ("_Whole words only")); wholeWordsOnly.Active = IsWholeWordOnly; wholeWordsOnly.Sensitive = !RegexSearch; wholeWordsOnly.ButtonPressEvent += delegate { IsWholeWordOnly = !IsWholeWordOnly; Refresh (); }; menu.Append (wholeWordsOnly); menu.ShowAll (); return menu; }
void OnPopulatePopup(object o, PopulatePopupArgs args) { Gtk.MenuItem spacer = new Gtk.SeparatorMenuItem (); spacer.Show (); Gtk.CheckMenuItem edit = new Gtk.CheckMenuItem ( Catalog.GetString ("Edit Code Snippet")); MarkupLabel (edit); edit.Activated += OnEditActivate; edit.Show (); Gtk.ImageMenuItem lang_select = new Gtk.ImageMenuItem ( Catalog.GetString ("Select Language")); lang_select.Image = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Menu); lang_select .Show (); Gtk.Menu langs_menu = new Gtk.Menu (); //default language should be setted Gtk.RadioMenuItem pre_item = new Gtk.RadioMenuItem (Language); MarkupLabel (pre_item); pre_item.Active = true; langs_menu.Append (pre_item); pre_item.Activated += OnLanguageSelected; pre_item.Show (); string [] langs = manager.LanguageIds; ArrayList lang_array = new ArrayList (langs); lang_array.Sort (); foreach (String lang in lang_array) { if (lang.Equals (Language)) continue; Gtk.RadioMenuItem tmp = new Gtk.RadioMenuItem ( pre_item.Group, Catalog.GetString (lang)); MarkupLabel (tmp); langs_menu.Append (tmp); tmp.Activated += OnLanguageSelected; tmp.Show (); pre_item = tmp; } lang_select.Submenu = langs_menu; args.Menu.Prepend (spacer); args.Menu.Prepend (edit); args.Menu.Prepend (lang_select); }
internal void ShowDockPopupMenu (uint time) { Menu menu = new Menu (); // Hide menuitem if ((Behavior & DockItemBehavior.CantClose) == 0) { MenuItem mitem = new MenuItem (Catalog.GetString("Hide")); mitem.Activated += delegate { Visible = false; }; menu.Append (mitem); } CheckMenuItem citem; // Dockable menuitem citem = new CheckMenuItem (Catalog.GetString("Dockable")); citem.Active = Status == DockItemStatus.Dockable; citem.DrawAsRadio = true; citem.Toggled += delegate { Status = DockItemStatus.Dockable; }; menu.Append (citem); // Floating menuitem if ((Behavior & DockItemBehavior.NeverFloating) == 0) { citem = new CheckMenuItem (Catalog.GetString("Floating")); citem.Active = Status == DockItemStatus.Floating; citem.DrawAsRadio = true; citem.Toggled += delegate { Status = DockItemStatus.Floating; }; menu.Append (citem); } // Auto Hide menuitem if ((Behavior & DockItemBehavior.CantAutoHide) == 0) { citem = new CheckMenuItem (Catalog.GetString("Auto Hide")); citem.Active = Status == DockItemStatus.AutoHide; citem.DrawAsRadio = true; citem.Toggled += delegate { Status = DockItemStatus.AutoHide; }; menu.Append (citem); } menu.ShowAll (); menu.Popup (null, null, null, 3, time); }
private void BuildTray() { trayMenu = new Menu (); ImageMenuItem quitItem = new ImageMenuItem (_("Quit")); quitItem.Image = new Image (Stock.Quit, IconSize.Menu); quitItem.Activated += Event.Wrap (delegate(object sender, EventArgs args) { DeleteEventHandler h = OnDeleteEvent; h (sender ,new DeleteEventArgs ()); }); ImageMenuItem stop = new ImageMenuItem (_("Stop All")); stop.Image = new Image (Stock.MediaStop, IconSize.Menu); stop.Activated += Event.Wrap ((EventHandler) delegate { foreach (Download m in torrentController.Torrents) m.Stop (); }); ImageMenuItem start = new ImageMenuItem (_("Start All")); start.Image = new Image (Stock.MediaPlay, IconSize.Menu); start.Activated += Event.Wrap ((EventHandler) delegate { foreach (Download m in torrentController.Torrents) m.Start (); }); CheckMenuItem notifications = new CheckMenuItem (_("Show Notifications")); notifications.Active = Preferences.EnableNotifications; notifications.Activated += Event.Wrap ((EventHandler) delegate { Preferences.EnableNotifications = !Preferences.EnableNotifications; }); trayMenu.Append (start); trayMenu.Append (stop); trayMenu.Append (new SeparatorMenuItem()); trayMenu.Append (notifications); trayMenu.Append (new SeparatorMenuItem()); trayMenu.Append (quitItem); Gdk.Pixbuf image = Stetic.IconLoader.LoadIcon (this, Stock.GoDown, IconSize.SmallToolbar, 16); trayIcon = new Gtk.StatusIcon (image); TrayIcon.Activate += delegate { if (Visible) { int x, y; GetPosition (out x, out y); interfaceSettings.WindowXPos = x; interfaceSettings.WindowYPos = y; } else { Move (interfaceSettings.WindowXPos, interfaceSettings.WindowYPos); } Visible = !Visible; }; TrayIcon.PopupMenu += delegate { trayMenu.ShowAll (); trayMenu.Popup (); }; TrayIcon.Tooltip = Defines.ApplicationName; }
protected virtual void OnTreeviewFriendsButtonPressEvent(object o, Gtk.ButtonPressEventArgs args) { if (args.Event.Button == 3)//F**k this should be a define { Gtk.TreeModel mod; Gtk.TreeIter iter; TreePath[] paths = treeview_friends.Selection.GetSelectedRows(out mod); if (paths.Length == 1) { if (store.GetIter(out iter, paths[0])) { string id = (string)mod.GetValue(iter, 6); UUID lid = (UUID)id; FriendInfo finfo; if (MainClass.client.Friends.FriendList.TryGetValue(lid, out finfo)) { Gtk.CheckMenuItem see_me_online = new Gtk.CheckMenuItem("Can see my online status"); see_me_online.Active = finfo.CanSeeMeOnline; see_me_online.ButtonPressEvent += new ButtonPressEventHandler(OnCheckbuttonOnlinestatusClicked); Gtk.CheckMenuItem see_me_on_map = new Gtk.CheckMenuItem("Can see on the map"); see_me_on_map.Active = finfo.CanSeeMeOnMap; see_me_on_map.ButtonPressEvent += new ButtonPressEventHandler(OnCheckbuttonMapClicked); Gtk.CheckMenuItem modify_mine = new Gtk.CheckMenuItem("Can modify my objects"); modify_mine.Active = finfo.CanModifyMyObjects; modify_mine.ButtonPressEvent += new ButtonPressEventHandler(OnCheckbuttonModobjectsClicked); Gtk.Menu menu = new Gtk.Menu(); menu.Append(see_me_online); menu.Append(see_me_on_map); menu.Append(modify_mine); menu.Popup(); menu.ShowAll(); } } } } }
private void Menu(object sender, Gtk.PopupMenuArgs e) { try { bool display = false; Gtk.Menu menu = new Menu(); if (soundsToolStripMenuItem.Visible) { Gtk.CheckMenuItem sounds = new CheckMenuItem(soundsToolStripMenuItem.Text); if (SelectedWindow != null) { sounds.Active = SelectedWindow.Sounds; } sounds.Sensitive = Configuration.Media.NotificationSound; sounds.Activated += new EventHandler(soundsToolStripMenuItem_Click); display = true; menu.Append(sounds); } if (highlightToolStripMenuItem.Visible) { Gtk.CheckMenuItem notification = new CheckMenuItem(highlightToolStripMenuItem.Text); notification.Sensitive = Configuration.Kernel.Notice; if (SelectedWindow != null) { notification.Active = SelectedWindow.Highlights; } notification.Activated += new EventHandler(notificationToolStripMenuItem_Click); display = true; menu.Append(notification); } if (partToolStripMenuItem.Visible) { Gtk.MenuItem part = new MenuItem(partToolStripMenuItem.Text); part.Sensitive = partToolStripMenuItem.Enabled; part.Activated += new EventHandler(partToolStripMenuItem_Click); display = true; menu.Append(part); } if (closeToolStripMenuItem.Visible) { Gtk.MenuItem close = new MenuItem(closeToolStripMenuItem.Text); close.Activated += new EventHandler(closeToolStripMenuItem_Click); close.Sensitive = closeToolStripMenuItem.Enabled; display = true; menu.Append(close); } if (disconnectToolStripMenuItem.Visible) { Gtk.MenuItem disconnect = new MenuItem(disconnectToolStripMenuItem.Text); disconnect.Activated += new EventHandler(disconnectToolStripMenuItem_Click); disconnect.Sensitive = disconnectToolStripMenuItem.Enabled; display = true; menu.Append(disconnect); } if (joinToolStripMenuItem.Visible) { Gtk.MenuItem join = new MenuItem(joinToolStripMenuItem.Text); join.Activated += new EventHandler(joinToolStripMenuItem_Click); display = true; menu.Append(join); } if (Configuration.Kernel.Debugging) { if (reconnectToolStripMenuItem.Visible) { Gtk.MenuItem reconnect = new MenuItem(reconnectToolStripMenuItem.Text); reconnect.Activated += new EventHandler(reconnectToolStripMenuItem_Click); reconnect.Sensitive = reconnectToolStripMenuItem.Enabled; display = true; menu.Append(reconnect); } } if (display) { menu.ShowAll(); menu.Popup(); } } catch (Exception fail) { Core.handleException(fail); } }
// Creates the menu that is popped up when the // user clicks the statusicon public void CreateMenu() { Menu = new Menu (); // The menu item showing the status and size of the SparkleShare folder StatusMenuItem = new MenuItem (StateText) { Sensitive = false }; Menu.Add (StatusMenuItem); Menu.Add (new SeparatorMenuItem ()); // A menu item that provides a link to the SparkleShare folder Gtk.Action folder_action = new Gtk.Action ("", "SparkleShare") { IconName = "folder-sparkleshare", IsImportant = true }; folder_action.Activated += delegate { Process process = new Process (); process.StartInfo.FileName = "xdg-open"; process.StartInfo.Arguments = SparklePaths.SparklePath; process.Start (); }; Menu.Add (folder_action.CreateMenuItem ()); if (SparkleUI.Repositories.Count > 0) { // Creates a menu item for each repository with a link to their logs foreach (SparkleRepo repo in SparkleUI.Repositories) { folder_action = new Gtk.Action ("", repo.Name) { IconName = "folder", IsImportant = true }; folder_action.Activated += OpenLogDelegate (repo.LocalPath); MenuItem menu_item = (MenuItem) folder_action.CreateMenuItem (); if (repo.Description != null) menu_item.TooltipText = repo.Description; Menu.Add (menu_item); } } else { MenuItem no_folders_item = new MenuItem (_("No Shared Folders Yet")) { Sensitive = false }; Menu.Add (no_folders_item); } // Opens the wizard to add a new remote folder MenuItem add_item = new MenuItem (_("Sync Remote Folder…")); add_item.Activated += delegate { SparkleIntro intro = new SparkleIntro (); // Only show the server form in the wizard intro.ShowServerForm (true); }; Menu.Add (add_item); Menu.Add (new SeparatorMenuItem ()); // A checkbutton to toggle whether or not to show notifications CheckMenuItem notify_item = new CheckMenuItem (_("Show Notifications")); // Whether notifications are shown depends existence of this file string notify_setting_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "sparkleshare.notify"); if (File.Exists (notify_setting_file_path)) notify_item.Active = true; notify_item.Toggled += delegate { if (File.Exists (notify_setting_file_path)) File.Delete (notify_setting_file_path); else File.Create (notify_setting_file_path); }; Menu.Add (notify_item); Menu.Add (new SeparatorMenuItem ()); // A menu item that takes the use to sparkleshare.org MenuItem about_item = new MenuItem (_("Visit Website")); about_item.Activated += delegate { Process process = new Process (); process.StartInfo.FileName = "xdg-open"; process.StartInfo.Arguments = "http://www.sparkleshare.org/"; process.Start (); }; Menu.Add (about_item); Menu.Add (new SeparatorMenuItem ()); // A menu item that quits the application MenuItem quit_item = new MenuItem (_("Quit")); quit_item.Activated += Quit; Menu.Add (quit_item); }
public static Gtk.Window Create() { window = new Window ("Menus"); AccelGroup accel_group = new AccelGroup (); window.AddAccelGroup (accel_group); VBox box1 = new VBox (false, 0); window.Add (box1); MenuBar menubar = new MenuBar (); box1.PackStart (menubar, false, false, 0); Menu menu = Create_Menu (2, true); MenuItem menuitem = new MenuItem ("foo"); menuitem.Submenu = menu; menubar.Append (menuitem); menuitem = new MenuItem ("bar"); menuitem.Submenu = Create_Menu (3, true); menubar.Append (menuitem); Image image = new Image (Stock.Help, IconSize.Menu); menuitem = new ImageMenuItem ("Help"); ((ImageMenuItem) menuitem).Image = image; menuitem.Submenu = Create_Menu (4, true); menuitem.RightJustified = true; menubar.Append (menuitem); menubar = new MenuBar (); box1.PackStart (menubar, false, true, 0); menu = Create_Menu (2, true); menuitem = new MenuItem ("Second menu bar"); menuitem.Submenu = menu; menubar.Append (menuitem); VBox box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, true, true, 0); menu = Create_Menu (1, false); menu.AccelGroup = accel_group; menu.Append (new SeparatorMenuItem ()); menuitem = new CheckMenuItem ("Accelerate Me"); menu.Append (menuitem); menuitem.AddAccelerator ("activate", accel_group, 0xFFBE, 0, AccelFlags.Visible); menuitem = new CheckMenuItem ("Accelerator locked"); menu.Append (menuitem); menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible | AccelFlags.Locked); menuitem = new CheckMenuItem ("Accelerator Frozen"); menu.Append (menuitem); menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible); menuitem.AddAccelerator ("activate", accel_group, 0xFFC0, 0, AccelFlags.Visible); OptionMenu option_menu = new OptionMenu (); option_menu.Menu = menu; option_menu.SetHistory (3); box2.PackStart (option_menu, true, true, 0); box1.PackStart (new HSeparator (), false, false, 0); box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, false, true, 0); Button close_button = new Button (Stock.Close); close_button.Clicked += new EventHandler (Close_Button); box2.PackStart (close_button, true, true, 0); close_button.CanDefault = true; close_button.GrabDefault (); window.ShowAll (); return window; }
private MenuBar CreateNormalMenu() { MenuBar menubar = new MenuBar (); AccelGroup agrp = new AccelGroup(); this.AddAccelGroup(agrp); Menu iFolderMenu = new Menu(); NewMenuItem = new ImageMenuItem (Util.GS("_Upload a Folder...")); NewMenuItem.Image = new Image( new Gdk.Pixbuf(Util.ImagesPath("ifolder-upload16.png"))); iFolderMenu.Append(NewMenuItem); NewMenuItem.AddAccelerator("activate", agrp, new AccelKey(Gdk.Key.N, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); NewMenuItem.Activated += new EventHandler(AddiFolderHandler); DownloadMenuItem = new ImageMenuItem (Util.GS("_Download...")); DownloadMenuItem.Image = new Image( new Gdk.Pixbuf(Util.ImagesPath("ifolder-download16.png"))); MergeMenuItem = new ImageMenuItem( Util.GS("Merge to Folder")); MergeMenuItem.Image = new Image( new Gdk.Pixbuf(Util.ImagesPath("ifolder-download16.png"))); iFolderMenu.Append(DownloadMenuItem); iFolderMenu.Append(MergeMenuItem); DownloadMenuItem.Activated += new EventHandler(DownloadAvailableiFolderHandler); MergeMenuItem.Activated += new EventHandler(MergeAvailableiFolderHandler); DeleteMenuItem = new ImageMenuItem (Util.GS("Dele_te From Server")); DeleteMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu); iFolderMenu.Append(DeleteMenuItem); DeleteMenuItem.Activated += new EventHandler(DeleteFromServerHandler); RemoveMenuItem = new ImageMenuItem (Util.GS("Re_move my membership")); RemoveMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu); iFolderMenu.Append(RemoveMenuItem); RemoveMenuItem.Activated += new EventHandler(RemoveMembershipHandler); iFolderMenu.Append(new SeparatorMenuItem()); OpenMenuItem = new ImageMenuItem ( Stock.Open, agrp ); iFolderMenu.Append(OpenMenuItem); OpenMenuItem.Activated += new EventHandler(OnOpenSynchronizedFolder); ShareMenuItem = new MenuItem (Util.GS("Share _with...")); iFolderMenu.Append(ShareMenuItem); ShareMenuItem.Activated += new EventHandler(OnShareSynchronizedFolder); ConflictMenuItem = new MenuItem (Util.GS("Resolve conflic_ts")); iFolderMenu.Append(ConflictMenuItem); ConflictMenuItem.Activated += new EventHandler(OnResolveConflicts); SyncNowMenuItem = new MenuItem(Util.GS("S_ynchronize now")); iFolderMenu.Append(SyncNowMenuItem); SyncNowMenuItem.Activated += new EventHandler(OnSynchronizeNow); RevertMenuItem = new ImageMenuItem (Util.GS("_Revert to a Normal Folder")); RevertMenuItem.Image = new Image(Stock.Undo, Gtk.IconSize.Menu); iFolderMenu.Append(RevertMenuItem); RevertMenuItem.Activated += new EventHandler(RemoveiFolderHandler); PropMenuItem = new ImageMenuItem (Stock.Properties, agrp); iFolderMenu.Append(PropMenuItem); PropMenuItem.Activated += new EventHandler(OnShowFolderProperties); iFolderMenu.Append(new SeparatorMenuItem()); MigrateMenuItem = new MenuItem(Util.GS("_Migrate iFolder")); Menu MigrateMenu = new Menu(); MigrateMenuSubItem = new MenuItem(Util.GS("Migrate from 2.x")); MigrateMenu.Append(MigrateMenuSubItem); MigrateMenuItem.Submenu = MigrateMenu; iFolderMenu.Append( MigrateMenuItem); MigrateMenuSubItem.Activated += new EventHandler(Migrate2xClickedHandler); iFolderMenu.Append(new SeparatorMenuItem()); CloseMenuItem = new ImageMenuItem (Stock.Close, agrp); iFolderMenu.Append(CloseMenuItem); CloseMenuItem.Activated += new EventHandler(CloseEventHandler); QuitMenuItem = new ImageMenuItem(Stock.Quit, agrp); iFolderMenu.Append(QuitMenuItem); QuitMenuItem.Activated += new EventHandler(QuitEventHandler); MenuItem iFolderMenuItem = new MenuItem(Util.GS("i_Folder")); iFolderMenuItem.Submenu = iFolderMenu; menubar.Append (iFolderMenuItem); Menu EditMenu = new Menu(); AccountsMenuItem = new MenuItem (Util.GS("_Account Settings...")); EditMenu.Append(AccountsMenuItem); AccountsMenuItem.Activated += new EventHandler(AccountsMenuItemHandler); PreferencesMenuItem = new ImageMenuItem(Util.GS("_Preferences")); PreferencesMenuItem.Image = new Image(Stock.Preferences, Gtk.IconSize.Menu); EditMenu.Append(PreferencesMenuItem); PreferencesMenuItem.Activated += new EventHandler(ShowPreferencesHandler); MenuItem EditMenuItem = new MenuItem(Util.GS("_Edit")); EditMenuItem.Submenu = EditMenu; menubar.Append(EditMenuItem); Menu ViewMenu = new Menu(); RefreshMenuItem = new ImageMenuItem(Stock.Refresh, agrp); ViewMenu.Append(RefreshMenuItem); RefreshMenuItem.Activated += new EventHandler(RefreshiFoldersHandler); ViewMenu.Append(new SeparatorMenuItem()); SyncLogMenuItem = new MenuItem (Util.GS("Synchronization _Log")); ViewMenu.Append(SyncLogMenuItem); SyncLogMenuItem.Activated += new EventHandler(SyncLogMenuItemHandler); ViewMenu.Append(new SeparatorMenuItem()); ViewServeriFoldersMenuItem = new CheckMenuItem(Util.GS("View _available iFolders")); ViewMenu.Append(ViewServeriFoldersMenuItem); ViewServeriFoldersMenuItem.Toggled += new EventHandler(OnToggleViewServeriFoldersMenuItem); if((bool)ClientConfig.Get(ClientConfig.KEY_IFOLDER_DEBUG_COLOR_PALETTE)) { MenuItem showColorPaletteMenuItem = new MenuItem("Show _Color Palette (FIXME: Remove this before shipping)..."); ViewMenu.Append(showColorPaletteMenuItem); showColorPaletteMenuItem.Activated += ShowColorPalette; } MenuItem ViewMenuItem = new MenuItem(Util.GS("_View")); ViewMenuItem.Submenu = ViewMenu; menubar.Append(ViewMenuItem); Menu SecurityMenu = new Menu(); RecoveryMenuItem = new MenuItem(Util.GS("_Key Recovery")); SecurityMenu.Append(RecoveryMenuItem); ImportMenuSubItem = new MenuItem(Util.GS("Import Decrypted Keys")); ExportMenuSubItem = new MenuItem(Util.GS("Export Encrypted Keys")); ImportMenuSubItem.Activated += new EventHandler(ImportClicked); ExportMenuSubItem.Activated += new EventHandler(ExportClicked); Menu recoverMenu = new Menu(); recoverMenu.Append( ExportMenuSubItem); recoverMenu.Append( ImportMenuSubItem); RecoveryMenuItem.Submenu = recoverMenu;; ResetPassMenuItem = new MenuItem(Util.GS("Reset _Passphrase")); ResetPassMenuItem.Activated += new EventHandler(OnResetPassMenuItem); SecurityMenu.Append(ResetPassMenuItem); ResetPasswordMenuItem = new MenuItem(Util.GS("Change Password")); ResetPasswordMenuItem.Activated += new EventHandler(OnResetPasswordMenuItem); SecurityMenu.Append(ResetPasswordMenuItem); MenuItem MainSecurityMenuItem = new MenuItem (Util.GS ("_Security")); MainSecurityMenuItem.Submenu = SecurityMenu; menubar.Append (MainSecurityMenuItem); Menu HelpMenu = new Menu(); HelpMenuItem = new ImageMenuItem(Stock.Help, agrp); HelpMenu.Append(HelpMenuItem); HelpMenuItem.Activated += new EventHandler(OnHelpMenuItem); AboutMenuItem = new ImageMenuItem(Util.GS("A_bout")); AboutMenuItem.Image = new Image(Gnome.Stock.About, Gtk.IconSize.Menu); HelpMenu.Append(AboutMenuItem); AboutMenuItem.Activated += new EventHandler(OnAbout); MenuItem MainHelpMenuItem = new MenuItem(Util.GS("_Help")); MainHelpMenuItem.Submenu = HelpMenu; menubar.Append(MainHelpMenuItem); return menubar; }