public void Populate (Category cat, Gtk.Menu parent) { Widget [] dead_pool = parent.Children; for (int i = 0; i < dead_pool.Length; i++) dead_pool [i].Destroy (); foreach (Tag t in cat.Children) { TagMenuItem item = new TagMenuItem (t); parent.Append (item); item.ShowAll (); Category subcat = t as Category; if (subcat != null && subcat.Children.Count != 0) { Gtk.Menu submenu = new Menu (); Populate (t as Category, submenu); Gtk.SeparatorMenuItem sep = new Gtk.SeparatorMenuItem (); submenu.Prepend (sep); sep.ShowAll (); TagMenuItem subitem = new TagMenuItem (t); subitem.Activated += HandleActivate; submenu.Prepend (subitem); subitem.ShowAll (); item.Submenu = submenu; } else { item.Activated += HandleActivate; } } }
protected override void OnPressed() { //base.OnPressed (); Gtk.Menu menu = new Gtk.Menu(); if (menu.Children.Length > 0) { Gtk.SeparatorMenuItem sep = new Gtk.SeparatorMenuItem(); sep.Show(); menu.Insert(sep, -1); } Gtk.RadioMenuItem grp = new Gtk.RadioMenuItem(""); foreach (ComboItem ci in items) { Gtk.RadioMenuItem mi = new Gtk.RadioMenuItem(grp, ci.Label.Replace("_", "__")); if (ci.Item == items.CurrentItem || ci.Item.Equals(items.CurrentItem)) { mi.Active = true; } ComboItemSet isetLocal = items; ComboItem ciLocal = ci; mi.Activated += delegate { SelectItem(isetLocal, ciLocal); }; mi.ShowAll(); menu.Insert(mi, -1); } menu.Popup(null, null, PositionFunc, 0, Gtk.Global.CurrentEventTime); }
protected override void OnPressed() { //base.OnPressed (); Gtk.Menu menu = new Gtk.Menu (); if (menu.Children.Length > 0) { Gtk.SeparatorMenuItem sep = new Gtk.SeparatorMenuItem (); sep.Show (); menu.Insert (sep, -1); } Gtk.RadioMenuItem grp = new Gtk.RadioMenuItem (""); foreach (ComboItem ci in items) { Gtk.RadioMenuItem mi = new Gtk.RadioMenuItem (grp, ci.Label.Replace ("_","__")); if (ci.Item == items.CurrentItem || ci.Item.Equals (items.CurrentItem)) mi.Active = true; ComboItemSet isetLocal = items; ComboItem ciLocal = ci; mi.Activated += delegate { SelectItem (isetLocal, ciLocal); }; mi.ShowAll (); menu.Insert (mi, -1); } menu.Popup (null, null, PositionFunc, 0, Gtk.Global.CurrentEventTime); }
public static void MakeMenuSeparator(Gtk.Menu menu) { Gtk.SeparatorMenuItem i = new Gtk.SeparatorMenuItem(); menu.Append(i); i.Show(); }
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); } }
private void Menu(object sender, Gtk.PopupMenuArgs e) { try { bool display = false; Gtk.Menu menu = new Menu(); Hooks._Window.BeforeUserMenu(menu, this); if (whoisToolStripMenuItem.Visible) { display = true; Gtk.MenuItem whois = new MenuItem("Whois"); whois.Sensitive = whoisToolStripMenuItem.Enabled; whois.Activated += new EventHandler(whoisToolStripMenuItem_Click); menu.Append(whois); } if (messageToolStripMenuItem.Visible) { display = true; Gtk.MenuItem message = new MenuItem("Message"); message.Sensitive = whoisToolStripMenuItem.Enabled; message.Activated += new EventHandler(messageToolStripMenuItem_Click); menu.Append(message); } if (dccToolStripMenu.Visible) { Gtk.SeparatorMenuItem separatorX = new Gtk.SeparatorMenuItem(); separatorX.Show(); menu.Append(separatorX); Gtk.Menu dcc = new Gtk.Menu(); Gtk.MenuItem DCC = new MenuItem("DCC"); DCC.Submenu = dcc; menu.Append(DCC); Gtk.MenuItem sc = new MenuItem(this.dccSChatToolStripMenuItem.Text); sc.Activated += new EventHandler(dccSChatToolStripMenuItem_Click); dcc.Append(sc); Gtk.MenuItem nc = new MenuItem(this.dccChatToolStripMenuItem.Text); nc.Activated += new EventHandler(dccChatToolStripMenuItem_Click); dcc.Append(nc); } if (ctToolStripMenuItem.Visible) { Gtk.SeparatorMenuItem separatorX = new Gtk.SeparatorMenuItem(); separatorX.Show(); menu.Append(separatorX); Gtk.Menu ctcp = new Gtk.Menu(); Gtk.MenuItem Ctcp = new MenuItem("CTCP"); Ctcp.Submenu = ctcp; menu.Append(Ctcp); Gtk.MenuItem ping = new MenuItem(pINGToolStripMenuItem.Text); ping.Activated += new EventHandler(pINGToolStripMenuItem_Click); ctcp.Append(ping); Gtk.MenuItem page = new MenuItem(pAGEToolStripMenuItem.Text); page.Activated += new EventHandler(pAGEToolStripMenuItem_Click); ctcp.Append(page); Gtk.MenuItem version = new MenuItem(vERSIONToolStripMenuItem.Text); version.Activated += new EventHandler(vERSIONToolStripMenuItem_Click); ctcp.Append(version); Gtk.MenuItem dt = new MenuItem(tIMEToolStripMenuItem.Text); dt.Activated += new EventHandler(tIMEToolStripMenuItem_Click); ctcp.Append(dt); } if (modeToolStripMenuItem.Visible) { display = true; Gtk.Menu changemode = new Gtk.Menu(); Gtk.MenuItem change = new MenuItem("Change mode"); change.Sensitive = modeToolStripMenuItem.Enabled; change.Submenu = changemode; menu.Append(change); Gtk.MenuItem qp = new MenuItem(qToolStripMenuItem.Text); changemode.Append(qp); qp.Activated += new EventHandler(qToolStripMenuItem_Click); Gtk.MenuItem ap = new MenuItem(aToolStripMenuItem.Text); changemode.Append(ap); ap.Activated += new EventHandler(aToolStripMenuItem_Click); Gtk.MenuItem op = new MenuItem(oToolStripMenuItem.Text); changemode.Append(op); op.Activated += new EventHandler(oToolStripMenuItem_Click); Gtk.MenuItem hp = new MenuItem(hToolStripMenuItem.Text); changemode.Append(hp); hp.Activated += new EventHandler(hToolStripMenuItem_Click); Gtk.MenuItem vp = new MenuItem(vToolStripMenuItem.Text); changemode.Append(vp); vp.Activated += new EventHandler(vToolStripMenuItem_Click); Gtk.SeparatorMenuItem separator4 = new Gtk.SeparatorMenuItem(); separator4.Show(); changemode.Append(separator4); Gtk.MenuItem qp2 = new MenuItem(qToolStripMenuItem1.Text); changemode.Append(qp2); qp2.Activated += new EventHandler(qToolStripMenuItem1_Click); Gtk.MenuItem ap2 = new MenuItem(aToolStripMenuItem1.Text); changemode.Append(ap2); ap2.Activated += new EventHandler(aToolStripMenuItem1_Click); Gtk.MenuItem op2 = new MenuItem(oToolStripMenuItem1.Text); changemode.Append(op2); op2.Activated += new EventHandler(oToolStripMenuItem1_Click); Gtk.MenuItem hp2 = new MenuItem(hToolStripMenuItem1.Text); changemode.Append(hp2); hp2.Activated += new EventHandler(hToolStripMenuItem1_Click); Gtk.MenuItem vp2 = new MenuItem(vToolStripMenuItem1.Text); changemode.Append(vp2); vp2.Activated += new EventHandler(vToolStripMenuItem1_Click); } if (kickBanToolStripMenuItem.Visible) { display = true; Gtk.MenuItem kick = new MenuItem(kickToolStripMenuItem.Text); kick.Activated += new EventHandler(kickToolStripMenuItem_Click); menu.Append(kick); Gtk.MenuItem kickban = new MenuItem(kickBanToolStripMenuItem.Text); kickban.Activated += new EventHandler(kickBanToolStripMenuItem_Click); menu.Append(kickban); Gtk.MenuItem kr = new MenuItem(krToolStripMenuItem.Text); kr.Sensitive = krToolStripMenuItem.Enabled; kr.Activated += new EventHandler(krToolStripMenuItem_Click); menu.Append(kr); Gtk.MenuItem kb = new MenuItem(kbToolStripMenuItem.Text); kb.Sensitive = kbToolStripMenuItem.Enabled; kb.Activated += new EventHandler(kickrToolStripMenuItem_Click); menu.Append(kb); Gtk.SeparatorMenuItem separator6 = new Gtk.SeparatorMenuItem(); separator6.Show(); menu.Append(separator6); } if (refreshToolStripMenuItem.Visible) { display = true; Gtk.MenuItem refresh = new MenuItem(refreshToolStripMenuItem.Text); refresh.Activated += new EventHandler(refreshToolStripMenuItem_Click); menu.Append(refresh); Gtk.MenuItem reload = new MenuItem(synchroToolStripMenuItem.Text); reload.Activated += new EventHandler(synchroToolStripMenuItem_Click); menu.Append(reload); } Hooks._Window.AfterUserMenu(menu, this); if (display) { menu.ShowAll(); menu.Popup(); } } catch (Exception fail) { Core.handleException(fail); } }
public static void AppendMenuSeparator(Gtk.Menu menu) { Gtk.SeparatorMenuItem i = new Gtk.SeparatorMenuItem (); menu.Append (i); i.Show (); }
private void InitializeGtkObjects(Gtk.Builder b) { m_adjustmentAudioPaddingAfter = (Gtk.Adjustment) b.GetObject("adjustment_audio_padding_after"); m_adjustmentAudioPaddingBefore = (Gtk.Adjustment) b.GetObject("adjustment_audio_padding_before"); m_adjustmentMaxImageHeight = (Gtk.Adjustment) b.GetObject("adjustment_max_image_height"); m_adjustmentMaxImageWidth = (Gtk.Adjustment) b.GetObject("adjustment_max_image_width"); m_episodeAdjustment = (Gtk.Adjustment) b.GetObject("episode_adjustment"); m_image1 = (Gtk.Image) b.GetObject("image1"); m_liststoreImageRescaleOptions = (Gtk.ListStore) b.GetObject("liststore_image_rescale_options"); m_liststoreLanguages = (Gtk.ListStore) b.GetObject("liststore_languages"); m_liststoreLines = (Gtk.ListStore) b.GetObject("liststore_lines"); m_previewWindow = (Gtk.Window) b.GetObject("preview_window"); m_box5 = (Gtk.Box) b.GetObject("box5"); m_toolbarPreview = (Gtk.Toolbar) b.GetObject("toolbar_preview"); m_toolbuttonGo = (Gtk.ToolButton) b.GetObject("toolbutton_go"); m_toolbuttonRefresh = (Gtk.ToolButton) b.GetObject("toolbutton_refresh"); m_toolbuttonSeparator1 = (Gtk.SeparatorToolItem) b.GetObject("toolbutton_separator1"); m_toolbuttonSelectAll = (Gtk.ToolButton) b.GetObject("toolbutton_select_all"); m_toolbuttonSelectNone = (Gtk.ToolButton) b.GetObject("toolbutton_select_none"); m_toolbuttonInvert = (Gtk.ToolButton) b.GetObject("toolbutton_invert"); m_toolbuttonSeparator2 = (Gtk.SeparatorToolItem) b.GetObject("toolbutton_separator2"); m_toolbuttonToggleActivation = (Gtk.ToolButton) b.GetObject("toolbutton_toggle_activation"); m_toolbuttonMerge = (Gtk.ToolButton) b.GetObject("toolbutton_merge"); m_scrolledwindow1 = (Gtk.ScrolledWindow) b.GetObject("scrolledwindow1"); m_treeviewLines = (Gtk.TreeView) b.GetObject("treeview_lines"); m_treeviewSelectionLines = (Gtk.TreeSelection) b.GetObject("treeview-selection_lines"); m_treeviewcolumnTargetLanguage = (Gtk.TreeViewColumn) b.GetObject("treeviewcolumn_target_language"); m_cellrenderertextTargetLanguage = (Gtk.CellRendererText) b.GetObject("cellrenderertext_target_language"); m_treeviewcolumnNativeLanguage = (Gtk.TreeViewColumn) b.GetObject("treeviewcolumn_native_language"); m_cellrenderertextNativeLanguage = (Gtk.CellRendererText) b.GetObject("cellrenderertext_native_language"); m_treeviewcolumnActors = (Gtk.TreeViewColumn) b.GetObject("treeviewcolumn_actors"); m_cellrenderertextActors = (Gtk.CellRendererText) b.GetObject("cellrenderertext_actors"); m_treeviewcolumnStart = (Gtk.TreeViewColumn) b.GetObject("treeviewcolumn_start"); m_cellrendertextStart = (Gtk.CellRendererText) b.GetObject("cellrendertext_start"); m_cellrendertextDuration = (Gtk.CellRendererText) b.GetObject("cellrendertext_duration"); m_frame10 = (Gtk.Frame) b.GetObject("frame10"); m_alignment10 = (Gtk.Alignment) b.GetObject("alignment10"); m_grid4 = (Gtk.Grid) b.GetObject("grid4"); m_buttonReplaceInSub2 = (Gtk.Button) b.GetObject("button_replace_in_sub2"); m_buttonSelectLinesBySearch = (Gtk.Button) b.GetObject("button_select_lines_by_search"); m_buttonReplaceInSub1 = (Gtk.Button) b.GetObject("button_replace_in_sub1"); m_entryLinesSearch = (Gtk.Entry) b.GetObject("entry_lines_search"); m_entryReplaceRegexTo = (Gtk.Entry) b.GetObject("entry_replace_regex_to"); m_entryReplaceRegexFrom = (Gtk.Entry) b.GetObject("entry_replace_regex_from"); m_label5 = (Gtk.Label) b.GetObject("label5"); m_label17 = (Gtk.Label) b.GetObject("label17"); m_labelNumCardsSelected = (Gtk.Label) b.GetObject("label_num_cards_selected"); m_frame11 = (Gtk.Frame) b.GetObject("frame11"); m_alignment11 = (Gtk.Alignment) b.GetObject("alignment11"); m_box7 = (Gtk.Box) b.GetObject("box7"); m_frame12 = (Gtk.Frame) b.GetObject("frame12"); m_box11 = (Gtk.Box) b.GetObject("box11"); m_eventboxImagePreview = (Gtk.EventBox) b.GetObject("eventbox_image_preview"); m_imagePreview = (Gtk.Image) b.GetObject("image_preview"); m_buttonPlayContent = (Gtk.Button) b.GetObject("button_play_content"); m_label23 = (Gtk.Label) b.GetObject("label23"); m_frame13 = (Gtk.Frame) b.GetObject("frame13"); m_box12 = (Gtk.Box) b.GetObject("box12"); m_scrolledwindow2 = (Gtk.ScrolledWindow) b.GetObject("scrolledwindow2"); m_textviewTargetLanguage = (Gtk.TextView) b.GetObject("textview_target_language"); m_scrolledwindow3 = (Gtk.ScrolledWindow) b.GetObject("scrolledwindow3"); m_textviewNativeLanguage = (Gtk.TextView) b.GetObject("textview_native_language"); m_label24 = (Gtk.Label) b.GetObject("label24"); m_label22 = (Gtk.Label) b.GetObject("label22"); m_liststoreSubEncoding = (Gtk.ListStore) b.GetObject("liststore_sub_encoding"); m_liststoreSubStreams = (Gtk.ListStore) b.GetObject("liststore_sub_streams"); m_subtitleOptionsWindow = (Gtk.Window) b.GetObject("subtitle_options_window"); m_box13 = (Gtk.Box) b.GetObject("box13"); m_frame14 = (Gtk.Frame) b.GetObject("frame14"); m_comboboxSubEncoding = (Gtk.ComboBox) b.GetObject("combobox_sub_encoding"); m_cellrenderertextSubEncoding = (Gtk.CellRendererText) b.GetObject("cellrenderertext_sub_encoding"); m_label3 = (Gtk.Label) b.GetObject("label3"); m_frame15 = (Gtk.Frame) b.GetObject("frame15"); m_comboboxSubStream = (Gtk.ComboBox) b.GetObject("combobox_sub_stream"); m_cellrendertextSubStreams = (Gtk.CellRendererText) b.GetObject("cellrendertext_sub_streams"); m_label4 = (Gtk.Label) b.GetObject("label4"); m_buttonSubOptionsApply = (Gtk.Button) b.GetObject("button_sub_options_apply"); m_numericalAdjustmentSub1 = (Gtk.Adjustment) b.GetObject("numerical_adjustment_sub1"); m_numericalAdjustmentSub2 = (Gtk.Adjustment) b.GetObject("numerical_adjustment_sub2"); m_mainWindow = (Gtk.Window) b.GetObject("main_window"); m_box1 = (Gtk.Box) b.GetObject("box1"); m_menubar1 = (Gtk.MenuBar) b.GetObject("menubar1"); m_menuitem1 = (Gtk.MenuItem) b.GetObject("menuitem1"); m_menu1 = (Gtk.Menu) b.GetObject("menu1"); m_imagemenuitemNew = (Gtk.ImageMenuItem) b.GetObject("imagemenuitem_new"); m_imagemenuitemOpen = (Gtk.ImageMenuItem) b.GetObject("imagemenuitem_open"); m_imagemenuitemSave = (Gtk.ImageMenuItem) b.GetObject("imagemenuitem_save"); m_imagemenuitemSaveAs = (Gtk.ImageMenuItem) b.GetObject("imagemenuitem_save_as"); m_separatormenuitem1 = (Gtk.SeparatorMenuItem) b.GetObject("separatormenuitem1"); m_imagemenuitemClose = (Gtk.ImageMenuItem) b.GetObject("imagemenuitem_close"); m_menuitem3 = (Gtk.MenuItem) b.GetObject("menuitem3"); m_menu3 = (Gtk.Menu) b.GetObject("menu3"); m_imagemenuitem10 = (Gtk.ImageMenuItem) b.GetObject("imagemenuitem10"); m_infobar1 = (Gtk.InfoBar) b.GetObject("infobar1"); m_infobarActionArea = (Gtk.ButtonBox) b.GetObject("infobar-action_area"); m_infobarContentArea = (Gtk.Box) b.GetObject("infobar-content_area"); m_labelInInfobar = (Gtk.Label) b.GetObject("label_in_infobar"); m_box2 = (Gtk.Box) b.GetObject("box2"); m_frame1 = (Gtk.Frame) b.GetObject("frame1"); m_alignment1 = (Gtk.Alignment) b.GetObject("alignment1"); m_grid1 = (Gtk.Grid) b.GetObject("grid1"); m_entryTargetLanguage = (Gtk.Entry) b.GetObject("entry_target_language"); m_entryOutputDirectory = (Gtk.Entry) b.GetObject("entry_output_directory"); m_entryNativeLanguage = (Gtk.Entry) b.GetObject("entry_native_language"); m_entryVideoFile = (Gtk.Entry) b.GetObject("entry_video_file"); m_buttonTargetLanguageChoose = (Gtk.Button) b.GetObject("button_target_language_choose"); m_buttonDirectoryChoose = (Gtk.Button) b.GetObject("button_directory_choose"); m_buttonNativeLanguageChoose = (Gtk.Button) b.GetObject("button_native_language_choose"); m_buttonVideoFileChoose = (Gtk.Button) b.GetObject("button_video_file_choose"); m_buttonTargetLanguageOptions = (Gtk.Button) b.GetObject("button_target_language_options"); m_buttonNativeLanguageOptions = (Gtk.Button) b.GetObject("button_native_language_options"); m_buttonVideoOptions = (Gtk.Button) b.GetObject("button_video_options"); m_buttonAudioChoose = (Gtk.Button) b.GetObject("button_audio_choose"); m_entryAudioFile = (Gtk.Entry) b.GetObject("entry_audio_file"); m_label1 = (Gtk.Label) b.GetObject("label1"); m_frame2 = (Gtk.Frame) b.GetObject("frame2"); m_alignment2 = (Gtk.Alignment) b.GetObject("alignment2"); m_grid5 = (Gtk.Grid) b.GetObject("grid5"); m_expanderSubtitleOptions = (Gtk.Expander) b.GetObject("expander_subtitle_options"); m_box9 = (Gtk.Box) b.GetObject("box9"); m_frame4 = (Gtk.Frame) b.GetObject("frame4"); m_alignment4 = (Gtk.Alignment) b.GetObject("alignment4"); m_grid2 = (Gtk.Grid) b.GetObject("grid2"); m_label8 = (Gtk.Label) b.GetObject("label8"); m_label9 = (Gtk.Label) b.GetObject("label9"); m_comboboxtextCorrectTimingsModeSub1 = (Gtk.ComboBoxText) b.GetObject("comboboxtext_correct_timings_mode_sub1"); m_spinbuttonSub1TimeShift = (Gtk.SpinButton) b.GetObject("spinbutton_sub1_time_shift"); m_label6 = (Gtk.Label) b.GetObject("label6"); m_frame5 = (Gtk.Frame) b.GetObject("frame5"); m_alignment5 = (Gtk.Alignment) b.GetObject("alignment5"); m_grid3 = (Gtk.Grid) b.GetObject("grid3"); m_label7 = (Gtk.Label) b.GetObject("label7"); m_label10 = (Gtk.Label) b.GetObject("label10"); m_comboboxtextCorrectTimingsModeSub2 = (Gtk.ComboBoxText) b.GetObject("comboboxtext_correct_timings_mode_sub2"); m_spinbuttonSub2TimeShift = (Gtk.SpinButton) b.GetObject("spinbutton_sub2_time_shift"); m_label12 = (Gtk.Label) b.GetObject("label12"); m_frame3 = (Gtk.Frame) b.GetObject("frame3"); m_alignment3 = (Gtk.Alignment) b.GetObject("alignment3"); m_box3 = (Gtk.Box) b.GetObject("box3"); m_checkbuttonUseSub1Timings = (Gtk.CheckButton) b.GetObject("checkbutton_use_sub1_timings"); m_checkbuttonUseSub2Timings = (Gtk.CheckButton) b.GetObject("checkbutton_use_sub2_timings"); m_label11 = (Gtk.Label) b.GetObject("label11"); m_label20 = (Gtk.Label) b.GetObject("label20"); m_expanderAudioOptions = (Gtk.Expander) b.GetObject("expander_audio_options"); m_box15 = (Gtk.Box) b.GetObject("box15"); m_frame17 = (Gtk.Frame) b.GetObject("frame17"); m_alignment14 = (Gtk.Alignment) b.GetObject("alignment14"); m_box16 = (Gtk.Box) b.GetObject("box16"); m_checkbuttonNormalizeAudio = (Gtk.CheckButton) b.GetObject("checkbutton_normalize_audio"); m_checkbuttonDeactivateAudioClips = (Gtk.CheckButton) b.GetObject("checkbutton_deactivate_audio_clips"); m_label26 = (Gtk.Label) b.GetObject("label26"); m_frame16 = (Gtk.Frame) b.GetObject("frame16"); m_alignment13 = (Gtk.Alignment) b.GetObject("alignment13"); m_grid6 = (Gtk.Grid) b.GetObject("grid6"); m_label28 = (Gtk.Label) b.GetObject("label28"); m_label29 = (Gtk.Label) b.GetObject("label29"); m_spinbuttonAudioPaddingBefore = (Gtk.SpinButton) b.GetObject("spinbutton_audio_padding_before"); m_spinbuttonAudioPaddingAfter = (Gtk.SpinButton) b.GetObject("spinbutton_audio_padding_after"); m_label27 = (Gtk.Label) b.GetObject("label27"); m_label53 = (Gtk.Label) b.GetObject("label53"); m_expanderImageOptions = (Gtk.Expander) b.GetObject("expander_image_options"); m_box17 = (Gtk.Box) b.GetObject("box17"); m_frame19 = (Gtk.Frame) b.GetObject("frame19"); m_alignment16 = (Gtk.Alignment) b.GetObject("alignment16"); m_spinbuttonMaxImageWidth = (Gtk.SpinButton) b.GetObject("spinbutton_max_image_width"); m_spinbuttonMaxImageHeight = (Gtk.SpinButton) b.GetObject("spinbutton_max_image_height"); m_comboboxtextRescaleMode = (Gtk.ComboBox) b.GetObject("comboboxtext_rescale_mode"); m_label13 = (Gtk.Label) b.GetObject("label13"); m_label2 = (Gtk.Label) b.GetObject("label2"); m_frame7 = (Gtk.Frame) b.GetObject("frame7"); m_alignment7 = (Gtk.Alignment) b.GetObject("alignment7"); m_label16 = (Gtk.Label) b.GetObject("label16"); m_spinbuttonEpisodeNumber = (Gtk.SpinButton) b.GetObject("spinbutton_episode_number"); m_entryDeckName = (Gtk.Entry) b.GetObject("entry_deck_name"); m_label15 = (Gtk.Label) b.GetObject("label15"); m_buttonPreview = (Gtk.Button) b.GetObject("button_preview"); m_label18 = (Gtk.Label) b.GetObject("label18"); m_label19 = (Gtk.Label) b.GetObject("label19"); m_comboboxTargetLanguage = (Gtk.ComboBox) b.GetObject("combobox_target_language"); m_label14 = (Gtk.Label) b.GetObject("label14"); m_windowProgressInfo = (Gtk.Window) b.GetObject("window_progress_info"); m_alignment12 = (Gtk.Alignment) b.GetObject("alignment12"); m_box14 = (Gtk.Box) b.GetObject("box14"); m_progressbarProgressInfo = (Gtk.ProgressBar) b.GetObject("progressbar_progress_info"); m_buttonCancelOperation = (Gtk.Button) b.GetObject("button_cancel_operation"); }
public void AddSeparator() { Gtk.SeparatorMenuItem item = new Gtk.SeparatorMenuItem (); Append (item); item.Show (); }
private void OnTomboyTrayMenuShown (object sender, EventArgs args) { // Add in the top tasks // TODO: Read the number of todo items to show from Preferences int max_size = 5; int list_size = 0; Gtk.MenuItem item; // Filter the tasks to the ones that are incomplete Gtk.TreeModelFilter store_filter = new Gtk.TreeModelFilter (TasksApplicationAddin.DefaultTaskManager.Tasks, null); store_filter.VisibleFunc = FilterTasks; // TODO: Sort the tasks to order by due date and priority // store_sort = new Gtk.TreeModelSort (store_filter); // store_sort.DefaultSortFunc = // new Gtk.TreeIterCompareFunc (TaskSortFunc); // tree.Model = store_sort; // int cnt = tree.Model.IterNChildren (); // task_count.Text = string.Format ( // Catalog.GetPluralString("Total: {0} task", // "Total: {0} tasks", // cnt), // cnt); // List the top "max_size" tasks Gtk.TreeIter iter; Gtk.SeparatorMenuItem separator; // Determine whether the icon is near the top/bottom of the screen int position; if (!Tomboy.Tray.MenuOpensUpward ()) position = 2; else position = tomboy_tray_menu.Children.Length - 7; separator = new Gtk.SeparatorMenuItem (); tomboy_tray_menu.Insert (separator, position++); separator.Show (); top_tasks.Add (separator); item = new Gtk.MenuItem (Catalog.GetString ("To Do List")); tomboy_tray_menu.Insert (item, position++); item.ShowAll (); top_tasks.Add (item); item.Activated += OnOpenTodoList; if (store_filter.GetIterFirst (out iter)) { do { Task task = store_filter.GetValue (iter, 0) as Task; item = new TomboyTaskMenuItem (task); tomboy_tray_menu.Insert (item, list_size + position); item.ShowAll (); top_tasks.Add (item); list_size++; } while (store_filter.IterNext (ref iter) && list_size < max_size); } }
private void CreateMenu_simple(object o, Gtk.PopulatePopupArgs e) { try { Gtk.SeparatorMenuItem separator1 = new Gtk.SeparatorMenuItem(); separator1.Show(); e.Menu.Append(separator1); Gtk.CheckMenuItem sc = new CheckMenuItem(scroll.Text); sc.Active = scroll.Checked; sc.Show(); e.Menu.Append(sc); Gtk.MenuItem m1 = new Gtk.MenuItem(remove.Text); m1.Activated += new EventHandler(Clear); m1.Show(); sc.Activated += new EventHandler(Scroll); e.Menu.Append(m1); } catch (Exception fail) { Core.handleException(fail); } }
private void OnTomboyTrayMenuShown(object sender, EventArgs args) { // Add in the top tasks // TODO: Read the number of todo items to show from Preferences int max_size = 5; int list_size = 0; Gtk.MenuItem item; // Filter the tasks to the ones that are incomplete Gtk.TreeModelFilter store_filter = new Gtk.TreeModelFilter(TasksApplicationAddin.DefaultTaskManager.Tasks, null); store_filter.VisibleFunc = FilterTasks; // TODO: Sort the tasks to order by due date and priority // store_sort = new Gtk.TreeModelSort (store_filter); // store_sort.DefaultSortFunc = // new Gtk.TreeIterCompareFunc (TaskSortFunc); // tree.Model = store_sort; // int cnt = tree.Model.IterNChildren (); // task_count.Text = string.Format ( // Catalog.GetPluralString("Total: {0} task", // "Total: {0} tasks", // cnt), // cnt); // List the top "max_size" tasks Gtk.TreeIter iter; Gtk.SeparatorMenuItem separator; // Determine whether the icon is near the top/bottom of the screen int position; //if (!Tomboy.Tray.MenuOpensUpward ()) position = 0; //else // position = tomboy_tray_menu.Children.Length - 7; separator = new Gtk.SeparatorMenuItem(); tomboy_tray_menu.Insert(separator, position++); separator.Show(); top_tasks.Add(separator); item = new Gtk.MenuItem(Catalog.GetString("To Do List")); tomboy_tray_menu.Insert(item, position++); item.ShowAll(); top_tasks.Add(item); item.Activated += OnOpenTodoList; if (store_filter.GetIterFirst(out iter)) { do { Task task = store_filter.GetValue(iter, 0) as Task; item = new TomboyTaskMenuItem(task); tomboy_tray_menu.Insert(item, list_size + position); item.ShowAll(); top_tasks.Add(item); list_size++; } while (store_filter.IterNext(ref iter) && list_size < max_size); } }
// // Construct a window to display a note // // Currently a toolbar with Link, Search, Text, Delete buttons // and a Gtk.TextView as the body. // public NoteWindow (Note note) : base (note.Title) { this.note = note; this.IconName = "tomboy"; this.SetDefaultSize (450, 360); Resizable = true; accel_group = new Gtk.AccelGroup (); AddAccelGroup (accel_group); text_menu = new NoteTextMenu (accel_group, note.Buffer, note.Buffer.Undoer); // Add the Find menu item to the toolbar Text menu. It // should only show up in the toplevel Text menu, since // the context menu already has a Find submenu. Gtk.SeparatorMenuItem spacer = new Gtk.SeparatorMenuItem (); spacer.Show (); text_menu.Append (spacer); Gtk.ImageMenuItem find_item = new Gtk.ImageMenuItem (Catalog.GetString("Find in This Note")); find_item.Image = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Menu); find_item.Activated += FindActivate; find_item.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.f, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); find_item.Show (); text_menu.Append (find_item); plugin_menu = MakePluginMenu (); toolbar = MakeToolbar (); toolbar.Show (); template_widget = MakeTemplateBar (); // The main editor widget editor = new NoteEditor (note.Buffer); editor.PopulatePopup += OnPopulatePopup; editor.Show (); // Sensitize the Link toolbar button on text selection mark_set_timeout = new InterruptableTimeout(); mark_set_timeout.Timeout += UpdateLinkButtonSensitivity; note.Buffer.MarkSet += OnSelectionMarkSet; // FIXME: I think it would be really nice to let the // window get bigger up till it grows more than // 60% of the screen, and then show scrollbars. editor_window = new Gtk.ScrolledWindow (); editor_window.HscrollbarPolicy = Gtk.PolicyType.Automatic; editor_window.VscrollbarPolicy = Gtk.PolicyType.Automatic; editor_window.Add (editor); editor_window.Show (); FocusChild = editor; find_bar = new NoteFindBar (note); find_bar.Visible = false; find_bar.NoShowAll = true; find_bar.Hidden += FindBarHidden; Gtk.VBox box = new Gtk.VBox (false, 2); box.PackStart (toolbar, false, false, 0); box.PackStart (template_widget, false, false, 0); box.PackStart (editor_window, true, true, 0); box.PackStart (find_bar, false, false, 0); box.Show (); // Don't set up Ctrl-W or Ctrl-N if Emacs is in use bool using_emacs = false; string gtk_key_theme = (string) Preferences.Get ("/desktop/gnome/interface/gtk_key_theme"); if (gtk_key_theme != null && gtk_key_theme.CompareTo ("Emacs") == 0) using_emacs = true; // NOTE: Since some of our keybindings are only // available in the context menu, and the context menu // is created on demand, register them with the // global keybinder global_keys = new GlobalKeybinder (accel_group); // Close window (Ctrl-W) if (!using_emacs) global_keys.AddAccelerator (new EventHandler (CloseWindowHandler), (uint) Gdk.Key.w, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); // Escape has been moved to be handled by a KeyPress Handler so that // Escape can be used to close the FindBar. // Close all windows on current Desktop (Ctrl-Q) global_keys.AddAccelerator (new EventHandler (CloseAllWindowsHandler), (uint) Gdk.Key.q, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); // Find Next (Ctrl-G) global_keys.AddAccelerator (new EventHandler (FindNextActivate), (uint) Gdk.Key.g, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); // Find Previous (Ctrl-Shift-G) global_keys.AddAccelerator (new EventHandler (FindPreviousActivate), (uint) Gdk.Key.g, (Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask), Gtk.AccelFlags.Visible); // Open Help (F1) global_keys.AddAccelerator (new EventHandler (OpenHelpActivate), (uint) Gdk.Key.F1, 0, 0); // Create a new note if (!using_emacs) global_keys.AddAccelerator (new EventHandler (CreateNewNote), (uint) Gdk.Key.n, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); // Have Esc key close the find bar or note window KeyPressEvent += KeyPressed; // Increase Indent global_keys.AddAccelerator (new EventHandler (ChangeDepthRightHandler), (uint) Gdk.Key.Right, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible); // Decrease Indent global_keys.AddAccelerator (new EventHandler (ChangeDepthLeftHandler), (uint) Gdk.Key.Left, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible); this.Add (box); }
void OnPopulatePopup (object sender, Gtk.PopulatePopupArgs args) { args.Menu.AccelGroup = accel_group; Logger.Debug ("Populating context menu..."); // Remove the lame-o gigantic Insert Unicode Control // Characters menu item. Gtk.Widget lame_unicode; lame_unicode = (Gtk.Widget) args.Menu.Children [args.Menu.Children.Length - 1]; args.Menu.Remove (lame_unicode); Gtk.MenuItem spacer1 = new Gtk.SeparatorMenuItem (); spacer1.Show (); Gtk.ImageMenuItem search = new Gtk.ImageMenuItem ( Catalog.GetString ("_Search All Notes")); search.Image = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Menu); search.Activated += SearchActivate; search.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.f, (Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask), Gtk.AccelFlags.Visible); search.Show (); Gtk.ImageMenuItem link = new Gtk.ImageMenuItem (Catalog.GetString ("_Link to New Note")); link.Image = new Gtk.Image (Gtk.Stock.JumpTo, Gtk.IconSize.Menu); link.Sensitive = (note.Buffer.Selection != null); link.Activated += LinkToNoteActivate; link.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.l, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); link.Show (); Gtk.ImageMenuItem text_item = new Gtk.ImageMenuItem (Catalog.GetString ("Te_xt")); text_item.Image = new Gtk.Image (Gtk.Stock.SelectFont, Gtk.IconSize.Menu); text_item.Submenu = new NoteTextMenu (accel_group, note.Buffer, note.Buffer.Undoer); text_item.Show (); Gtk.ImageMenuItem find_item = new Gtk.ImageMenuItem (Catalog.GetString ("_Find in This Note")); find_item.Image = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Menu); find_item.Submenu = MakeFindMenu (); find_item.Show (); Gtk.MenuItem spacer2 = new Gtk.SeparatorMenuItem (); spacer2.Show (); args.Menu.Prepend (spacer1); args.Menu.Prepend (text_item); args.Menu.Prepend (find_item); args.Menu.Prepend (link); args.Menu.Prepend (search); Gtk.MenuItem close_all = new Gtk.MenuItem (Catalog.GetString ("Clos_e All Notes")); close_all.Activated += CloseAllWindowsHandler; close_all.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.q, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); close_all.Show (); Gtk.ImageMenuItem close_window = new Gtk.ImageMenuItem (Catalog.GetString ("_Close")); close_window.Image = new Gtk.Image (Gtk.Stock.Close, Gtk.IconSize.Menu); close_window.Activated += CloseWindowHandler; close_window.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.w, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); close_window.Show (); args.Menu.Append (close_all); args.Menu.Append (close_window); }
// FIXME: Tags applied to a word should hold over the space // between the next word, as thats where you'll start typeing. // Tags are only active -after- a character with that tag. This // is different from the way gtk-textbuffer applies tags. // // Text menu // // Menu for font style and size, and set the active radio // menuitem depending on the cursor poition. // public NoteTextMenu (Gtk.AccelGroup accel_group, NoteBuffer buffer, UndoManager undo_manager) : base () { this.buffer = buffer; this.undo_manager = undo_manager; if (undo_manager != null) { undo = new Gtk.ImageMenuItem (Gtk.Stock.Undo, accel_group); undo.Activated += UndoClicked; undo.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.z, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); undo.Show (); Append (undo); redo = new Gtk.ImageMenuItem (Gtk.Stock.Redo, accel_group); redo.Activated += RedoClicked; redo.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.z, (Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask), Gtk.AccelFlags.Visible); redo.Show (); Append (redo); Gtk.SeparatorMenuItem undo_spacer = new Gtk.SeparatorMenuItem (); Append (undo_spacer); // Listen to events so we can sensitize and // enable keybinding undo_manager.UndoChanged += UndoChanged; } bold = new Gtk.CheckMenuItem ("<b>" + Catalog.GetString ("_Bold") + "</b>"); MarkupLabel (bold); bold.Data ["Tag"] = "bold"; bold.Activated += FontStyleClicked; bold.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.b, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); italic = new Gtk.CheckMenuItem ("<i>" + Catalog.GetString ("_Italic") + "</i>"); MarkupLabel (italic); italic.Data ["Tag"] = "italic"; italic.Activated += FontStyleClicked; italic.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.i, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); strikeout = new Gtk.CheckMenuItem ("<s>" + Catalog.GetString ("_Strikeout") + "</s>"); MarkupLabel (strikeout); strikeout.Data ["Tag"] = "strikethrough"; strikeout.Activated += FontStyleClicked; strikeout.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.s, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); highlight = new Gtk.CheckMenuItem ("<span background='yellow'>" + Catalog.GetString ("_Highlight") + "</span>"); MarkupLabel (highlight); highlight.Data ["Tag"] = "highlight"; highlight.Activated += FontStyleClicked; highlight.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.h, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); Gtk.SeparatorMenuItem spacer1 = new Gtk.SeparatorMenuItem (); Gtk.MenuItem font_size = new Gtk.MenuItem (Catalog.GetString ("Font Size")); font_size.Sensitive = false; normal = new Gtk.RadioMenuItem (Catalog.GetString ("_Normal")); MarkupLabel (normal); normal.Active = true; normal.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.Key_0, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); normal.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.KP_0, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); normal.Activated += FontSizeActivated; huge = new Gtk.RadioMenuItem (normal.Group, "<span size=\"x-large\">" + Catalog.GetString ("Hu_ge") + "</span>"); MarkupLabel (huge); huge.Data ["Tag"] = "size:huge"; huge.Activated += FontSizeActivated; large = new Gtk.RadioMenuItem (huge.Group, "<span size=\"large\">" + Catalog.GetString ("_Large") + "</span>"); MarkupLabel (large); large.Data ["Tag"] = "size:large"; large.Activated += FontSizeActivated; small = new Gtk.RadioMenuItem (large.Group, "<span size=\"small\">" + Catalog.GetString ("S_mall") + "</span>"); MarkupLabel (small); small.Data ["Tag"] = "size:small"; small.Activated += FontSizeActivated; hidden_no_size = new Gtk.RadioMenuItem (small.Group, string.Empty); hidden_no_size.Hide (); increase_font = new Gtk.MenuItem (Catalog.GetString ("Increase Font Size")); increase_font.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.plus, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); increase_font.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.KP_Add, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); increase_font.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.equal, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); increase_font.Activated += IncreaseFontClicked; decrease_font = new Gtk.MenuItem (Catalog.GetString ("Decrease Font Size")); decrease_font.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.minus, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); decrease_font.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.KP_Subtract, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); decrease_font.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.underscore, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); decrease_font.Activated += DecreaseFontClicked; Gtk.SeparatorMenuItem spacer2 = new Gtk.SeparatorMenuItem (); bullets = new Gtk.CheckMenuItem (Catalog.GetString ("Bullets")); bullets.Activated += ToggleBulletsClicked; increase_indent = new Gtk.ImageMenuItem (Gtk.Stock.Indent, accel_group); increase_indent.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.Right, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible); increase_indent.Activated += IncreaseIndentClicked; increase_indent.Show (); decrease_indent = new Gtk.ImageMenuItem (Gtk.Stock.Unindent, accel_group); decrease_indent.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.Left, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible); decrease_indent.Activated += DecreaseIndentClicked; decrease_indent.Show (); RefreshState (); Append (bold); Append (italic); Append (strikeout); Append (highlight); Append (spacer1); Append (font_size); Append (small); Append (normal); Append (large); Append (huge); Append (increase_font); Append (decrease_font); Append (spacer2); Append (bullets); Append (increase_indent); Append (decrease_indent); ShowAll (); theme_hack_menu = new Menu (); theme_hack_menu.Realize (); theme_hack_menu.StyleSet += delegate { ModifyBg (StateType.Normal, theme_hack_menu.Style.Background (StateType.Normal)); }; }
public void Populate (Category cat, Gtk.Menu parent) { Widget [] dead_pool = parent.Children; for (int i = 0; i < dead_pool.Length; i++) dead_pool [i].Destroy (); foreach (Tag t in cat.Children) { TagMenuItem item = new TagMenuItem (t); parent.Append (item); item.ShowAll (); Category subcat = t as Category; if (subcat != null && subcat.Children.Length != 0) { Gtk.Menu submenu = new Menu (); Populate (t as Category, submenu); Gtk.SeparatorMenuItem sep = new Gtk.SeparatorMenuItem (); submenu.Prepend (sep); sep.ShowAll (); TagMenuItem subitem = new TagMenuItem (t); subitem.Activated += HandleActivate; submenu.Prepend (subitem); subitem.ShowAll (); item.Submenu = submenu; } else { item.Activated += HandleActivate; } } }
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); }
private void ShowPopup() { Gtk.Menu menu = new Gtk.Menu (); menu.AccelGroup = new AccelGroup (); Gtk.MenuItem editMenuItem = new Gtk.MenuItem (Mono.Posix.Catalog.GetString ("Edit")); ArrayList selectedItems = catalog.ItemCollection.GetSelectedItems(); Gtk.MenuItem lendMenuItem = null; if (selectedItems.Count == 1) { if (catalog.IsBorrowed ((Item)selectedItems[0])) { lendMenuItem = new Gtk.MenuItem (Mono.Posix.Catalog.GetString ("Return")); lendMenuItem.Activated += OnReturnMenuItemClicked; } else { lendMenuItem = new Gtk.MenuItem (Mono.Posix.Catalog.GetString ("Lend")); lendMenuItem.Activated += OnLendMenuItemClicked; } } Gtk.ImageMenuItem removeMenuItem = new Gtk.ImageMenuItem (Gtk.Stock.Remove, menu.AccelGroup); Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem(); editMenuItem.Activated += OnEditMenuItemClicked; removeMenuItem.Activated += OnRemoveMenuItemClicked; menu.Append (editMenuItem); if (lendMenuItem != null) { menu.Append (lendMenuItem); } menu.Append (separator); menu.Append (removeMenuItem); menu.Popup (null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime); menu.ShowAll (); }