public override void OnNoteOpened() { if (this.Note.Title.StartsWith("GTD")) { item = new Gtk.MenuItem("Update Tasks"); item.Activated += OnMenuItemActivated; item.AddAccelerator ("activate", Window.AccelGroup, (uint) Gdk.Key.d, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); item.Show (); AddPluginMenuItem (item); } }
public static void AddAccelerator(Gtk.MenuItem item, string gconf_path) { uint keyval; Gdk.ModifierType mods; if (Services.Keybinder.GetAccelKeys(gconf_path, out keyval, out mods)) { item.AddAccelerator("activate", accel_group, keyval, mods, Gtk.AccelFlags.Visible); } }
public void AddAccelerator(EventHandler handler, uint key, Gdk.ModifierType modifiers, Gtk.AccelFlags flags) { Gtk.MenuItem foo = new Gtk.MenuItem(); foo.Activated += handler; foo.AddAccelerator("activate", accel_group, key, modifiers, flags); foo.Show(); fake_menu.Append(foo); }
public override void OnNoteOpened () { // Add the menu item when the window is created item = new Gtk.MenuItem ( Catalog.GetString ("Insert Timestamp")); item.Activated += OnMenuItemActivated; item.AddAccelerator ("activate", Window.AccelGroup, (uint) Gdk.Key.d, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); item.Show (); AddPluginMenuItem (item); // Get the format from GConf and subscribe to changes date_format = (string) Preferences.Get ( Preferences.INSERT_TIMESTAMP_FORMAT); Preferences.SettingChanged += OnFormatSettingChanged; }
public override void OnNoteOpened() { // Add the menu item when the window is created item = new Gtk.MenuItem( Catalog.GetString("Insert Timestamp")); item.Activated += OnMenuItemActivated; item.AddAccelerator("activate", Window.AccelGroup, (uint)Gdk.Key.d, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); item.Show(); AddPluginMenuItem(item); // Get the format from GConf and subscribe to changes date_format = (string)Preferences.Get( Preferences.INSERT_TIMESTAMP_FORMAT); Preferences.SettingChanged += OnFormatSettingChanged; }
public void AddAccelerator (EventHandler handler, uint key, Gdk.ModifierType modifiers, Gtk.AccelFlags flags) { Gtk.MenuItem foo = new Gtk.MenuItem (); foo.Activated += handler; foo.AddAccelerator ("activate", accel_group, key, modifiers, flags); foo.Show (); fake_menu.Append (foo); }
private void Build() { global::Stetic.Gui.Initialize(this); this.menubar2 = new Gtk.MenuBar(); Gtk.AccelGroup agrp = new Gtk.AccelGroup ( ); this.AddAccelGroup (agrp); ////////////////////// FILE ////////////////////// FileAction = new Gtk.MenuItem(messages.Localize("[[window-menu-file]]")); FileAction.Submenu = this.FileMenu; OpenNewConnectionAction = new Gtk.ImageMenuItem(messages.Localize("[[window-menu-open]]")); OpenNewConnectionAction.AddAccelerator("activate", agrp, new Gtk.AccelKey(Gdk.Key.N, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible)); OpenNewConnectionAction.Image = new Gtk.Image(Gtk.Stock.Connect, Gtk.IconSize.Menu); FileAction.Submenu = this.FileMenu; FileMenu.Append(OpenNewConnectionAction); FileMenu.Append(new Gtk.SeparatorMenuItem()); FavoriteNetworksAction = new Gtk.ImageMenuItem(messages.Localize("[[window-menu-favorite]]")); FileMenu.Append(FavoriteNetworksAction); FileMenu.Append(new Gtk.SeparatorMenuItem()); PreferencesAction = new Gtk.ImageMenuItem(messages.Localize("[[window-menu-conf]]")); PreferencesAction.Image = new Gtk.Image(Gtk.Stock.Preferences, Gtk.IconSize.Menu); FileMenu.Append(PreferencesAction); FileMenu.Append(new Gtk.SeparatorMenuItem()); ShutDownAction = new Gtk.ImageMenuItem(messages.Localize("[[window-menu-quit]]")); FileMenu.Append(ShutDownAction); ////////////////////// TOOLS ////////////////////// ToolsAction = new Gtk.MenuItem(messages.Localize("[[window-menu-tools]]")); ToolsAction.Submenu = ToolsMenu; PacketViewerAction = new Gtk.MenuItem(messages.Localize("[[window-menu-viewer]]")); PacketViewerAction.AddAccelerator("activate", agrp, new Gtk.AccelKey(Gdk.Key.P, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible)); ToolsMenu.Append(PacketViewerAction); SmallChatAction = new Gtk.MenuItem(messages.Localize("[[window-menu-chat]]")); ToolsMenu.Append(SmallChatAction); ToolsMenu.Append(new Gtk.SeparatorMenuItem()); AttachToMicroChatAction = new Gtk.ImageMenuItem(messages.Localize("[[window-menu-chat1]]")); AttachToMicroChatAction.Image = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Menu); AttachToMicroChatAction.AddAccelerator("activate", agrp, new Gtk.AccelKey(Gdk.Key.M, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible)); ToolsMenu.Append(AttachToMicroChatAction); DetachFromMicroChatAction = new Gtk.ImageMenuItem(messages.Localize("[[window-menu-chat2]]")); DetachFromMicroChatAction.Image = new Gtk.Image(Gtk.Stock.Remove, Gtk.IconSize.Menu); DetachFromMicroChatAction.AddAccelerator("activate", agrp, new Gtk.AccelKey(Gdk.Key.D, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible)); ToolsMenu.Append(DetachFromMicroChatAction); ////////////////////// MISC ////////////////////// MiscAction = new Gtk.MenuItem(messages.Localize("[[window-menu-misc]]")); MiscAction.Submenu = MiscMenu; SearchAction = new Gtk.ImageMenuItem(messages.Localize("[[window-menu-search]]")); SearchAction.Image = new Gtk.Image(Gtk.Stock.Find, Gtk.IconSize.Menu); SearchAction.AddAccelerator("activate", agrp, new Gtk.AccelKey(Gdk.Key.F, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible)); MiscMenu.Append(SearchAction); LoadMoreToScrollbackAction = new Gtk.ImageMenuItem(messages.Localize("[[window-menu-more]]")); LoadMoreToScrollbackAction.AddAccelerator("activate", agrp, new Gtk.AccelKey(Gdk.Key.U, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible)); MiscMenu.Append(LoadMoreToScrollbackAction); MiscMenu.Append(new Gtk.SeparatorMenuItem()); ConfigurationFileAction = new Gtk.MenuItem(messages.Localize("[[window-menu-cf]]")); ////////////////////// SHOW ////////////////////// ShowAction = new Gtk.MenuItem(messages.Localize("[[window-menu-show]]")); ShowAction.Submenu = ShowMenu; RootAction = new Gtk.MenuItem(messages.Localize("[[window-menu-root]]")); ShowMenu.Append(RootAction); HelpAction = new Gtk.ImageMenuItem(messages.Localize("[[window-menu-help]]")); HelpAction.Submenu = HelpMenu; MiscMenu.Append(ConfigurationFileAction); AboutAction = new Gtk.ImageMenuItem(messages.Localize("[[window-menu-about]]")); AboutAction.Image = new Gtk.Image(Gtk.Stock.About, Gtk.IconSize.Menu); ContentsAction = new Gtk.MenuItem(messages.Localize("[[window-menu-contents]]")); HelpMenu.Append(AboutAction); FavoriteNetworksAction.Sensitive = false; ContentsAction.AddAccelerator("activate", agrp, new Gtk.AccelKey(Gdk.Key.F1, Gdk.ModifierType.None, Gtk.AccelFlags.Visible)); HelpMenu.Append(ContentsAction); menubar2.Add(this.FileAction); menubar2.Add(this.ToolsAction); menubar2.Add(this.MiscAction); this.menubar2.Add(this.ShowAction); this.menubar2.Add(this.HelpAction); this.Name = "Client.Forms.Main"; this.Title = "Pidgeon Client"; this.Icon = global::Gdk.Pixbuf.LoadFromResource("Client.Resources.pigeon_clip_art_hight.ico"); this.WindowPosition = ((global::Gtk.WindowPosition)(4)); // Container child Client.Forms.Main.Gtk.Container+ContainerChild this.vbox3 = new global::Gtk.VBox(); this.vbox3.Name = "vbox3"; this.vbox3.Spacing = 6; // Container child vbox3.Gtk.Box+BoxChild this.menubar2.Name = "menubar2"; this.vbox3.Add(this.menubar2); global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.menubar2])); w2.Position = 0; w2.Expand = false; w2.Fill = false; // Container child vbox3.Gtk.Box+BoxChild this.hpaned1 = new global::Gtk.HPaned(); this.hpaned1.CanFocus = true; this.hpaned1.Name = "hpaned1"; this.hpaned1.Position = 183; // Container child hpaned1.Gtk.Paned+PanedChild this.pidgeonlist1 = new global::Client.Graphics.PidgeonList(); this.pidgeonlist1.Events = ((global::Gdk.EventMask)(256)); this.pidgeonlist1.Name = "pidgeonlist1"; this.hpaned1.Add(this.pidgeonlist1); global::Gtk.Paned.PanedChild w3 = ((global::Gtk.Paned.PanedChild)(this.hpaned1[this.pidgeonlist1])); w3.Resize = false; this.vbox3.Add(this.hpaned1); global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.hpaned1])); w4.Position = 1; // Container child vbox3.Gtk.Box+BoxChild this.toolStrip = new global::Gtk.Statusbar(); this.toolStrip.Name = "toolStrip"; this.toolStrip.Spacing = 6; // Container child toolStrip.Gtk.Box+BoxChild this.toolStripStatusNetwork = new global::Gtk.Label(); this.toolStripStatusNetwork.Name = "toolStripStatusNetwork"; this.toolStrip.Add(this.toolStripStatusNetwork); global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.toolStrip[this.toolStripStatusNetwork])); w5.Position = 0; w5.Expand = false; w5.Fill = false; // Container child toolStrip.Gtk.Box+BoxChild this.toolStripStatusChannel = new global::Gtk.Label(); this.toolStripStatusChannel.Name = "toolStripStatusChannel"; this.toolStrip.Add(this.toolStripStatusChannel); global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.toolStrip[this.toolStripStatusChannel])); w6.Position = 1; w6.Expand = false; w6.Fill = false; // Container child toolStrip.Gtk.Box+BoxChild this.toolStripInfo = new global::Gtk.Label(); this.toolStripInfo.Name = "toolStripInfo"; this.toolStrip.Add(this.toolStripInfo); global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.toolStrip[this.toolStripInfo])); w7.Position = 3; w7.Expand = false; w7.Fill = false; // Container child toolStrip.Gtk.Box+BoxChild this.toolStripProgressBar1 = new global::Gtk.ProgressBar(); this.toolStripProgressBar1.Name = "toolStripProgressBar1"; this.toolStrip.Add(this.toolStripProgressBar1); global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.toolStrip[this.toolStripProgressBar1])); w8.Position = 4; this.vbox3.Add(this.toolStrip); global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.toolStrip])); w9.Position = 2; w9.Expand = false; w9.Fill = false; this.Add(this.vbox3); if ((this.Child != null)) { this.Child.ShowAll(); } this.DefaultWidth = 1018; this.DefaultHeight = 600; this.Show(); this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.Unshow); this.ShutDownAction.Activated += new global::System.EventHandler(this.shutDownToolStripMenuItem_Click); this.AboutAction.Activated += new global::System.EventHandler(this.aboutToolStripMenuItem_Click); this.OpenNewConnectionAction.Activated += new global::System.EventHandler(this.newConnectionToolStripMenuItem_Click_1); this.PreferencesAction.Activated += new global::System.EventHandler(this.preferencesToolStripMenuItem_Click); this.PacketViewerAction.Activated += new global::System.EventHandler(this.toolStripMenuItem3_Click); this.SmallChatAction.Activated += new global::System.EventHandler(this.taskbarBoxToolStripMenuItem_Click); this.AttachToMicroChatAction.Activated += new global::System.EventHandler(this.attachToMicroChatToolStripMenuItem_Click); this.DetachFromMicroChatAction.Activated += new global::System.EventHandler(this.detachFromMicroChatToolStripMenuItem_Click); }
public App() : base("Drag And Drop Complete") { this.SetDefaultSize(250, 200); this.SetPosition(Gtk.WindowPosition.Center); this.DeleteEvent += OnTerminated; this.isChecked = false; this.sBar = new Gtk.Statusbar(); sBar.Push((uint)StatusType.NotChecked, "Not checked"); this.btnDrag = new Gtk.Button("Drag here"); Gtk.Drag.SourceSet (this.btnDrag, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask, null, Gdk.DragAction.Copy | Gdk.DragAction.Move); this.btnDrag.DragDataGet += new Gtk.DragDataGetHandler (HandleSourceDragDataGet); this.btnDrag.DragDataDelete += new Gtk.DragDataDeleteHandler (HandleSourceDragDataDelete); // set drop label as destination this.lblDrop = new Gtk.Label("Drop here"); Gtk.Drag.DestSet(this.lblDrop, 0, null, 0); this.lblDrop.DragMotion += new Gtk.DragMotionHandler (HandleTargetDragMotion); this.lblDrop.DragDrop += new Gtk.DragDropHandler (HandleTargetDragDrop); this.lblDrop.DragDataReceived += new Gtk.DragDataReceivedHandler (this.HandleTargetDragDataReceived); this.lblDrop.DragDrop += new Gtk.DragDropHandler (this.HandleStatBarDragDrop); Gtk.MenuBar bar = new Gtk.MenuBar(); Gtk.MenuItem item = new Gtk.MenuItem("File"); Gtk.Menu menu = new Gtk.Menu(); item.Submenu = menu; bar.Append(item); // accel key Gtk.AccelGroup ag = new Gtk.AccelGroup(); this.AddAccelGroup(ag); item = new Gtk.MenuItem("Quit"); item.Activated += OnTerminated; item.AddAccelerator ("activate", ag, new Gtk.AccelKey (Gdk.Key.Q, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible)); menu.Append(item); Gtk.VBox vbox = new Gtk.VBox(); vbox.PackStart(bar, false, false, 0); Gtk.HBox hbox = new Gtk.HBox(); hbox.PackStart(this.btnDrag, true, true, 0); hbox.PackStart(this.lblDrop, true, true, 0); vbox.PackStart(hbox, true, true, 0); vbox.PackStart(sBar, false, false, 0); this.Add(vbox); this.ShowAll(); }