protected override void OnShown() { Trace.Call(); if (!IsPopulated) { IsPopulated = true; foreach (var chatView in ChatViewManager.Chats) { if (!(chatView is XmppGroupChatView)) { // only invite to group chats continue; } if (chatView == ChatViewManager.ActiveChat) { // don't need to add current chat to invite list continue; } if (chatView.ProtocolManager != ProtocolManager) { // only add chats from current server continue; } var groupChatView = (XmppGroupChatView)chatView; if (groupChatView.IsContactList) { // ignore our abused groupchatview continue; } var item = new Gtk.ImageMenuItem(chatView.Name); item.Image = new Gtk.Image(GroupChatView.IconPixbuf); var chatid = chatView.ID; item.Activated += delegate { var inviteFromChatModel = ChatViewManager.ActiveChat.ChatModel; ThreadPool.QueueUserWorkItem(delegate { try { for (int i = 0; i < Invitees.Count; i++) { ProtocolManager.CommandInvite( new CommandModel( Frontend.FrontendManager, inviteFromChatModel, chatid + " " + Invitees[i].ID ) ); } } catch (Exception ex) { Frontend.ShowException(ex); } }); }; item.Show(); Append(item); } } base.OnShown(); }
public static Gtk.MenuItem MakeMenuItem(Gtk.Menu menu, string l, EventHandler e, bool enabled) { Gtk.MenuItem i; Gtk.StockItem item = Gtk.StockItem.Zero; if (Gtk.StockManager.Lookup(l, ref item)) { i = new Gtk.ImageMenuItem(l, new Gtk.AccelGroup()); } else { i = new Gtk.MenuItem(l); } if (e != null) { i.Activated += e; } i.Sensitive = enabled; menu.Append(i); i.Show(); return(i); }
private void _OnOutputMessageTextViewPopulatePopup(object o, Gtk.PopulatePopupArgs args) { if (OutputMessageTextView.IsAtUrlTag) { return; } Gtk.Menu popup = args.Menu; popup.Append(new Gtk.SeparatorMenuItem()); Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois")); whois_item.Activated += _OnMenuWhoisItemActivated; popup.Append(whois_item); Gtk.ImageMenuItem ctcp_item = new Gtk.ImageMenuItem(_("CTCP")); Gtk.Menu ctcp_menu_item = new CtcpMenu(_IrcProtocolManager, Frontend.MainWindow.ChatViewManager, PersonModel); ctcp_item.Submenu = ctcp_menu_item; popup.Append(ctcp_item); Gtk.ImageMenuItem invite_to_item = new Gtk.ImageMenuItem(_("Invite to")); Gtk.Menu invite_to_menu_item = new InviteToMenu(_IrcProtocolManager, Frontend.MainWindow.ChatViewManager, PersonModel); invite_to_item.Submenu = invite_to_menu_item; popup.Append(invite_to_item); popup.ShowAll(); }
protected virtual void OnPopulatePopup(object sender, Gtk.PopulatePopupArgs e) { Trace.Call(sender, e); if (!_AtLinkTag) { return; } Gtk.Menu popup = e.Menu; // remove all items foreach (Gtk.Widget children in popup.Children) { popup.Remove(children); } Gtk.ImageMenuItem open_item = new Gtk.ImageMenuItem(Gtk.Stock.Open, null); open_item.Activated += delegate { if (_ActiveLink != null) { OpenLink(_ActiveLink); } }; popup.Append(open_item); Gtk.ImageMenuItem copy_item = new Gtk.ImageMenuItem(Gtk.Stock.Copy, null); copy_item.Activated += delegate { Gdk.Atom clipboardAtom = Gdk.Atom.Intern("CLIPBOARD", false); Gtk.Clipboard clipboard = Gtk.Clipboard.Get(clipboardAtom); clipboard.Text = _ActiveLink.ToString(); }; popup.Append(copy_item); popup.ShowAll(); }
void IMenuItemContainer.ShowContextMenu(ActionItem aitem) { ActionMenuItem menuItem = aitem as ActionMenuItem; Gtk.Menu m = new Gtk.Menu(); Gtk.MenuItem item = new Gtk.ImageMenuItem(Gtk.Stock.Cut, null); m.Add(item); item.Activated += delegate(object s, EventArgs a) { Cut(menuItem); }; item.Visible = false; // No copy & paste for now item = new Gtk.ImageMenuItem(Gtk.Stock.Copy, null); m.Add(item); item.Activated += delegate(object s, EventArgs a) { Copy(menuItem); }; item.Visible = false; // No copy & paste for now item = new Gtk.ImageMenuItem(Gtk.Stock.Paste, null); m.Add(item); item.Activated += delegate(object s, EventArgs a) { Paste(menuItem); }; item.Visible = false; // No copy & paste for now item = new Gtk.ImageMenuItem(Gtk.Stock.Delete, null); m.Add(item); item.Activated += delegate(object s, EventArgs a) { Delete(menuItem); }; m.ShowAll(); m.Popup(); }
public void SetImage(ImageDescription image) { Gtk.ImageMenuItem it = item as Gtk.ImageMenuItem; if (it == null) { return; } if (!image.IsNull) { if (defImage == null) { item.StateChanged += ImageMenuItemStateChanged; } defImage = image; selImage = new ImageDescription { Backend = image.Backend, Size = image.Size, Alpha = image.Alpha, Styles = image.Styles.Add("sel") }; var img = new ImageBox(context, image); img.ShowAll(); it.Image = img; GtkWorkarounds.ForceImageOnMenuItem(it); } else { if (defImage.HasValue) { item.StateChanged -= ImageMenuItemStateChanged; defImage = selImage = null; } it.Image = null; } }
IEnumerable <Gtk.MenuItem> CreateContextMenuItems() { if (IrcProtocolManager == null) { // we are not synced yet yield break; } Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois")); whois_item.Activated += OnMenuWhoisItemActivated; yield return(whois_item); Gtk.ImageMenuItem ctcp_item = new Gtk.ImageMenuItem(_("CTCP")); Gtk.Menu ctcp_menu_item = new CtcpMenu(IrcProtocolManager, Frontend.MainWindow.ChatViewManager, PersonModel); ctcp_item.Submenu = ctcp_menu_item; yield return(ctcp_item); Gtk.ImageMenuItem invite_to_item = new Gtk.ImageMenuItem(_("Invite to")); Gtk.Menu invite_to_menu_item = new InviteToMenu(IrcProtocolManager, Frontend.MainWindow.ChatViewManager, PersonModel); invite_to_item.Submenu = invite_to_menu_item; yield return(invite_to_item); }
public static void ForceImageOnMenuItem(Gtk.ImageMenuItem mi) { if (GtkMinorVersion >= 16) { gtk_image_menu_item_set_always_show_image(mi.Handle, true); } }
public override void Initialize() { // Don't add item to tools menu if Sticky Notes XML file does not // exist. Only check for the file once, since Initialize is called // for each note when Tomboy starts up. if (sticky_file_might_exist) { if (sticky_file_existence_confirmed || File.Exists(sticky_xml_path)) { item = new Gtk.ImageMenuItem( Catalog.GetString("Import from Sticky Notes")); item.Image = new Gtk.Image(Gtk.Stock.Convert, Gtk.IconSize.Menu); item.Activated += ImportButtonClicked; item.Show(); AddPluginMenuItem(item); sticky_file_existence_confirmed = true; CheckForFirstRun(); } else { sticky_file_might_exist = false; Logger.Debug(debug_no_sticky_file); } } }
public void LoadInterface() { ui.AddUiFromResource("UIManagerLayout.xml"); Gtk.Window.DefaultIconName = "tomboy"; Gtk.ImageMenuItem imageitem = Tomboy.ActionManager.GetWidget( "/MainWindowMenubar/FileMenu/FileMenuNewNotePlaceholder/NewNote") as Gtk.ImageMenuItem; if (imageitem != null) { if (imageitem is Gtk.ImageMenuItem) { Gtk.ImageMenuItem imageItem = imageitem as Gtk.ImageMenuItem; (imageItem.Image as Gtk.Image).Pixbuf = newNote; } } imageitem = Tomboy.ActionManager.GetWidget( "/TrayIconMenu/TrayNewNotePlaceholder/TrayNewNote") as Gtk.ImageMenuItem; if (imageitem != null) { if (imageitem is Gtk.ImageMenuItem) { Gtk.ImageMenuItem imageItem = imageitem as Gtk.ImageMenuItem; (imageItem.Image as Gtk.Image).Pixbuf = newNote; } } }
public void ShowContextMenu(ActionItem aitem) { ActionToolItem menuItem = aitem as ActionToolItem; Gtk.Menu m = new Gtk.Menu(); Gtk.MenuItem item = new Gtk.MenuItem(Catalog.GetString("Insert Before")); m.Add(item); item.Activated += delegate(object s, EventArgs a) { InsertActionAt(menuItem, false, false); }; item = new Gtk.MenuItem(Catalog.GetString("Insert After")); m.Add(item); item.Activated += delegate(object s, EventArgs a) { InsertActionAt(menuItem, true, false); }; item = new Gtk.MenuItem(Catalog.GetString("Insert Separator Before")); m.Add(item); item.Activated += delegate(object s, EventArgs a) { InsertActionAt(menuItem, false, true); }; item = new Gtk.MenuItem(Catalog.GetString("Insert Separator After")); m.Add(item); item.Activated += delegate(object s, EventArgs a) { InsertActionAt(menuItem, true, true); }; m.Add(new Gtk.SeparatorMenuItem()); item = new Gtk.ImageMenuItem(Gtk.Stock.Cut, null); m.Add(item); item.Activated += delegate(object s, EventArgs a) { menuItem.Cut(); }; item = new Gtk.ImageMenuItem(Gtk.Stock.Copy, null); m.Add(item); item.Activated += delegate(object s, EventArgs a) { menuItem.Copy(); }; item = new Gtk.ImageMenuItem(Gtk.Stock.Paste, null); m.Add(item); item.Activated += delegate(object s, EventArgs a) { Paste(menuItem); }; item = new Gtk.ImageMenuItem(Gtk.Stock.Delete, null); m.Add(item); item.Activated += delegate(object s, EventArgs a) { menuItem.Delete(); }; m.ShowAll(); m.Popup(); }
public override void OnNoteOpened() { item = new Gtk.ImageMenuItem(Catalog.GetString("Export to HTML")); item.Image = new Gtk.Image(Gtk.Stock.Save, Gtk.IconSize.Menu); item.Activated += ExportButtonClicked; item.Show(); AddPluginMenuItem(item); }
public override void OnNoteOpened () { item = new Gtk.ImageMenuItem (Catalog.GetString ("Export to HTML")); item.Image = new Gtk.Image (Gtk.Stock.Save, Gtk.IconSize.Menu); item.Activated += ExportButtonClicked; item.Show (); AddPluginMenuItem (item); }
public override Gtk.MenuItem GetMenuItem () { Gtk.MenuItem item; if (icon != null) item = new Gtk.ImageMenuItem (icon, accelGroup); else item = new Gtk.MenuItem (label); item.Activated += OnClicked; return item; }
public override void OnNoteOpened() { item = new Gtk.ImageMenuItem(Catalog.GetString("Print")); item.Image = new Gtk.Image(Gtk.Stock.Print, Gtk.IconSize.Menu); item.Activated += PrintButtonClicked; item.AddAccelerator("activate", Window.AccelGroup, (uint)Gdk.Key.p, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); item.Show(); AddPluginMenuItem(item); }
public override void OnNoteOpened () { item = new Gtk.ImageMenuItem (Catalog.GetString ("Print")); item.Image = new Gtk.Image (Gtk.Stock.Print, Gtk.IconSize.Menu); item.Activated += PrintButtonClicked; item.AddAccelerator ("activate", Window.AccelGroup, (uint) Gdk.Key.p, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); item.Show (); AddPluginMenuItem (item); }
Gtk.Menu GetRightClickMenu() { if (tray.TomboyTrayMenu != null) { tray.TomboyTrayMenu.Hide(); } if (context_menu != null) { context_menu.Hide(); return(context_menu); } context_menu = new Gtk.Menu(); Gtk.AccelGroup accel_group = new Gtk.AccelGroup(); context_menu.AccelGroup = accel_group; Gtk.ImageMenuItem item; sync_menu_item = new Gtk.ImageMenuItem(Catalog.GetString("S_ynchronize Notes")); sync_menu_item.Image = new Gtk.Image(Gtk.Stock.Convert, Gtk.IconSize.Menu); UpdateMenuItems(); Preferences.SettingChanged += Preferences_SettingChanged; sync_menu_item.Activated += SyncNotes; context_menu.Append(sync_menu_item); context_menu.Append(new Gtk.SeparatorMenuItem()); item = new Gtk.ImageMenuItem(Catalog.GetString("_Preferences")); item.Image = new Gtk.Image(Gtk.Stock.Preferences, Gtk.IconSize.Menu); item.Activated += ShowPreferences; context_menu.Append(item); item = new Gtk.ImageMenuItem(Catalog.GetString("_Help")); item.Image = new Gtk.Image(Gtk.Stock.Help, Gtk.IconSize.Menu); item.Activated += ShowHelpContents; context_menu.Append(item); item = new Gtk.ImageMenuItem(Catalog.GetString("_About Tomboy")); item.Image = new Gtk.Image(Gtk.Stock.About, Gtk.IconSize.Menu); item.Activated += ShowAbout; context_menu.Append(item); context_menu.Append(new Gtk.SeparatorMenuItem()); item = new Gtk.ImageMenuItem(Catalog.GetString("_Quit")); item.Image = new Gtk.Image(Gtk.Stock.Quit, Gtk.IconSize.Menu); item.Activated += Quit; context_menu.Append(item); context_menu.ShowAll(); return(context_menu); }
public static Gtk.MenuItem MakeMenuItem (Gtk.Menu menu, string label, string image_name, EventHandler e, bool enabled) { Gtk.ImageMenuItem i = new Gtk.ImageMenuItem (label); i.Activated += e; i.Sensitive = enabled; i.Image = Gtk.Image.NewFromIconName (image_name, Gtk.IconSize.Menu); menu.Append (i); i.Show (); return i; }
public static Gtk.MenuItem MakeMenuItem(Gtk.Menu menu, string label, string image_name, EventHandler e, bool enabled) { Gtk.ImageMenuItem i = new Gtk.ImageMenuItem(label); i.Activated += e; i.Sensitive = enabled; i.Image = Gtk.Image.NewFromIconName(image_name, Gtk.IconSize.Menu); menu.Append(i); i.Show(); return(i); }
public override void OnNoteOpened () { menu = new Gtk.Menu (); menu.Hidden += OnMenuHidden; menu.ShowAll (); menu_item = new Gtk.ImageMenuItem ( Catalog.GetString ("What links here?")); menu_item.Image = new Gtk.Image (Gtk.Stock.JumpTo, Gtk.IconSize.Menu); menu_item.Submenu = menu; menu_item.Activated += OnMenuItemActivated; menu_item.Show (); AddPluginMenuItem (menu_item); }
public override void OnNoteOpened() { menu = new Gtk.Menu(); menu.Hidden += OnMenuHidden; menu.ShowAll(); menu_item = new Gtk.ImageMenuItem( Catalog.GetString("What links here?")); menu_item.Image = new Gtk.Image(Gtk.Stock.JumpTo, Gtk.IconSize.Menu); menu_item.Submenu = menu; menu_item.Activated += OnMenuItemActivated; menu_item.Show(); AddPluginMenuItem(menu_item); }
public virtual Gtk.MenuItem GetMenuItem(object parent) { Gtk.MenuItem item; if (icon == null) { item = new Gtk.MenuItem(_label != null ? Catalog.GetString(_label) : Id); } else { item = new Gtk.ImageMenuItem(_label != null ? Catalog.GetString(_label) : Id); (item as Gtk.ImageMenuItem).Image = Gtk.Image.NewFromIconName(icon, Gtk.IconSize.Menu); } return(item); }
protected virtual void OnTabMenuShown(object sender, EventArgs e) { Trace.Call(sender, e); foreach (var child in _TabMenu.Children) { _TabMenu.Remove(child); } var closeItem = new Gtk.ImageMenuItem(Gtk.Stock.Close, null); closeItem.Activated += OnTabMenuCloseActivated; _TabMenu.Append(closeItem); _TabMenu.ShowAll(); }
public override Gtk.MenuItem GetMenuItem() { Gtk.MenuItem item; if (icon != null) { item = new Gtk.ImageMenuItem(icon, accelGroup); } else { item = new Gtk.MenuItem(label); } item.Activated += OnClicked; return(item); }
public ProtocolChatView(ChatModel chat) : base(chat) { Trace.Call(chat); ProxySettings = new ProxySettings(); Add(OutputScrolledWindow); ReconnectItem = new Gtk.ImageMenuItem(_("Reconnect")); ReconnectItem.Image = new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Menu); ReconnectItem.Activated += new EventHandler(OnTabMenuReconnectActivated); ShowAll(); }
public override void Initialize () { // Translators: a 'sketch' is a quick drawing menu_item = new Gtk.ImageMenuItem ( Catalog.GetString ("Add a sketch")); // FIXME: Use a real Sketching icon instead of the Edit icon menu_item.Image = new Gtk.Image (Gtk.Stock.Edit, Gtk.IconSize.Menu); menu_item.Activated += OnMenuItemActivated; menu_item.Show (); AddPluginMenuItem (menu_item); if (!Note.TagTable.IsDynamicTagRegistered ("sketch")) Note.TagTable.RegisterDynamicTag ("sketch", typeof (SketchingTextTag)); }
public virtual Gtk.MenuItem GetMenuItem(object parent) { // FIXME, Right now we are just passing the label back as is Gtk.MenuItem item; if (icon == null) { item = new Gtk.MenuItem(_label != null ? Catalog.GetString(_label) : Id); } else { item = new Gtk.ImageMenuItem(_label != null ? Catalog.GetString(_label) : Id); (item as Gtk.ImageMenuItem).Image = Gtk.Image.NewFromIconName(icon, Gtk.IconSize.Menu); } return(item); }
public override void OnNoteOpened() { // Add the menu item when the window is created. menu_item = new Gtk.ImageMenuItem ( Catalog.GetString ("Word count")); menu_item.Image = new Gtk.Image (Gtk.Stock.Index, Gtk.IconSize.Menu); menu_item.Activated += OnMenuItemActivated; menu_item.AddAccelerator ("activate", Window.AccelGroup, (uint) Gdk.Key.o, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); menu_item.Show (); AddPluginMenuItem (menu_item); }
public override void Initialize() { // Translators: a 'sketch' is a quick drawing menu_item = new Gtk.ImageMenuItem( Catalog.GetString("Add a sketch")); // FIXME: Use a real Sketching icon instead of the Edit icon menu_item.Image = new Gtk.Image(Gtk.Stock.Edit, Gtk.IconSize.Menu); menu_item.Activated += OnMenuItemActivated; menu_item.Show(); AddPluginMenuItem(menu_item); if (!Note.TagTable.IsDynamicTagRegistered("sketch")) { Note.TagTable.RegisterDynamicTag("sketch", typeof(SketchingTextTag)); } }
internal override Gtk.MenuItem CreateMenuItem(CommandManager manager) { Gtk.ImageMenuItem item = new Gtk.ImageMenuItem(text != null ? text : url); item.Image = new ImageView(icon, Gtk.IconSize.Menu); item.Activated += new EventHandler(HandleActivation); item.Selected += delegate { CommandInfo ci = new CommandInfo(Text); ci.Icon = icon; ci.Description = AddinManager.CurrentLocalizer.GetString("Open {0}", Url); manager.NotifySelected(ci); }; item.Deselected += delegate { manager.NotifyDeselected(); }; return(item); }
internal protected override Gtk.MenuItem CreateMenuItem (CommandManager manager) { Gtk.ImageMenuItem item = new Gtk.ImageMenuItem (text != null ? text : url); item.Image = new Gtk.Image (icon, Gtk.IconSize.Menu); item.Activated += new EventHandler (HandleActivation); item.Selected += delegate { CommandInfo ci = new CommandInfo (Text); ci.Icon = icon; ci.Description = AddinManager.CurrentLocalizer.GetString ("Open {0}", Url); manager.NotifySelected (ci); }; item.Deselected += delegate { manager.NotifyDeselected (); }; return item; }
static Gtk.MenuItem CreateMenuItem (ContextMenuItem item) { if (!item.Visible) return null; if (item.IsSeparator) { return new Gtk.SeparatorMenuItem (); } Gtk.MenuItem menuItem; if (item is RadioButtonContextMenuItem) { var radioItem = (RadioButtonContextMenuItem)item; menuItem = new Gtk.CheckMenuItem (item.Label) { Active = radioItem.Checked, DrawAsRadio = true }; } else if (item is CheckBoxContextMenuItem) { var checkItem = (CheckBoxContextMenuItem)item; menuItem = new Gtk.CheckMenuItem (item.Label) { Active = checkItem.Checked }; } else { menuItem = new Gtk.ImageMenuItem (item.Label); } if (item.SubMenu != null && item.SubMenu.Items.Count > 0) { menuItem.Submenu = FromMenu (item.SubMenu); } else { menuItem.Activated += (sender, e) => item.Click (); } menuItem.Sensitive = item.Sensitive; var label = (Gtk.Label) menuItem.Child; label.UseUnderline = item.UseMnemonic; if (item.UseMnemonic) label.TextWithMnemonic = item.Label; if (item.Image != null) { Gtk.ImageMenuItem imageItem = menuItem as Gtk.ImageMenuItem; if (imageItem != null) { var img = new ImageView (item.Image); img.ShowAll (); imageItem.Image = img; GtkWorkarounds.ForceImageOnMenuItem (imageItem); } } return menuItem; }
protected override bool OnPopupMenu() { Gtk.Menu mnu = new Gtk.Menu(); Gtk.ImageMenuItem play = new Gtk.ImageMenuItem(Gtk.Stock.MediaPlay, null); play.Activated += delegate(object sender, EventArgs a) { _view.PlayAlbum((CS_AlbumInfo)this.Model[Selection.FirstIndex]); }; Gtk.ImageMenuItem edit = new Gtk.ImageMenuItem(Gtk.Stock.Edit, null); edit.Activated += delegate(object sender, EventArgs a) { _view.EditSheet(((CS_AlbumInfo)this.Model[Selection.FirstIndex]).getSheet()); }; Gtk.ImageMenuItem show_file = new Gtk.ImageMenuItem("Show in filesystem"); show_file.Image = new Gtk.Image(Gtk.Stock.Directory, Gtk.IconSize.Menu); show_file.Activated += delegate(object sender, EventArgs a) { _view.OpenContainingFolder((CS_AlbumInfo)this.Model[Selection.FirstIndex]); }; mnu.Append(play); mnu.Append(new Gtk.SeparatorMenuItem()); mnu.Append(edit); mnu.Append(show_file); CueSheet s = ((CS_AlbumInfo)this.Model[Selection.FirstIndex]).getSheet(); if (Mp3Split.DllPresent()) { if (Mp3Split.IsSupported(s.musicFileName())) { Gtk.ImageMenuItem split = new Gtk.ImageMenuItem("Split & Write to location"); split.Image = new Gtk.Image(Gtk.Stock.Convert, Gtk.IconSize.Menu); split.Activated += delegate(object sender, EventArgs a) { _view.MusicFileToDevice(((CS_AlbumInfo)this.Model[Selection.FirstIndex]).getSheet()); }; mnu.Append(split); } } mnu.ShowAll(); mnu.Popup(); return(false); }
public void SetImage(object imageBackend) { Gtk.ImageMenuItem it = item as Gtk.ImageMenuItem; if (it == null) { return; } if (imageBackend != null) { var img = new Gtk.Image((Gdk.Pixbuf)imageBackend); img.ShowAll(); it.Image = img; } else { it.Image = null; } }
void UpdateMenu() { // // Clear out the old list // foreach (Gtk.MenuItem oldItem in menu.Children) { menu.Remove(oldItem); } // // Build a new menu // // Add the "New Notebook..." Gtk.ImageMenuItem newNotebookMenuItem = new Gtk.ImageMenuItem(Catalog.GetString("_New notebook...")); newNotebookMenuItem.Image = new Gtk.Image(NewNotebookIcon); newNotebookMenuItem.Activated += OnNewNotebookMenuItem; newNotebookMenuItem.Show(); menu.Append(newNotebookMenuItem); // Add the "(no notebook)" item at the top of the list NotebookMenuItem noNotebookMenuItem = new NotebookMenuItem(Note, null); noNotebookMenuItem.ShowAll(); menu.Append(noNotebookMenuItem); // Add in all the real notebooks List <NotebookMenuItem> notebookMenuItems = GetNotebookMenuItems(); if (notebookMenuItems.Count > 0) { Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem(); separator.ShowAll(); menu.Append(separator); foreach (NotebookMenuItem item in GetNotebookMenuItems()) { item.ShowAll(); menu.Append(item); } } }
private void _OnOutputMessageTextViewPopulatePopup(object o, Gtk.PopulatePopupArgs args) { if (OutputMessageTextView.IsAtUrlTag) { return; } Gtk.Menu popup = args.Menu; // minimum version of any command below if (Frontend.EngineProtocolVersion < new Version(0, 8, 11)) { return; } popup.Append(new Gtk.SeparatorMenuItem()); if (Frontend.EngineProtocolVersion >= new Version(0, 8, 12)) { Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois")); whois_item.Activated += _OnMenuWhoisItemActivated; popup.Append(whois_item); } if (Frontend.EngineProtocolVersion >= new Version(0, 8, 11)) { Gtk.ImageMenuItem AddToContacts_item = new Gtk.ImageMenuItem(_("Add To Contacts")); AddToContacts_item.Activated += _OnMenuAddToContactsItemActivated; popup.Append(AddToContacts_item); } if (Frontend.EngineProtocolVersion >= new Version(0, 8, 12)) { Gtk.ImageMenuItem invite_to_item = new Gtk.ImageMenuItem(_("Invite to")); Gtk.Menu invite_to_menu_item = new InviteToMenu(XmppProtocolManager, Frontend.MainWindow.ChatViewManager, PersonModel); invite_to_item.Submenu = invite_to_menu_item; popup.Append(invite_to_item); } popup.ShowAll(); }
public void SetImage(ImageDescription image) { Gtk.ImageMenuItem it = item as Gtk.ImageMenuItem; if (it == null) { return; } if (!image.IsNull) { var img = new ImageBox(context, image); img.ShowAll(); it.Image = img; GtkWorkarounds.ForceImageOnMenuItem(it); } else { it.Image = null; } }
public DamageControlTrayIcon() { Gtk.Application.Init(); this.icon = new TrayIcon("DamageControl Monitor"); InitializeSettings(); Gtk.EventBox eb = new Gtk.EventBox(); eb.ButtonPressEvent += new Gtk.ButtonPressEventHandler(IconClicked); pixbuf = new Gdk.Pixbuf(null, "gray-24.png"); image = new Gtk.Image(pixbuf); eb.Add(image); this.menu = new Gtk.Menu(); this.projects = MonoTray.LoadSettings(); foreach (Project p in this.projects) { p.StartPolling(); } Gtk.AccelGroup ac_quit = new Gtk.AccelGroup(); Gtk.ImageMenuItem it_quit = new Gtk.ImageMenuItem(Gtk.Stock.Quit, ac_quit); it_quit.Activated += new EventHandler(QuitSelected); Gtk.AccelGroup ac_settings = new Gtk.AccelGroup(); Gtk.ImageMenuItem it_settings = new Gtk.ImageMenuItem(Gtk.Stock.Preferences, ac_settings); it_settings.Activated += new EventHandler(SettingsSelected); menu.Append(it_settings); menu.Append(it_quit); this.icon.Add(eb); this.icon.ShowAll(); UpdateProxy(); UpdateProjectList(); Gtk.Application.Run(); }
protected override void OnPersonMenuShown(object sender, EventArgs e) { Trace.Call(sender, e); foreach (var child in PersonMenu.Children) { PersonMenu.Remove(child); } base.OnPersonMenuShown(sender, e); Gtk.MenuItem item; if (Frontend.EngineProtocolVersion >= new Version(0, 7)) { item = new Gtk.ImageMenuItem(_("Direct Message")); item.Activated += OnUserListMenuDirectMessageActivated; PersonMenu.Append(item); PersonMenu.Append(new Gtk.SeparatorMenuItem()); } if (Frontend.EngineProtocolVersion >= new Version(0, 10)) { item = new Gtk.ImageMenuItem(_("Timeline")); item.Activated += OnUserListMenuTimelineActivated; PersonMenu.Append(item); if (ID == TwitterChatType.FriendsTimeline.ToString()) { item = new Gtk.ImageMenuItem(_("Unfollow")); item.Activated += OnUserListMenuUnfollowActivated; PersonMenu.Append(item); } else { item = new Gtk.ImageMenuItem(_("Follow")); item.Activated += OnUserListMenuFollowActivated; PersonMenu.Append(item); } } PersonMenu.ShowAll(); }
protected override bool OnPopupMenu() { Gtk.Menu mnu=new Gtk.Menu(); Gtk.ImageMenuItem play=new Gtk.ImageMenuItem(Gtk.Stock.MediaPlay,null); play.Activated+=delegate(object sender,EventArgs a) { _view.PlayAlbum((CS_AlbumInfo) this.Model[Selection.FirstIndex]); }; Gtk.ImageMenuItem edit=new Gtk.ImageMenuItem(Gtk.Stock.Edit,null); edit.Activated+=delegate(object sender,EventArgs a) { _view.EditSheet(((CS_AlbumInfo) this.Model[Selection.FirstIndex]).getSheet ()); }; Gtk.ImageMenuItem show_file=new Gtk.ImageMenuItem("Show in filesystem"); show_file.Image=new Gtk.Image(Gtk.Stock.Directory,Gtk.IconSize.Menu); show_file.Activated+=delegate(object sender, EventArgs a) { _view.OpenContainingFolder((CS_AlbumInfo) this.Model[Selection.FirstIndex]); }; mnu.Append (play); mnu.Append (new Gtk.SeparatorMenuItem()); mnu.Append (edit); mnu.Append (show_file); CueSheet s=((CS_AlbumInfo) this.Model[Selection.FirstIndex]).getSheet (); if (Mp3Split.DllPresent()) { if (Mp3Split.IsSupported(s.musicFileName ())) { Gtk.ImageMenuItem split=new Gtk.ImageMenuItem("Split & Write to location"); split.Image=new Gtk.Image(Gtk.Stock.Convert,Gtk.IconSize.Menu); split.Activated+=delegate(object sender,EventArgs a) { _view.MusicFileToDevice(((CS_AlbumInfo) this.Model[Selection.FirstIndex]).getSheet ()); }; mnu.Append (split); } } mnu.ShowAll (); mnu.Popup(); return false; }
public static Gtk.MenuItem MakeMenuItem(Gtk.Menu menu, string l, EventHandler e, bool enabled) { Gtk.MenuItem i; Gtk.StockItem item = Gtk.StockItem.Zero; if (Gtk.StockManager.Lookup (l, ref item)) { i = new Gtk.ImageMenuItem (l, new Gtk.AccelGroup ()); } else { i = new Gtk.MenuItem (l); } if (e != null) i.Activated += e; i.Sensitive = enabled; menu.Append (i); i.Show (); return i; }
public override void Initialize () { // Don't add item to tools menu if Sticky Notes XML file does not // exist. Only check for the file once, since Initialize is called // for each note when Tomboy starts up. if (sticky_file_might_exist) { if (sticky_file_existence_confirmed || File.Exists (sticky_xml_path)) { item = new Gtk.ImageMenuItem ( Catalog.GetString ("Import from Sticky Notes")); item.Image = new Gtk.Image (Gtk.Stock.Convert, Gtk.IconSize.Menu); item.Activated += ImportButtonClicked; item.Show (); AddPluginMenuItem (item); sticky_file_existence_confirmed = true; CheckForFirstRun (); } else { sticky_file_might_exist = false; Logger.Debug (debug_no_sticky_file); } } }
protected override void OnPersonMenuShown(object sender, EventArgs e) { Trace.Call(sender, e); foreach (var child in PersonMenu.Children) { PersonMenu.Remove(child); } base.OnPersonMenuShown(sender, e); Gtk.MenuItem item; if (Frontend.EngineVersion >= new Version(0, 7)) { item = new Gtk.ImageMenuItem(_("Direct Message")); item.Activated += OnUserListMenuDirectMessageActivated; PersonMenu.Append(item); PersonMenu.Append(new Gtk.SeparatorMenuItem()); } if (Frontend.EngineVersion >= new Version(0, 10)) { item = new Gtk.ImageMenuItem(_("Timeline")); item.Activated += OnUserListMenuTimelineActivated; PersonMenu.Append(item); if (ID == TwitterChatType.FriendsTimeline.ToString()) { item = new Gtk.ImageMenuItem(_("Unfollow")); item.Activated += OnUserListMenuUnfollowActivated; PersonMenu.Append(item); } else { item = new Gtk.ImageMenuItem(_("Follow")); item.Activated += OnUserListMenuFollowActivated; PersonMenu.Append(item); } } PersonMenu.ShowAll(); }
protected override void OnPersonMenuShown(object sender, EventArgs e) { Trace.Call(sender, e); foreach (var child in PersonMenu.Children) { PersonMenu.Remove(child); } base.OnPersonMenuShown(sender, e); // minimum version of any command below if (Frontend.EngineVersion < new Version(0, 8, 9)) { return; } if (Frontend.EngineVersion >= new Version(0, 8, 9)) { Gtk.ImageMenuItem query_item = new Gtk.ImageMenuItem(_("Query")); query_item.Activated += _OnUserListMenuQueryActivated; PersonMenu.Append(query_item); } PersonMenu.Append(new Gtk.SeparatorMenuItem()); if (Frontend.EngineVersion >= new Version(0, 8, 12)) { Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois")); whois_item.Activated += _OnUserListMenuWhoisActivated; PersonMenu.Append(whois_item); } if (!IsContactList && Frontend.EngineVersion >= new Version(0, 8, 11)) { var add_to_contacts_item = new Gtk.ImageMenuItem(_("Add To Contacts")); add_to_contacts_item.Activated += _OnMenuAddToContactsItemActivated; PersonMenu.Append(add_to_contacts_item); } if (Frontend.EngineVersion >= new Version(0, 8, 12)) { Gtk.MenuItem invite_to_item = new Gtk.MenuItem(_("Invite to")); Gtk.Menu invite_to_menu_item = new InviteToMenu( XmppProtocolManager, Frontend.MainWindow.ChatViewManager, GetSelectedPersons() ); invite_to_item.Submenu = invite_to_menu_item; PersonMenu.Append(invite_to_item); } if (IsContactList && Frontend.EngineVersion >= new Version(0, 8, 11)) { // cleanup old handlers IdentityNameCellRenderer.EditingStarted -= OnPersonRenameEditingStarted; IdentityNameCellRenderer.Edited -= OnPersonRenameEdited; IdentityNameCellRenderer.EditingStarted += OnPersonRenameEditingStarted; IdentityNameCellRenderer.Edited += OnPersonRenameEdited; var rename_item = new Gtk.ImageMenuItem(_("Rename")); rename_item.Activated += (o, args) => { var paths = PersonTreeView.Selection.GetSelectedRows(); if (paths == null || paths.Length == 0) { return; } var path = paths[0]; IdentityNameCellRenderer.Editable = true; PersonTreeView.SetCursor(path, IdentityNameColumn, true); }; PersonMenu.Append(rename_item); } PersonMenu.ShowAll(); }
IEnumerable<Gtk.MenuItem> CreateContextMenuItems() { Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois")); whois_item.Activated += OnMenuWhoisItemActivated; yield return whois_item; Gtk.ImageMenuItem ctcp_item = new Gtk.ImageMenuItem(_("CTCP")); Gtk.Menu ctcp_menu_item = new CtcpMenu(IrcProtocolManager, Frontend.MainWindow.ChatViewManager, PersonModel); ctcp_item.Submenu = ctcp_menu_item; yield return ctcp_item; Gtk.ImageMenuItem invite_to_item = new Gtk.ImageMenuItem(_("Invite to")); Gtk.Menu invite_to_menu_item = new InviteToMenu(IrcProtocolManager, Frontend.MainWindow.ChatViewManager, PersonModel); invite_to_item.Submenu = invite_to_menu_item; yield return invite_to_item; }
public void ShowContextMenu(ActionItem aitem) { ActionMenuItem menuItem = (ActionMenuItem) aitem; Gtk.Menu m = new Gtk.Menu (); Gtk.MenuItem item = new Gtk.MenuItem (Catalog.GetString ("Insert Before")); m.Add (item); item.Activated += delegate (object s, EventArgs a) { InsertActionAt (menuItem, false, false); }; item = new Gtk.MenuItem (Catalog.GetString ("Insert After")); m.Add (item); item.Activated += delegate (object s, EventArgs a) { InsertActionAt (menuItem, true, false); }; m.Add (new Gtk.SeparatorMenuItem ()); item = new Gtk.ImageMenuItem (Gtk.Stock.Cut, null); m.Add (item); item.Activated += delegate (object s, EventArgs a) { menuItem.Cut (); }; item.Visible = false; // No copy & paste for now item = new Gtk.ImageMenuItem (Gtk.Stock.Copy, null); m.Add (item); item.Activated += delegate (object s, EventArgs a) { menuItem.Copy (); }; item.Visible = false; // No copy & paste for now item = new Gtk.ImageMenuItem (Gtk.Stock.Paste, null); m.Add (item); item.Activated += delegate (object s, EventArgs a) { Paste (menuItem); }; item.Visible = false; // No copy & paste for now item = new Gtk.ImageMenuItem (Gtk.Stock.Delete, null); m.Add (item); item.Activated += delegate (object s, EventArgs a) { menuItem.Delete (); }; m.ShowAll (); m.Popup (); }
protected override void OnPersonMenuShown(object sender, EventArgs e) { Trace.Call(sender, e); foreach (var child in PersonMenu.Children) { PersonMenu.Remove(child); } base.OnPersonMenuShown(sender, e); Gtk.ImageMenuItem op_item = new Gtk.ImageMenuItem(_("Op")); op_item.Activated += _OnUserListMenuOpActivated; PersonMenu.Append(op_item); Gtk.ImageMenuItem deop_item = new Gtk.ImageMenuItem(_("Deop")); deop_item.Activated += _OnUserListMenuDeopActivated; PersonMenu.Append(deop_item); Gtk.ImageMenuItem voice_item = new Gtk.ImageMenuItem(_("Voice")); voice_item.Activated += _OnUserListMenuVoiceActivated; PersonMenu.Append(voice_item); Gtk.ImageMenuItem devoice_item = new Gtk.ImageMenuItem(_("Devoice")); devoice_item.Activated += _OnUserListMenuDevoiceActivated; PersonMenu.Append(devoice_item); Gtk.ImageMenuItem kick_item = new Gtk.ImageMenuItem(_("Kick")); kick_item.Activated += _OnUserListMenuKickActivated; PersonMenu.Append(kick_item); Gtk.ImageMenuItem kickban_item = new Gtk.ImageMenuItem(_("Kick + Ban")); kickban_item.Activated += _OnUserListMenuKickBanActivated; PersonMenu.Append(kickban_item); Gtk.ImageMenuItem ban_item = new Gtk.ImageMenuItem(_("Ban")); ban_item.Activated += _OnUserListMenuBanActivated; PersonMenu.Append(ban_item); Gtk.ImageMenuItem unban_item = new Gtk.ImageMenuItem(_("Unban")); unban_item.Activated += _OnUserListMenuUnbanActivated; PersonMenu.Append(unban_item); PersonMenu.Append(new Gtk.SeparatorMenuItem()); Gtk.ImageMenuItem query_item = new Gtk.ImageMenuItem(_("Query")); query_item.Activated += _OnUserListMenuQueryActivated; PersonMenu.Append(query_item); Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois")); whois_item.Activated += _OnUserListMenuWhoisActivated; PersonMenu.Append(whois_item); Gtk.MenuItem ctcp_item = new Gtk.MenuItem(_("CTCP")); Gtk.Menu ctcp_menu = new CtcpMenu( _IrcProtocolManager, Frontend.MainWindow.ChatViewManager, GetSelectedPersons() ); ctcp_item.Submenu = ctcp_menu; PersonMenu.Append(ctcp_item); Gtk.MenuItem invite_to_item = new Gtk.MenuItem(_("Invite to")); Gtk.Menu invite_to_menu_item = new InviteToMenu( _IrcProtocolManager, Frontend.MainWindow.ChatViewManager, GetSelectedPersons() ); invite_to_item.Submenu = invite_to_menu_item; PersonMenu.Append(invite_to_item); PersonMenu.ShowAll(); }
protected virtual void OnTabMenuShown(object sender, EventArgs e) { Trace.Call(sender, e); foreach (var child in _TabMenu.Children) { _TabMenu.Remove(child); } var closeItem = new Gtk.ImageMenuItem(Gtk.Stock.Close, null); closeItem.Activated += OnTabMenuCloseActivated; _TabMenu.Append(closeItem); _TabMenu.ShowAll(); }
protected override void OnShown() { Trace.Call(); if (!IsPopulated) { IsPopulated = true; foreach (var chatView in ChatViewManager.Chats) { if (!(chatView is GroupChatView)) { // only invite to group chats continue; } if (chatView == ChatViewManager.ActiveChat) { // don't need to add current chat to invite list continue; } if (chatView.ProtocolManager != ProtocolManager) { // only add chats from current server continue; } var item = new Gtk.ImageMenuItem(chatView.Name); item.Image = new Gtk.Image(GroupChatView.IconPixbuf); // HACK: anonymous methods inside foreach loops needs this var chat = chatView; item.Activated += delegate { OnItemActivated(chat); }; item.Show(); Append(item); } } base.OnShown(); }
private static void OnStatusIconPopupMenu(object sender, EventArgs e) { Trace.Call(sender, e); Gtk.Menu menu = new Gtk.Menu(); Gtk.ImageMenuItem preferencesItem = new Gtk.ImageMenuItem(Gtk.Stock.Preferences, null); preferencesItem.Activated += delegate { try { PreferencesDialog dialog = new PreferencesDialog(_MainWindow); dialog.CurrentPage = PreferencesDialog.Page.Interface; dialog.CurrentInterfacePage = PreferencesDialog.InterfacePage.Notification; } catch (Exception ex) { ShowException(ex); } }; menu.Add(preferencesItem); menu.Add(new Gtk.SeparatorMenuItem()); Gtk.ImageMenuItem quitItem = new Gtk.ImageMenuItem(Gtk.Stock.Quit, null); quitItem.Activated += delegate { try { Quit(); } catch (Exception ex) { ShowException(ex); } }; menu.Add(quitItem); menu.ShowAll(); menu.Popup(); }
public virtual Gtk.MenuItem GetMenuItem(object parent) { Gtk.MenuItem item; if (icon == null) item = new Gtk.MenuItem (_label != null ? Catalog.GetString (_label) : Id); else { item = new Gtk.ImageMenuItem (_label != null ? Catalog.GetString (_label) : Id); (item as Gtk.ImageMenuItem).Image = Gtk.Image.NewFromIconName (icon, Gtk.IconSize.Menu); } return item; }
public IrcGroupChatView(GroupChatModel groupChat) : base(groupChat) { Trace.Call(groupChat); //_IrcGroupChatModel = ircGroupChat; _IrcProtocolManager = (IrcProtocolManager) groupChat.ProtocolManager; if (PersonMenu != null) { Gtk.ImageMenuItem op_item = new Gtk.ImageMenuItem(_("Op")); op_item.Activated += new EventHandler(_OnUserListMenuOpActivated); PersonMenu.Append(op_item); Gtk.ImageMenuItem deop_item = new Gtk.ImageMenuItem(_("Deop")); deop_item.Activated += new EventHandler(_OnUserListMenuDeopActivated); PersonMenu.Append(deop_item); Gtk.ImageMenuItem voice_item = new Gtk.ImageMenuItem(_("Voice")); voice_item.Activated += new EventHandler(_OnUserListMenuVoiceActivated); PersonMenu.Append(voice_item); Gtk.ImageMenuItem devoice_item = new Gtk.ImageMenuItem(_("Devoice")); devoice_item.Activated += new EventHandler(_OnUserListMenuDevoiceActivated); PersonMenu.Append(devoice_item); Gtk.ImageMenuItem kick_item = new Gtk.ImageMenuItem(_("Kick")); kick_item.Activated += new EventHandler(_OnUserListMenuKickActivated); PersonMenu.Append(kick_item); Gtk.ImageMenuItem kickban_item = new Gtk.ImageMenuItem(_("Kick + Ban")); kickban_item.Activated += new EventHandler(_OnUserListMenuKickBanActivated); PersonMenu.Append(kickban_item); Gtk.ImageMenuItem ban_item = new Gtk.ImageMenuItem(_("Ban")); ban_item.Activated += new EventHandler(_OnUserListMenuBanActivated); PersonMenu.Append(ban_item); Gtk.ImageMenuItem unban_item = new Gtk.ImageMenuItem(_("Unban")); unban_item.Activated += new EventHandler(_OnUserListMenuUnbanActivated); PersonMenu.Append(unban_item); PersonMenu.Append(new Gtk.SeparatorMenuItem()); Gtk.ImageMenuItem query_item = new Gtk.ImageMenuItem(_("Query")); query_item.Activated += new EventHandler(_OnUserListMenuQueryActivated); PersonMenu.Append(query_item); Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois")); whois_item.Activated += _OnUserListMenuWhoisActivated; PersonMenu.Append(whois_item); } if (PersonTreeView != null) { Gtk.CellRendererText cellr = new Gtk.CellRendererText(); cellr.WidthChars = 1; Gtk.TreeViewColumn column = new Gtk.TreeViewColumn(String.Empty, cellr); column.Spacing = 0; column.SortIndicator = false; column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly; column.SetCellDataFunc(cellr, new Gtk.TreeCellDataFunc(_RenderIrcGroupPersonMode)); PersonTreeView.AppendColumn(column); PersonTreeView.MoveColumnAfter(IdentityNameColumn, column); } }
void UpdateMenu () { // // Clear out the old list // foreach (Gtk.MenuItem oldItem in menu.Children) { menu.Remove (oldItem); } // // Build a new menu // // Add the "New Notebook..." Gtk.ImageMenuItem newNotebookMenuItem = new Gtk.ImageMenuItem (Catalog.GetString ("_New notebook...")); newNotebookMenuItem.Image = new Gtk.Image (NewNotebookIcon); newNotebookMenuItem.Activated += OnNewNotebookMenuItem; newNotebookMenuItem.Show (); menu.Append (newNotebookMenuItem); // Add the "(no notebook)" item at the top of the list NotebookMenuItem noNotebookMenuItem = new NotebookMenuItem (Note, null); noNotebookMenuItem.ShowAll (); menu.Append (noNotebookMenuItem); // Add in all the real notebooks List<NotebookMenuItem> notebookMenuItems = GetNotebookMenuItems (); if (notebookMenuItems.Count > 0) { Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem (); separator.ShowAll (); menu.Append (separator); foreach (NotebookMenuItem item in GetNotebookMenuItems ()) { item.ShowAll (); menu.Append (item); } } }
public MainWindow() : base("Smuxi") { // restore window size / position int width, heigth; if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"] != null) { width = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"]; } else { width = 800; } if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"] != null) { heigth = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"]; } else { heigth = 600; } if (width == -1 && heigth == -1) { SetDefaultSize(800, 600); Maximize(); } else if (width == 0 && heigth == 0) { // HACK: map 0/0 to default size as it crashes on Windows :/ SetDefaultSize(800, 600); } else { SetDefaultSize(width, heigth); } int x, y; if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"] != null) { x = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"]; } else { x = 0; } if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"] != null) { y = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"]; } else { y = 0; } if (x == 0 && y == 0) { SetPosition(Gtk.WindowPosition.Center); } else { Move(x, y); } DeleteEvent += OnDeleteEvent; FocusInEvent += OnFocusInEvent; FocusOutEvent += OnFocusOutEvent; WindowStateEvent += OnWindowStateEvent; Gtk.AccelGroup agrp = new Gtk.AccelGroup(); Gtk.AccelKey akey; AddAccelGroup(agrp); // Menu _MenuBar = new Gtk.MenuBar(); Gtk.Menu menu; Gtk.MenuItem item; Gtk.ImageMenuItem image_item; // Menu - File menu = new Gtk.Menu(); item = new Gtk.MenuItem(_("_File")); item.Submenu = menu; _MenuBar.Append(item); item = new Gtk.ImageMenuItem(Gtk.Stock.Preferences, agrp); item.Activated += new EventHandler(_OnPreferencesButtonClicked); menu.Append(item); menu.Append(new Gtk.SeparatorMenuItem()); item = new Gtk.ImageMenuItem(Gtk.Stock.Quit, agrp); item.Activated += new EventHandler(_OnQuitButtonClicked); menu.Append(item); // Menu - Server menu = new Gtk.Menu(); item = new Gtk.MenuItem(_("_Server")); item.Submenu = menu; _MenuBar.Append(item); image_item = new Gtk.ImageMenuItem(_("_Quick Connect")); image_item.Image = new Gtk.Image(Gtk.Stock.Connect, Gtk.IconSize.Menu); image_item.Activated += OnServerQuickConnectButtonClicked; menu.Append(image_item); menu.Append(new Gtk.SeparatorMenuItem()); image_item = new Gtk.ImageMenuItem(Gtk.Stock.Add, agrp); image_item.Activated += OnServerAddButtonClicked; menu.Append(image_item); image_item = new Gtk.ImageMenuItem(_("_Manage")); image_item.Image = new Gtk.Image(Gtk.Stock.Edit, Gtk.IconSize.Menu); image_item.Activated += OnServerManageServersButtonClicked; menu.Append(image_item); // Menu - Chat menu = new Gtk.Menu(); item = new Gtk.MenuItem(_("_Chat")); item.Submenu = menu; _MenuBar.Append(item); _OpenChatMenuItem = new Gtk.ImageMenuItem(_("Open / Join Chat")); _OpenChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Open, Gtk.IconSize.Menu); _OpenChatMenuItem.Activated += OnChatOpenChatButtonClicked; _OpenChatMenuItem.Sensitive = false; menu.Append(_OpenChatMenuItem); _FindGroupChatMenuItem = new Gtk.ImageMenuItem(_("_Find Group Chat")); _FindGroupChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Find, Gtk.IconSize.Menu); _FindGroupChatMenuItem.Activated += OnChatFindGroupChatButtonClicked; _FindGroupChatMenuItem.Sensitive = false; menu.Append(_FindGroupChatMenuItem); image_item = new Gtk.ImageMenuItem(_("C_lear All Activity")); image_item.Image = new Gtk.Image(Gtk.Stock.Clear, Gtk.IconSize.Menu); image_item.Activated += OnChatClearAllActivityButtonClicked; menu.Append(image_item); menu.Append(new Gtk.SeparatorMenuItem()); image_item = new Gtk.ImageMenuItem(_("_Next Chat")); image_item.Image = new Gtk.Image(Gtk.Stock.GoForward, Gtk.IconSize.Menu); image_item.Activated += OnNextChatMenuItemActivated; akey = new Gtk.AccelKey(); akey.AccelFlags = Gtk.AccelFlags.Visible; akey.AccelMods = Gdk.ModifierType.ControlMask; akey.Key = Gdk.Key.Page_Down; image_item.AddAccelerator("activate", agrp, akey); menu.Append(image_item); image_item = new Gtk.ImageMenuItem(_("_Previous Chat")); image_item.Image = new Gtk.Image(Gtk.Stock.GoBack, Gtk.IconSize.Menu); image_item.Activated += OnPreviousChatMenuItemActivated; akey = new Gtk.AccelKey(); akey.AccelFlags = Gtk.AccelFlags.Visible; akey.AccelMods = Gdk.ModifierType.ControlMask; akey.Key = Gdk.Key.Page_Up; image_item.AddAccelerator("activate", agrp, akey); menu.Append(image_item); menu.Append(new Gtk.SeparatorMenuItem()); /* // TODO: make a radio item for each chat hotkey Gtk.RadioMenuItem radio_item; radio_item = new Gtk.RadioMenuItem(); radio_item = new Gtk.RadioMenuItem(radio_item); radio_item = new Gtk.RadioMenuItem(radio_item); menu.Append(new Gtk.SeparatorMenuItem()); */ /* image_item = new Gtk.ImageMenuItem(Gtk.Stock.Find, agrp); image_item.Activated += OnFindChatMenuItemActivated; menu.Append(image_item); item = new Gtk.MenuItem(_("Find _Next")); item.Activated += OnFindNextChatMenuItemActivated; akey = new Gtk.AccelKey(); akey.AccelFlags = Gtk.AccelFlags.Visible; akey.AccelMods = Gdk.ModifierType.ControlMask; akey.Key = Gdk.Key.G; item.AddAccelerator("activate", agrp, akey); menu.Append(item); item = new Gtk.MenuItem(_("Find _Previous")); item.Activated += OnFindPreviousChatMenuItemActivated; akey = new Gtk.AccelKey(); akey.AccelFlags = Gtk.AccelFlags.Visible; akey.AccelMods = Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask; akey.Key = Gdk.Key.G; item.AddAccelerator("activate", agrp, akey); menu.Append(item); */ // ROFL: the empty code statement below is needed to keep stupid // gettext away from using all the commented code from above as // translator comment ; _OpenLogChatMenuItem = new Gtk.ImageMenuItem(_("Open Log")); _OpenLogChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Open, Gtk.IconSize.Menu); _OpenLogChatMenuItem.Activated += OnOpenLogChatMenuItemActivated; _OpenLogChatMenuItem.Sensitive = false; _OpenLogChatMenuItem.NoShowAll = true; menu.Append(_OpenLogChatMenuItem); _CloseChatMenuItem = new Gtk.ImageMenuItem(Gtk.Stock.Close, agrp); _CloseChatMenuItem.Activated += OnCloseChatMenuItemActivated; menu.Append(_CloseChatMenuItem); // Menu - Engine menu = new Gtk.Menu(); item = new Gtk.MenuItem(_("_Engine")); item.Submenu = menu; _MenuBar.Append(item); item = new Gtk.MenuItem(_("_Use Local Engine")); item.Activated += new EventHandler(_OnUseLocalEngineButtonClicked); menu.Append(item); menu.Append(new Gtk.SeparatorMenuItem()); image_item = new Gtk.ImageMenuItem(_("_Add Remote Engine")); image_item.Image = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Menu); image_item.Activated += new EventHandler(_OnAddRemoteEngineButtonClicked); menu.Append(image_item); image_item = new Gtk.ImageMenuItem(_("_Switch Remote Engine")); image_item.Image = new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Menu); image_item.Activated += new EventHandler(_OnSwitchRemoteEngineButtonClicked); menu.Append(image_item); // Menu - View menu = new Gtk.Menu(); item = new Gtk.MenuItem(_("_View")); item.Submenu = menu; _MenuBar.Append(item); item = new Gtk.CheckMenuItem(_("_Caret Mode")); item.Activated += new EventHandler(_OnCaretModeButtonClicked); akey = new Gtk.AccelKey(); akey.AccelFlags = Gtk.AccelFlags.Visible; akey.Key = Gdk.Key.F7; item.AddAccelerator("activate", agrp, akey); menu.Append(item); item = new Gtk.CheckMenuItem(_("_Browse Mode")); item.Activated += delegate { try { _Notebook.IsBrowseModeEnabled = !_Notebook.IsBrowseModeEnabled; } catch (Exception ex) { Frontend.ShowException(this, ex); } }; akey = new Gtk.AccelKey(); akey.AccelFlags = Gtk.AccelFlags.Visible; akey.Key = Gdk.Key.F8; item.AddAccelerator("activate", agrp, akey); menu.Append(item); _ShowMenuBarItem = new Gtk.CheckMenuItem(_("Show _Menubar")); _ShowMenuBarItem.Active = true; _ShowMenuBarItem.Activated += delegate { try { _MenuBar.Visible = !_MenuBar.Visible; } catch (Exception ex) { Frontend.ShowException(this, ex); } }; menu.Append(_ShowMenuBarItem); item = new Gtk.ImageMenuItem(Gtk.Stock.Fullscreen, agrp); item.Activated += delegate { try { IsFullscreen = !IsFullscreen; } catch (Exception ex) { Frontend.ShowException(this, ex); } }; akey = new Gtk.AccelKey(); akey.AccelFlags = Gtk.AccelFlags.Visible; akey.Key = Gdk.Key.F11; item.AddAccelerator("activate", agrp, akey); menu.Append(item); // Menu - Help menu = new Gtk.Menu(); item = new Gtk.MenuItem(_("_Help")); item.Submenu = menu; _MenuBar.Append(item); image_item = new Gtk.ImageMenuItem(Gtk.Stock.About, agrp); image_item.Activated += new EventHandler(_OnAboutButtonClicked); menu.Append(image_item); // TODO: network treeview _Notebook = new Notebook(); _Notebook.SwitchPage += OnNotebookSwitchPage; _ChatViewManager = new ChatViewManager(_Notebook, null); Assembly asm = Assembly.GetExecutingAssembly(); _ChatViewManager.Load(asm); _ChatViewManager.LoadAll(System.IO.Path.GetDirectoryName(asm.Location), "smuxi-frontend-gnome-*.dll"); _ChatViewManager.ChatAdded += OnChatViewManagerChatAdded; _ChatViewManager.ChatRemoved += OnChatViewManagerChatRemoved; #if GTK_SHARP_2_10 _StatusIconManager = new StatusIconManager(this, _ChatViewManager); #endif #if INDICATE_SHARP _IndicateManager = new IndicateManager(this, _ChatViewManager); #endif #if NOTIFY_SHARP _NotifyManager = new NotifyManager(this, _ChatViewManager); #endif _UI = new GnomeUI(_ChatViewManager); // HACK: Frontend.FrontendConfig out of scope _EngineManager = new EngineManager(Frontend.FrontendConfig, _UI); _Entry = new Entry(_Notebook); _ProgressBar = new Gtk.ProgressBar(); Gtk.VBox vbox = new Gtk.VBox(); vbox.PackStart(_MenuBar, false, false, 0); vbox.PackStart(_Notebook, true, true, 0); vbox.PackStart(_Entry, false, false, 0); _NetworkStatusbar = new Gtk.Statusbar(); _NetworkStatusbar.WidthRequest = 300; _NetworkStatusbar.HasResizeGrip = false; _Statusbar = new Gtk.Statusbar(); _Statusbar.HasResizeGrip = false; Gtk.HBox status_bar_hbox = new Gtk.HBox(); status_bar_hbox.Homogeneous = true; status_bar_hbox.PackStart(_NetworkStatusbar, false, true, 0); status_bar_hbox.PackStart(_Statusbar, true, true, 0); Gtk.HBox status_hbox = new Gtk.HBox(); status_hbox.PackStart(status_bar_hbox); status_hbox.PackStart(_ProgressBar, false, false, 0); vbox.PackStart(status_hbox, false, false, 0); Add(vbox); }
private void _OnOutputMessageTextViewPopulatePopup(object o, Gtk.PopulatePopupArgs args) { if (OutputMessageTextView.IsAtUrlTag) { return; } Gtk.Menu popup = args.Menu; popup.Append(new Gtk.SeparatorMenuItem()); Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois")); whois_item.Activated += _OnMenuWhoisItemActivated; popup.Append(whois_item); Gtk.ImageMenuItem ctcp_item = new Gtk.ImageMenuItem(_("CTCP")); Gtk.Menu ctcp_menu_item = new CtcpMenu(_IrcProtocolManager, Frontend.MainWindow.ChatViewManager, PersonModel); ctcp_item.Submenu = ctcp_menu_item; popup.Append(ctcp_item); Gtk.ImageMenuItem invite_to_item = new Gtk.ImageMenuItem(_("Invite to")); Gtk.Menu invite_to_menu_item = new InviteToMenu(_IrcProtocolManager, Frontend.MainWindow.ChatViewManager, PersonModel); invite_to_item.Submenu = invite_to_menu_item; popup.Append(invite_to_item); popup.ShowAll(); }
protected virtual void OnPopulatePopup(object sender, Gtk.PopulatePopupArgs e) { Trace.Call(sender, e); if (!_AtLinkTag) { return; } Gtk.Menu popup = e.Menu; // remove all items foreach (Gtk.Widget children in popup.Children) { popup.Remove(children); } Gtk.ImageMenuItem open_item = new Gtk.ImageMenuItem(Gtk.Stock.Open, null); open_item.Activated += delegate { if (_ActiveLink != null) { Frontend.OpenLink(_ActiveLink); } }; popup.Append(open_item); Gtk.ImageMenuItem copy_item = new Gtk.ImageMenuItem(Gtk.Stock.Copy, null); copy_item.Activated += delegate { if (_ActiveLink == null) { return; } Gdk.Atom clipboardAtom = Gdk.Atom.Intern("CLIPBOARD", false); Gtk.Clipboard clipboard = Gtk.Clipboard.Get(clipboardAtom); clipboard.Text = _ActiveLink.ToString(); }; popup.Append(copy_item); popup.ShowAll(); }
private void _OnOutputMessageTextViewPopulatePopup(object o, Gtk.PopulatePopupArgs args) { if (OutputMessageTextView.IsAtUrlTag) { return; } Gtk.Menu popup = args.Menu; // minimum version of any command below if (Frontend.EngineProtocolVersion < new Version(0, 8, 11)) { return; } popup.Append(new Gtk.SeparatorMenuItem()); if (Frontend.EngineProtocolVersion >= new Version(0, 8, 12)) { Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois")); whois_item.Activated += _OnMenuWhoisItemActivated; popup.Append(whois_item); } if (Frontend.EngineProtocolVersion >= new Version(0, 8, 11)) { Gtk.ImageMenuItem AddToContacts_item = new Gtk.ImageMenuItem(_("Add To Contacts")); AddToContacts_item.Activated += _OnMenuAddToContactsItemActivated; popup.Append(AddToContacts_item); } if (Frontend.EngineProtocolVersion >= new Version(0, 8, 12)) { Gtk.ImageMenuItem invite_to_item = new Gtk.ImageMenuItem(_("Invite to")); Gtk.Menu invite_to_menu_item = new InviteToMenu(XmppProtocolManager, Frontend.MainWindow.ChatViewManager, PersonModel); invite_to_item.Submenu = invite_to_menu_item; popup.Append(invite_to_item); } popup.ShowAll(); }
private void ArrowButton_Click(object sender, EventArgs e) { Gtk.Menu menu = new Gtk.Menu(); foreach (string childId in _dummyFam.Children) { GedcomIndividualRecord child = (GedcomIndividualRecord)_database[childId]; string name = child.GetName().Name; Gtk.ImageMenuItem menuItem = new Gtk.ImageMenuItem(name); menuItem.Image = new Gtk.Image(Gtk.Stock.JumpTo, Gtk.IconSize.Menu); menuItem.ShowAll(); menu.Append(menuItem); menuItem.Activated += ChildMenu_Activated; } menu.Popup(); }
public ProtocolChatView(ChatModel chat) : base(chat) { Trace.Call(chat); ProxySettings = new ProxySettings(); Add(OutputScrolledWindow); ReconnectItem = new Gtk.ImageMenuItem(_("Reconnect")); ReconnectItem.Image = new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Menu); ReconnectItem.Activated += new EventHandler(OnTabMenuReconnectActivated); ShowAll(); }
public ChatView(ChatModel chat) { Trace.Call(chat); _ChatModel = chat; IsAutoScrolling = true; MessageTextView tv = new MessageTextView(); _EndMark = tv.Buffer.CreateMark("end", tv.Buffer.EndIter, false); tv.ShowTimestamps = true; tv.ShowMarkerline = true; tv.Editable = false; tv.CursorVisible = true; tv.WrapMode = Gtk.WrapMode.Char; tv.MessageAdded += OnMessageTextViewMessageAdded; tv.MessageHighlighted += OnMessageTextViewMessageHighlighted; tv.PopulatePopup += OnMessageTextViewPopulatePopup; tv.SizeRequested += delegate { AutoScroll(); }; _OutputMessageTextView = tv; Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow(); _OutputScrolledWindow = sw; //sw.HscrollbarPolicy = Gtk.PolicyType.Never; sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; sw.VscrollbarPolicy = Gtk.PolicyType.Always; sw.ShadowType = Gtk.ShadowType.In; sw.Vadjustment.ValueChanged += delegate { CheckAutoScroll(); }; sw.Add(_OutputMessageTextView); // popup menu _TabMenu = new Gtk.Menu(); Gtk.ImageMenuItem close_item = new Gtk.ImageMenuItem(Gtk.Stock.Close, null); close_item.Activated += new EventHandler(OnTabMenuCloseActivated); _TabMenu.Append(close_item); _TabMenu.ShowAll(); //FocusChild = _OutputTextView; //CanFocus = false; _TabLabel = new Gtk.Label(); TabImage = DefaultTabImage; _TabHBox = new Gtk.HBox(); _TabHBox.PackEnd(new Gtk.Fixed(), true, true, 0); _TabHBox.PackEnd(_TabLabel, false, false, 0); _TabHBox.PackStart(TabImage, false, false, 2); _TabHBox.ShowAll(); _TabEventBox = new Gtk.EventBox(); _TabEventBox.VisibleWindow = false; _TabEventBox.ButtonPressEvent += new Gtk.ButtonPressEventHandler(OnTabButtonPress); _TabEventBox.Add(_TabHBox); _TabEventBox.ShowAll(); _ThemeSettings = new ThemeSettings(); // OPT-TODO: this should use a TaskStack instead of TaskQueue _LastSeenHighlightQueue = new TaskQueue("LastSeenHighlightQueue("+ID+")"); _LastSeenHighlightQueue.AbortedEvent += OnLastSeenHighlightQueueAbortedEvent; _LastSeenHighlightQueue.ExceptionEvent += OnLastSeenHighlightQueueExceptionEvent; }