private bool DrawOrderMenu(Gdk.EventButton args)
        {
            Gtk.Menu order_menu = new Gtk.Menu();

            GtkUtil.MakeCheckMenuItem(order_menu, Catalog.GetString("Arrange by _Month"),
                                      MainWindow.Toplevel.HandleArrangeByTime, true, (adaptor is TimeAdaptor), true);

            GtkUtil.MakeCheckMenuItem(order_menu, Catalog.GetString("Arrange by _Folder"),
                                      MainWindow.Toplevel.HandleArrangeByDirectory, true, (adaptor is DirectoryAdaptor), true);

            GtkUtil.MakeMenuSeparator(order_menu);

            GtkUtil.MakeCheckMenuItem(order_menu, Catalog.GetString("_Reverse Order"),
                                      MainWindow.Toplevel.HandleReverseOrder, true, adaptor.OrderAscending, false);

            if (adaptor is TimeAdaptor && adaptor.Query.Range != null)
            {
                GtkUtil.MakeMenuSeparator(order_menu);

                GtkUtil.MakeMenuItem(order_menu, Catalog.GetString("_Clear Date Range"),
                                     MainWindow.Toplevel.HandleClearDateRange);
            }

            if (args != null)
            {
                order_menu.Popup(null, null, null, args.Button, args.Time);
            }
            else
            {
                order_menu.Popup(null, null, null, 0, Gtk.Global.CurrentEventTime);
            }

            return(true);
        }
Esempio n. 2
0
    public void Activate(Gdk.EventButton eb, Tag tag, Tag [] tags)
    {
        int photo_count = App.Instance.Organizer.SelectedPhotos().Length;
        int tags_count  = tags.Length;

        Gtk.Menu popup_menu = new Gtk.Menu();

        GtkUtil.MakeMenuItem(popup_menu,
                             String.Format(Catalog.GetPluralString("Find", "Find", tags.Length), tags.Length),
                             "gtk-add",
                             new EventHandler(App.Instance.Organizer.HandleIncludeTag),
                             true
                             );

        FSpot.TermMenuItem.Create(tags, popup_menu);

        GtkUtil.MakeMenuSeparator(popup_menu);

        GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Create New Tag..."), "tag-new",
                             App.Instance.Organizer.HandleCreateNewCategoryCommand, true);

        GtkUtil.MakeMenuSeparator(popup_menu);

        GtkUtil.MakeMenuItem(popup_menu,
                             Catalog.GetString("Edit Tag..."), "gtk-edit",
                             delegate {
            App.Instance.Organizer.HandleEditSelectedTagWithTag(tag);
        }, tag != null && tags_count == 1);

        GtkUtil.MakeMenuItem(popup_menu,
                             Catalog.GetPluralString("Delete Tag", "Delete Tags", tags_count), "gtk-delete",
                             new EventHandler(App.Instance.Organizer.HandleDeleteSelectedTagCommand), tag != null);

        GtkUtil.MakeMenuSeparator(popup_menu);

        GtkUtil.MakeMenuItem(popup_menu,
                             Catalog.GetPluralString("Attach Tag to Selection", "Attach Tags to Selection", tags_count), "gtk-add",
                             new EventHandler(App.Instance.Organizer.HandleAttachTagCommand), tag != null && photo_count > 0);

        GtkUtil.MakeMenuItem(popup_menu,
                             Catalog.GetPluralString("Remove Tag From Selection", "Remove Tags From Selection", tags_count), "gtk-remove",
                             new EventHandler(App.Instance.Organizer.HandleRemoveTagCommand), tag != null && photo_count > 0);

        if (tags_count > 1 && tag != null)
        {
            GtkUtil.MakeMenuSeparator(popup_menu);

            GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Merge Tags"),
                                 new EventHandler(App.Instance.Organizer.HandleMergeTagsCommand), true);
        }

        if (eb != null)
        {
            popup_menu.Popup(null, null, null, eb.Button, eb.Time);
        }
        else
        {
            popup_menu.Popup(null, null, null, 0, Gtk.Global.CurrentEventTime);
        }
    }
	public void Activate (Gdk.EventButton eb, Tag tag, Tag [] tags)
	{
		int photo_count = MainWindow.Toplevel.SelectedIds ().Length;
		int tags_count = tags.Length;

		Gtk.Menu popup_menu = new Gtk.Menu ();

		GtkUtil.MakeMenuItem (popup_menu,
                String.Format (Catalog.GetPluralString ("Find", "Find", tags.Length), tags.Length),
                "gtk-add",
                new EventHandler (MainWindow.Toplevel.HandleIncludeTag),
                true
        );

        FSpot.Query.TermMenuItem.Create (tags, popup_menu);

		GtkUtil.MakeMenuSeparator (popup_menu);
		
		GtkUtil.MakeMenuItem (popup_menu, Catalog.GetString ("Create New Tag"), "f-spot-new-tag",
				      MainWindow.Toplevel.HandleCreateNewCategoryCommand, true);

        GtkUtil.MakeMenuSeparator (popup_menu);
		
		GtkUtil.MakeMenuItem (popup_menu,
			Catalog.GetString ("Edit Tag"), "gtk-edit",
			delegate { MainWindow.Toplevel.HandleEditSelectedTagWithTag (tag); }, tag != null && tags_count == 1);

		GtkUtil.MakeMenuItem (popup_menu,
			Catalog.GetPluralString ("Delete Tag", "Delete Tags", tags_count), "gtk-delete",
			new EventHandler (MainWindow.Toplevel.HandleDeleteSelectedTagCommand), tag != null);
		
		GtkUtil.MakeMenuSeparator (popup_menu);

		GtkUtil.MakeMenuItem (popup_menu,
				      Catalog.GetPluralString ("Attach Tag to Selection", "Attach Tags to Selection", tags_count), "gtk-add",
				      new EventHandler (MainWindow.Toplevel.HandleAttachTagCommand), tag != null && photo_count > 0);

		GtkUtil.MakeMenuItem (popup_menu,
				      Catalog.GetPluralString ("Remove Tag From Selection", "Remove Tags From Selection", tags_count), "gtk-remove",
				      new EventHandler (MainWindow.Toplevel.HandleRemoveTagCommand), tag != null && photo_count > 0);

		if (tags_count > 1 && tag != null) {
			GtkUtil.MakeMenuSeparator (popup_menu);

			GtkUtil.MakeMenuItem (popup_menu, Catalog.GetString ("Merge Tags"),
					      new EventHandler (MainWindow.Toplevel.HandleMergeTagsCommand), true);

		}

		if (eb != null)
 			popup_menu.Popup (null, null, null, eb.Button, eb.Time);
		else
			popup_menu.Popup (null, null, null, 0, Gtk.Global.CurrentEventTime);

	}
Esempio n. 4
0
        protected override bool OnButtonPressEvent(Gdk.EventButton e)
        {
            // Call this first so context menu has a selected torrent
            base.OnButtonPressEvent(e);

            if (!contextActive)
            {
                return(false);
            }

            if (e.Button == 3)
            {
                TreeIter iter;
                if (Selection.GetSelected(out iter))
                {
                    removeItem.Sensitive = !((TorrentLabel)Model.GetValue(iter, 0)).Immutable;
                }
                else
                {
                    removeItem.Sensitive = false;
                }

                contextMenu.ShowAll();
                contextMenu.Popup();
            }

            return(false);
        }
Esempio n. 5
0
        private void PopupContextMenu(MouseEvent ev)
        {
            m_contextMenu = new Gtk.Menu();
            Gtk.MenuItem copy  = new Gtk.MenuItem("Copy");
            Gtk.MenuItem cut   = new Gtk.MenuItem("Cut");
            Gtk.MenuItem paste = new Gtk.MenuItem("Paste");

            copy.Activated += delegate(object sender, EventArgs e) {
                OnCopy();
            };

            cut.Activated += delegate(object sender, EventArgs e) {
                OnCut();
            };

            paste.Activated += delegate(object sender, EventArgs e) {
                OnPaste(ev);
            };

            m_contextMenu.Add(copy);
            m_contextMenu.Add(cut);
            m_contextMenu.Add(paste);
            m_contextMenu.ShowAll();

            m_contextMenu.Popup();
        }
Esempio n. 6
0
        public MainWindow()
        {
            Build ();

            popupMenu = new Menu ();

            ImageMenuItem explore = new ImageMenuItem ("Explore");
            explore.Image = new Image (Stock.Open, IconSize.Menu);
            explore.Activated += Open;
            popupMenu.Add (explore);

            ImageMenuItem quit = new ImageMenuItem ("Exit");
            quit.Image = new Image (Stock.Quit, IconSize.Menu);
            quit.Activated += (object sender, EventArgs e) => {
                Application.Quit ();
            };
            popupMenu.Add (quit);

            statusIcon = new StatusIcon ();
            statusIcon.Pixbuf = c.Icon.Bitmap.ToPixbuf ();
            statusIcon.Activate += Open;
            statusIcon.PopupMenu += (object o, PopupMenuArgs args) => {
                popupMenu.ShowAll ();
                popupMenu.Popup ();
            };
            statusIcon.Tooltip = c.Icon.Tooltip;
            statusIcon.Visible = true;
        }
Esempio n. 7
0
		private void ShowPopupMenu ()
		{
			Gtk.Menu menu = new Gtk.Menu ();
			
			// Add the default 'Open' menu item

			TileAction open = new TileAction (Catalog.GetString ("Open"), Stock.Open, Open);

			ActionMenuItem open_menu_item = new ActionMenuItem (open);
			menu.Append (open_menu_item);

			if (EnableOpenWith) {
				// FIXME: Not sure if going with the parent is
				// the right thing to do in all cases.
				string mimetype = Utils.GetFirstPropertyOfParent (hit, "beagle:MimeType");

				OpenWithMenu owm = new OpenWithMenu (mimetype);
				owm.ApplicationActivated += OpenWith;
				owm.AppendToMenu (menu);
			}

			if (Actions.Count > 0) {
				SeparatorMenuItem separator = new SeparatorMenuItem ();
				menu.Append (separator);

				foreach (TileAction action in Actions) {
					ActionMenuItem item = new ActionMenuItem (action);
					menu.Append (item);
				}
			}

			menu.ShowAll ();
			menu.Popup ();
		}
Esempio n. 8
0
        private void ShowPopup(Gdk.EventButton evnt)
        {
            Gtk.AccelGroup grp = new Gtk.AccelGroup();

            Gtk.Menu menu = new Gtk.Menu();
            menu.Show();
            menu.AccelGroup = grp;

            MenuItem item;

            item           = new MenuItem("Add");
            item.AccelPath = "<CdnStudio>/Widgets/Editors/Properties/Add";

            AccelMap.AddEntry("<CdnStudio>/Widgets/Editors/Properties/Add", (uint)Gdk.Key.KP_Add, Gdk.ModifierType.None);

            item.Show();
            item.Activated += DoAddProperty;

            menu.Append(item);

            item           = new MenuItem("Remove");
            item.AccelPath = "<CdnStudio>/Widgets/Editors/Properties/Remove";
            item.Show();

            AccelMap.AddEntry("<CdnStudio>/Widgets/Editors/Properties/Remove", (uint)Gdk.Key.KP_Subtract, Gdk.ModifierType.None);

            item.Sensitive  = (d_treeview.Selection.CountSelectedRows() > 0);
            item.Activated += DoRemoveProperty;

            menu.Append(item);

            menu.Popup(null, null, null, evnt.Button, evnt.Time);
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        protected override void OnClicked()
        {
            if (calendarItem != null)
            {
                calendarItem.Open();
            }
            else
            {
                if (ParentCalendar.OrdersTypes == null || ParentCalendar.OrdersTypes.Count == 0)
                {
                    return;
                }
                else if (ParentCalendar.OrdersTypes.Count == 1)
                {
                    OnNewOrderClicked(ParentCalendar.OrdersTypes.First());
                }
                else if (TypeItemButton == TypeItemOrButton.Shedule)
                {
                    OnNewSheduleWorkClicked(ParentCalendar);
                }
                else if (TypeItemButton == TypeItemOrButton.Note)
                {
                    OnNewNoteClicked(ParentCalendar);
                }
                else if (TypeItemButton == TypeItemOrButton.Order && !QSMain.User.Permissions["worker"])
                {
                    Gtk.Menu jBox = GetNewOrderTypesMenu();
                    jBox.ShowAll();
                    jBox.Popup();
                }
            }

            base.OnClicked();
        }
Esempio n. 11
0
    //  [GLib.ConnectBeforeAttribute]
    private void SDcontextmenu2(object o, ButtonPressEventArgs args)
    {
        if (args.Event.Button == 3)
        { /* right click */
            Gtk.Menu popup_menu = new Gtk.Menu();

            MenuItem Event1 = new MenuItem("Select ALL channels");
            Event1.ButtonReleaseEvent += SelectAllChannels2;
            MenuItem Event2 = new MenuItem("Select NONE channels");
            Event2.ButtonReleaseEvent += SelectNoneChannels2;
            MenuItem Event3 = new MenuItem("Sync selected channels");
            Event3.ButtonReleaseEvent += SyncChannels2;

            popup_menu.Add(Event1);
            popup_menu.Add(Event2);
            popup_menu.Add(Event3);
            popup_menu.Add(new Gtk.SeparatorMenuItem());

            MenuItem[] EventROI = new MenuItem[nirsdata[combobox_device1.Active].probe.ROIs.Count];
            for (int i = 0; i < nirsdata[combobox_device2.Active].probe.ROIs.Count; i++)
            {
                EventROI[i] = new MenuItem(nirsdata[combobox_device2.Active].probe.ROIs[i].name);
                EventROI[i].ButtonReleaseEvent += SelectROI2;
                EventROI[i].Name = nirsdata[combobox_device2.Active].probe.ROIs[i].name;
                popup_menu.Add(EventROI[i]);
            }

            popup_menu.ShowAll();
            popup_menu.Popup();
        }
    }
Esempio n. 12
0
 // Place the menu underneath an arbitrary parent widget.  The
 // parent widget must be set using menu.AttachToWidget before
 // calling this
 public static void PopupMenu(Gtk.Menu menu, Gdk.EventButton ev)
 {
     menu.Deactivated += DeactivateMenu;
     menu.Popup(null, null, new Gtk.MenuPositionFunc(GetMenuPosition),
                (ev == null) ? 0 : ev.Button,
                (ev == null) ? Gtk.Global.CurrentEventTime : ev.Time);
 }
Esempio n. 13
0
        protected void ShowContextMenu(string menu_name)
        {
            Gtk.Menu menu = ActionManager.UIManager.GetWidget(menu_name) as Menu;
            if (menu == null || menu.Children.Length == 0)
            {
                return;
            }

            int visible_children = 0;

            foreach (Widget child in menu)
            {
                if (child.Visible)
                {
                    visible_children++;
                }
            }

            if (visible_children == 0)
            {
                return;
            }

            menu.Show();
            menu.Popup(null, null, null, 0, Gtk.Global.CurrentEventTime);
        }
            private void OnTileActivated(object sender, EventArgs args)
            {
                (sender as Button).Relief = ReliefStyle.Normal;
                RecentTrack track = widget_track_map [sender];

                lastfm.Actions.CurrentArtist = track.Artist;
                lastfm.Actions.CurrentAlbum  = track.Album;
                lastfm.Actions.CurrentTrack  = track.Name;

                Gtk.Menu menu = ServiceManager.Get <InterfaceActionService> ().UIManager.GetWidget("/LastfmTrackPopup") as Menu;

                // For an event
                //menu.Append (new MenuItem ("Go to Last.fm Page"));
                //menu.Append (new MenuItem ("Add to Google Calendar"));

                // For a user
                //menu.Append (new MenuItem ("Go to Last.fm Page"));
                //menu.Append (new MenuItem ("Listen to Recommended Station"));
                //menu.Append (new MenuItem ("Listen to Loved Station"));
                //menu.Append (new MenuItem ("Listen to Neighbors Station"));

                menu.ShowAll();
                menu.Popup(null, null, null, 0, Gtk.Global.CurrentEventTime);
                menu.Deactivated += delegate {
                    (sender as Button).Relief = ReliefStyle.None;
                };
            }
Esempio n. 15
0
        private void avatarIconView_ButtonPressEvent(object o, ButtonPressEventArgs args)
        {
            if (args.Event.Button == 3)
            {
                TreePath path = avatarIconView.GetPathAtPos((int)args.Event.X, (int)args.Event.Y);
                if (path != null)
                {
                    avatarIconView.SelectPath(path);
                }
                else
                {
                    avatarIconView.UnselectAll();
                }

                Gtk.Menu      menu       = new Gtk.Menu();
                ImageMenuItem removeItem = new ImageMenuItem(Gtk.Stock.Remove, null);

                if (avatarIconView.SelectedItems.Length > 0)
                {
                    removeItem.Activated += delegate {
                        TreeIter iter;
                        store.GetIter(out iter, path);
                        store.Remove(ref iter);
                    };
                }
                else
                {
                    removeItem.Sensitive = false;
                }
                menu.Append(removeItem);
                menu.ShowAll();
                menu.Popup();
            }
        }
Esempio n. 16
0
        protected void OnButtonReleaseEvent(UICommandElement element, object sender, ButtonReleaseEventArgs args)
        {
            GameConfigButtonDescriptor commandDescriptor = element.GetCommandDescriptor();

            if (args.Event.Button == 1)
            {
                MainApp.GetInstance().OnButtonPressEvent(commandDescriptor);
            }
            else if (args.Event.Button == 3)
            {
                Gtk.Menu rightButtonMenu = new Gtk.Menu();

                Gtk.MenuItem menuItem = new Gtk.MenuItem("Remove command");
                menuItem.ButtonReleaseEvent += OnRemoveCommandButtonPressed;
                menuItem.Data.Add("UICommandElement", element);
                rightButtonMenu.Append(menuItem);

                menuItem = new Gtk.MenuItem("Edit command");
                menuItem.ButtonReleaseEvent += OnEditCommandButtonPressed;
                menuItem.Data.Add("UICommandElement", element);
                rightButtonMenu.Append(menuItem);

                rightButtonMenu.ShowAll();
                rightButtonMenu.Popup();
            }
        }
Esempio n. 17
0
        protected void OnTreeviewImagesButtonReleaseEvent(object o, ButtonReleaseEventArgs args)
        {
            if ((int)args.Event.Button == 3)
            {
                Gtk.Menu     jBox = new Gtk.Menu();
                Gtk.MenuItem MenuItem1;
                if (treeviewImages.Selection.CountSelectedRows() == 1)
                {
                    foreach (object[] row in (ListStore)comboType.Model)
                    {
                        MenuItem1            = new MenuItem((string)row[0]);
                        MenuItem1.Activated += OnImageListPopupDocType;
                        jBox.Add(MenuItem1);
                    }
                    MenuItem1 = new SeparatorMenuItem();
                    jBox.Add(MenuItem1);

                    TreeIter iter, parentIter;
                    if (treeviewImages.Selection.GetSelected(out iter) &&
                        (ImageList.IterParent(out parentIter, iter)) &&
                        (ImageList.IterNChildren(parentIter) > 1))
                    {
                        MenuItem1            = new MenuItem("Добавить в новый док.");
                        MenuItem1.Activated += OnImageListPopupNewDoc;
                        jBox.Add(MenuItem1);
                    }
                    MenuItem1            = new MenuItem("Удалить");
                    MenuItem1.Activated += OnImageListPopupDelete;
                    jBox.Add(MenuItem1);
                }
                MenuItem1 = new MenuItem("Выбрать для всех");
                Gtk.Menu     jBox2 = new Gtk.Menu();
                Gtk.MenuItem MenuItem2;
                MenuItem1.Submenu = jBox2;
                foreach (object[] row in (ListStore)comboType.Model)
                {
                    MenuItem2 = new MenuItem((string)row[0]);
                    MenuItem2.ButtonPressEvent += OnImageListPopupDocTypeAll;
                    jBox2.Append(MenuItem2);
                }
                jBox.Append(MenuItem1);

                MenuItem1                   = new MenuItem("Повернуть все");
                jBox2                       = new Gtk.Menu();
                MenuItem1.Submenu           = jBox2;
                MenuItem2                   = new MenuItem("на 90°");
                MenuItem2.ButtonPressEvent += OnImageListPopupRotate90All;
                jBox2.Append(MenuItem2);
                MenuItem2 = new MenuItem("на 180°");
                MenuItem2.ButtonPressEvent += OnImageListPopupRotate180All;
                jBox2.Append(MenuItem2);
                MenuItem2 = new MenuItem("на 270°");
                MenuItem2.ButtonPressEvent += OnImageListPopupRotate270All;
                jBox2.Append(MenuItem2);
                jBox.Append(MenuItem1);

                jBox.ShowAll();
                jBox.Popup();
            }
        }
Esempio n. 18
0
        private void OnTreeClicked(object sender, ButtonReleaseEventArgs e)
        {
            try
            {
                if (e.Event.Button == 1) // left click
                {
                    Changed?.Invoke(sender, new EventArgs());
                }

                else if (e.Event.Button == 3) // right click
                {
                    TreePath path;
                    tree.GetPathAtPos((int)e.Event.X, (int)e.Event.Y, out path);

                    // By default, Gtk will un-select the selected rows when a normal (non-shift/ctrl) click is registered.
                    // Setting e.Retval to true will stop the default Gtk ButtonPress event handler from being called after
                    // we return from this handler, which in turn means that the rows will not be deselected.
                    e.RetVal = tree.Selection.GetSelectedRows().Contains(path);
                    if (contextMenu != null)
                    {
                        contextMenu.ShowAll();
                        contextMenu.Popup();
                    }
                }
            }
            catch (Exception err)
            {
                ShowError(err);
            }
        }
Esempio n. 19
0
        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);
        }
Esempio n. 20
0
        private void OpenContextMenu()
        {
            var menu = new Gtk.Menu();

            SetupMenuItems(menu);
            menu.ShowAll();
            menu.Popup();
        }
Esempio n. 21
0
 public void ShowMenu()
 {
     if (popup != null)
     {
         popup.Popup();
         popup.ShowAll();
     }
 }
Esempio n. 22
0
 void Tree_ButtonPressEvent(object o, ButtonPressEventArgs args)
 {
     if ((int)args.Event.Button == 3)
     {
         TreeViewContextMenu.ShowAll();
         TreeViewContextMenu.Popup();
     }
     Console.WriteLine("Tree_ButtonPressEvent");
 }
        public void Activate(Gdk.EventButton eb, Literal literal, Gtk.Menu popup_menu, bool is_popup)
        {
            //this.literal = literal;

            /*MenuItem attach_item = new MenuItem (Catalog.GetString ("Find With"));
             * TagMenu attach_menu = new TagMenu (attach_item, MainWindow.Toplevel.Database.Tags);
             * attach_menu.TagSelected += literal.HandleAttachTagCommand;
             * attach_item.ShowAll ();
             * popup_menu.Append (attach_item);*/

            if (literal.IsNegated)
            {
                GtkUtil.MakeMenuItem(popup_menu,
                                     Catalog.GetString("Include"),
                                     "gtk-cancel",
                                     new EventHandler(literal.HandleToggleNegatedCommand),
                                     true);
            }
            else
            {
                GtkUtil.MakeMenuItem(popup_menu,
                                     Catalog.GetString("Exclude"),
                                     "gtk-delete",
                                     new EventHandler(literal.HandleToggleNegatedCommand),
                                     true);
            }

            GtkUtil.MakeMenuItem(popup_menu, Catalog.GetString("Remove"),
                                 "gtk-remove",
                                 new EventHandler(literal.HandleRemoveCommand),
                                 true);

            if (is_popup)
            {
                if (eb != null)
                {
                    popup_menu.Popup(null, null, null, eb.Button, eb.Time);
                }
                else
                {
                    popup_menu.Popup(null, null, null, 0, Gtk.Global.CurrentEventTime);
                }
            }
        }
Esempio n. 24
0
        private void TIconClicked(object sender, ButtonPressEventArgs args)
        {
            Gdk.EventButton eb = args.Event;

            if (eb.Button == 3)
            {
                menu.ShowAll();
                menu.Popup(null, null, null, IntPtr.Zero, args.Event.Button, args.Event.Time);
            }
        }
Esempio n. 25
0
        void ShowPopup()
        {
            CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet("/MonoDevelop/VersionControl/DiffView/ContextMenu");

            Gtk.Menu menu = IdeApp.CommandService.CreateMenu(cset);
            menu.Destroyed += delegate {
                this.QueueDraw();
            };

            menu.Popup(null, null, new Gtk.MenuPositionFunc(PositionPopupMenu), 0, Gtk.Global.CurrentEventTime);
        }
Esempio n. 26
0
        private bool DrawOrderMenu(Gdk.EventButton args)
        {
            Gtk.Menu order_menu = new Gtk.Menu();

            order_menu.Append(App.Instance.Organizer.ReverseOrderAction.CreateMenuItem());

            GtkUtil.MakeMenuItem(order_menu, Catalog.GetString("_Clear Date Range"),
                                 App.Instance.Organizer.HandleClearDateRange);

            if (args != null)
            {
                order_menu.Popup(null, null, null, args.Button, args.Time);
            }
            else
            {
                order_menu.Popup(null, null, null, 0, Gtk.Global.CurrentEventTime);
            }

            return(true);
        }
Esempio n. 27
0
        protected override bool OnButtonReleaseEvent(Gdk.EventButton evnt)
        {
            if (QSMain.User.Permissions["worker"])
            {
                return(false);
            }

            if (evnt.Button == 3)
            {
                Gtk.Menu jBox = new Gtk.Menu();
                MenuItem MenuItem1;
                MenuItemId <OrderTypeClass> MenuItem2;

                if (ParentCalendar == null)
                {
                    return(false);
                }

                if (ParentCalendar.OrdersTypes == null || ParentCalendar.OrdersTypes.Count == 0)
                {
                    throw new InvalidOperationException("Типы заказов для календаря не установлены.");
                }
                else if (ParentCalendar.OrdersTypes.Count == 1 && TypeItemButton == TypeItemOrButton.Order)
                {
                    MenuItem2    = new MenuItemId <OrderTypeClass>("Новый заказ");
                    MenuItem2.ID = ParentCalendar.OrdersTypes.First();
                    MenuItem2.ButtonPressEvent += OnButtonPopupAddWithType;
                    jBox.Add(MenuItem2);
                }
                else if (TypeItemButton == TypeItemOrButton.Order)
                {
                    MenuItem1         = new MenuItem("Новый заказ");
                    MenuItem1.Submenu = GetNewOrderTypesMenu();
                    jBox.Add(MenuItem1);
                }

                if (TypeItemButton == TypeItemOrButton.Order)
                {
                    MenuItem1           = new MenuItem("Перенести");
                    MenuItem1.Sensitive = calendarItem != null;
                    MenuItem1.Submenu   = GetOrderWeekMoveMenu();
                    jBox.Add(MenuItem1);
                }

                MenuItem1            = new MenuItem("Удалить");
                MenuItem1.Sensitive  = calendarItem != null;
                MenuItem1.Activated += OnButtonPopupDelete;
                jBox.Add(MenuItem1);
                jBox.ShowAll();
                jBox.Popup();
            }

            return(base.OnButtonReleaseEvent(evnt));
        }
Esempio n. 28
0
        protected override bool OnButtonPressEvent(Gdk.EventButton e)
        {
            int count = Selection.CountSelectedRows();

            if (count > 1 && e.Button == 3)
            {
                contextMenu.ShowAll();
                contextMenu.Popup();
                return(true);
            }
            else if (count <= 1 && e.Button == 3)
            {
                base.OnButtonPressEvent(e);
                contextMenu.ShowAll();
                contextMenu.Popup();
                return(true);
            }

            base.OnButtonPressEvent(e);
            return(false);
        }
Esempio n. 29
0
 private void on_avatarButton_button_press_event(object o, Gtk.ButtonPressEventArgs args)
 {
     if (args.Event.Button == 3)
     {
         Gtk.Menu      menu      = new Gtk.Menu();
         ImageMenuItem clearItem = new ImageMenuItem(Gtk.Stock.Clear, null);
         clearItem.Activated += clearItem_Activated;
         menu.Append(clearItem);
         menu.ShowAll();
         menu.Popup();
     }
 }
Esempio n. 30
0
        private void UpdateItems(IList <ToolbarItem> toolBarItems)
        {
            foreach (var child in _toolbarSection.Children)
            {
                child.Destroy();
                _toolbarSection.Remove(child);
            }

            foreach (var toolBarItem in toolBarItems.Where(t => t.Order != ToolbarItemOrder.Secondary))
            {
                ToolButton newToolButton = ToolButtonHelper.CreateToolButton(toolBarItem);
                _toolbarSection.PackStart(newToolButton, false, false, GtkToolbarConstants.ToolbarItemSpacing);
                newToolButton.Clicked += (sender, args) => { ((IMenuItemController)toolBarItem).Activate(); };

                toolBarItem.PropertyChanged -= OnToolbarItemPropertyChanged;
                toolBarItem.PropertyChanged += OnToolbarItemPropertyChanged;
            }

            var secondaryToolBarItems = toolBarItems.Where(t => t.Order == ToolbarItemOrder.Secondary);

            if (secondaryToolBarItems.Any())
            {
                ToolButton secondaryButton = ToolButtonHelper.CreateToolButton(Stock.Add);
                _toolbarSection.PackStart(secondaryButton, false, false, 0);

                Gtk.Menu menu = new Gtk.Menu();
                foreach (var secondaryToolBarItem in secondaryToolBarItems)
                {
                    Gtk.MenuItem menuItem = new Gtk.MenuItem(secondaryToolBarItem.Text)
                    {
                        Sensitive = secondaryToolBarItem.IsEnabled
                    };
                    menu.Add(menuItem);

                    menuItem.ButtonPressEvent += (sender, args) =>
                    {
                        ((IMenuItemController)secondaryToolBarItem).Activate();
                    };

                    secondaryToolBarItem.PropertyChanged -= OnToolbarItemPropertyChanged;
                    secondaryToolBarItem.PropertyChanged += OnToolbarItemPropertyChanged;
                }

                secondaryButton.Clicked += (sender, args) =>
                {
                    menu.ShowAll();
                    menu.Popup();
                };
            }

            _toolbarSection.ShowAll();
        }
Esempio n. 31
0
 void Imageslist_ImageButtonPressEvent(object sender, ImageButtonPressEventArgs e)
 {
     if ((int)e.eventArgs.Event.Button == 3)
     {
         popupMenuOn = (NomenclatureImage)e.Tag;
         Gtk.Menu     jBox      = new Gtk.Menu();
         Gtk.MenuItem MenuItem1 = new MenuItem("Удалить");
         MenuItem1.Activated += DeleteImage_Activated;;
         jBox.Add(MenuItem1);
         jBox.ShowAll();
         jBox.Popup();
     }
 }
Esempio n. 32
0
        // Create the popup menu, on right click.
        void OnTrayIconPopup(object o, EventArgs args)
        {
            popupMenu          = new Gtk.Menu();
            menuItemQuit       = new ImageMenuItem("Quit");
            appimg             = new Gtk.Image(Stock.Quit, IconSize.Menu);
            menuItemQuit.Image = appimg;
            popupMenu.Add(menuItemQuit);

            // Quit the application when quit has been clicked.
            menuItemQuit.Activated += OnActivated;
            popupMenu.ShowAll();
            popupMenu.Popup();
        }
Esempio n. 33
0
        private void CreateDirectoryMenu(string directoryPath, string mediaType)
        {
            Menu cmMediaDirectory 			= new Menu();
            cmMediaDirectory.WidthRequest 	= 150;

            cmMediaDirectory.Add(_parent.oMenuItems.PlayDirectory(directoryPath, mediaType));
            cmMediaDirectory.Add(_parent.oMenuItems.EnqueDirectory(directoryPath, mediaType));
            cmMediaDirectory.Add(_parent.oMenuItems.Seperator());
            cmMediaDirectory.Add(_parent.oMenuItems.CollapseAll());

            cmMediaDirectory.ShowAll();
            cmMediaDirectory.Popup();
        }
Esempio n. 34
0
        protected override bool OnButtonPressEvent(Gdk.EventButton e)
        {
            // Call this first so context menu has a selected torrent
            base.OnButtonPressEvent(e);

            if (e.Button == 3 && Selection.CountSelectedRows() == 1)
            {
                contextMenu.ShowAll();
                contextMenu.Popup();
            }

            return(false);
        }
Esempio n. 35
0
        //(string name, bool isFolder) : base (false, 6)
        public FileMaskEntry(List<string> mask, object parent,Gtk.Window parentWindow)
            : base(false, 6)
        {
            windowParent =parentWindow;

            text = new Entry ();
            this.parent= parent;
            browse = Button.NewWithMnemonic (MainClass.Languages.Translate("browse"));

            text.Changed += new EventHandler (OnTextChanged);
            browse.Clicked += new EventHandler (OnButtonClicked);

            PackStart (text, true, true, 0);

            PackEnd (browse, false, false, 0);

            Gdk.Pixbuf default_pixbuf = null;
            string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-menu.png");

            popupCondition = new Gtk.Menu();

            if (System.IO.File.Exists(file)) {
                default_pixbuf = new Gdk.Pixbuf(file);

                Gtk.Button btnClose = new Gtk.Button(new Gtk.Image(default_pixbuf));
                btnClose.TooltipText = MainClass.Languages.Translate("insert_path_mask");
                btnClose.Relief = Gtk.ReliefStyle.None;
                btnClose.CanFocus = false;
                btnClose.WidthRequest = btnClose.HeightRequest = 22;

                popupCondition.AttachToWidget(btnClose,new Gtk.MenuDetachFunc(DetachWidget));

                btnClose.Clicked += delegate {
                    popupCondition.Popup(null,null, new Gtk.MenuPositionFunc (GetPosition) ,3,Gtk.Global.CurrentEventTime);
                };
                PackEnd (btnClose, false, false, 0);
            }

            if (mask != null)
                foreach (string cd in mask) {

                    AddMenuItem(cd);
                }
            popupCondition.ShowAll();

            this.ShowAll();
        }
Esempio n. 36
0
        // Create the popup menu, on right click.
        static void OnTrayIconPopup(object o, EventArgs args)
        {
            Menu popupMenu = new Menu();

            ImageMenuItem menuItemQuit = new Gtk.ImageMenuItem("Quit");
            Gtk.Image appimg = new Gtk.Image(Stock.Quit, IconSize.Menu);
            menuItemQuit.Image = appimg;
            popupMenu.Add(menuItemQuit);

            // Quit the application when quit has been clicked.
            menuItemQuit.Activated += delegate
            {
                Application.Quit();
            };

            popupMenu.ShowAll();
            popupMenu.Popup();
            popupMenu.TakeFocus = true;
            popupMenu.Title = "Graal RC";
        }
Esempio n. 37
0
        private void CreateDefaultMenu()
        {
            Menu cmDefault 			= new Menu();
            cmDefault.WidthRequest 	= 200;

            cmDefault.Add(_parent.oMenuItems.Previous());
            cmDefault.Add(_parent.oMenuItems.PlayPause());
            cmDefault.Add(_parent.oMenuItems.Stop());
            cmDefault.Add(_parent.oMenuItems.Next());
            cmDefault.Add(_parent.oMenuItems.Seperator());
            cmDefault.Add(_parent.oMenuItems.VolumeUp());
            cmDefault.Add(_parent.oMenuItems.VolumeDown());
            cmDefault.Add(_parent.oMenuItems.Mute());
            cmDefault.Add(_parent.oMenuItems.Seperator());
            cmDefault.Add(_parent.oMenuItems.Configuration());
            cmDefault.Add(_parent.oMenuItems.Seperator());
            cmDefault.Add(_parent.oMenuItems.Quit());

            cmDefault.ShowAll();
            cmDefault.Popup();
        }
Esempio n. 38
0
        // Create the popup menu, on right click.
        static void OnTrayIconPopup(object o, EventArgs args)
        {
            Menu popupMenu = new Menu();
            ImageMenuItem menuItemQuit = new ImageMenuItem ("Quit");
            Gtk.Image appimg = new Gtk.Image(Stock.Quit, IconSize.Menu);
            menuItemQuit.Image = appimg;

            var machines = machineService.GetAllMachines ()
                .GroupBy (x => x.GroupName);
            foreach (var item in machines) {
                if (item.Key == null)
                    continue;

                MenuItem parentItem = new MenuItem (item.Key);
                Menu subMenu = new Menu ();
                foreach (Machine machine in item) {
            //					ImageMenuItem menuItem = new ImageMenuItem (machine.FileName);
            //					menuItem.Image = new Gtk.Image (Stock.Connect, IconSize.Menu);
                    MenuItem menuItem = new MenuItem (machine.RemoteType + " - " + machine.FileName);
                    menuItem.Activated += (object sender, EventArgs e) => {
                        if (machine.RemoteType == RemoteType.RDP) {
                            machineService.LaunchRDP(machine, settings);
                        } else if (machine.RemoteType == RemoteType.SSH) {
                            machineService.LaunchSSH(machine, settings);
                        } else if (machine.RemoteType == RemoteType.VNC) {
                            machineService.LaunchVNC(machine, settings);
                        }
                    };
                    subMenu.Add (menuItem);
                }
                parentItem.Submenu = subMenu;
                popupMenu.Add (parentItem);
            }

            popupMenu.Add(menuItemQuit);

            menuItemQuit.Activated += delegate { Application.Quit(); };
            popupMenu.ShowAll();
            popupMenu.Popup();
        }
Esempio n. 39
0
	public void Activate (Gdk.EventButton eb)
	{
		Gtk.Menu popup_menu = new Gtk.Menu ();
		bool have_selection = true;
		bool have_multi = false;

		if (icon_list.CountSelected <= 0) {
			have_selection = false;
		} else if (icon_list.CountSelected > 1) {
			have_multi = true;
		}

		if (icon_list.CountSelected > 0) {
			GtkUtil.MakeMenuItem (popup_menu, "Copy Image Location", new EventHandler (Action_CopyImageLocation));
			GtkUtil.MakeMenuItem (popup_menu, "Remove Image", new EventHandler (Action_RemoveImage));
			GtkUtil.MakeMenuSeparator (popup_menu);
		}
		
		GtkUtil.MakeMenuItem (popup_menu, (have_multi ? "Cut Images" : "Cut Image"),
				      new EventHandler (Action_CutImage), false);
		GtkUtil.MakeMenuItem (popup_menu, (have_multi ? "Copy Images" : "Copy Image"),
				      new EventHandler (Action_CopyImage), have_selection);
		GtkUtil.MakeMenuItem (popup_menu, "Paste Images",
				      new EventHandler (Action_PasteImage), true);
		GtkUtil.MakeMenuItem (popup_menu, (have_multi ? "Delete Images" : "Delete Image"),
				      new EventHandler (Action_DeleteImage), have_selection);
#if false
		GtkUtil.MakeMenuSeparator (popup_menu);
		GtkUtil.MakeMenuItem (popup_menu, (have_multi ? "Rotate Images CW" : "Rotate Image CW"),
				      new EventHandler (Action_RotateImageCW), have_selection);
		GtkUtil.MakeMenuItem (popup_menu, (have_multi ? "Rotate Images CCW" : "Rotate Image CCW"),
				      new EventHandler (Action_RotateImageCCW), have_selection);
		GtkUtil.MakeMenuItem (popup_menu, (have_multi ? "Rotate Images 180" : "Rotate Image 180"),
				      new EventHandler (Action_RotateImage180), have_selection);
#endif
		
		popup_menu.Popup (null, null, null, IntPtr.Zero, eb.Button, eb.Time);
	}
Esempio n. 40
0
 protected void OnConfigListTreeviewButtonPressEvent(object o, ButtonPressEventArgs args)
 {
     if (args.Event.Button == 3)
     {
         Menu m = new Menu();
         MenuItem ViewInfo = new MenuItem("View Config Pack Information");
         ViewInfo.ButtonPressEvent += (sender, argss) =>
             {
                 TreeSelection selection = (o as TreeView).Selection;
                 TreeModel model;
                 TreeIter iter;
                 if(selection.GetSelected(out model, out iter))
                 {
                     var match = ConfigList.FirstOrDefault(x => x.FriendlyName.Equals(model.GetValue(iter, 0).ToString()));
                     ViewPackInfoWindow vpi = new ViewPackInfoWindow(ReadPackInformation(match));
                     vpi.Show();
                 }
             };
         m.Add(ViewInfo);
         m.ShowAll();
         m.Popup();
     }
 }
Esempio n. 41
0
        private void CreateMediaMenu(string caller, string identifier)
        {
            Menu cmMedia			= new Menu();
            cmMedia.WidthRequest 	= 150;

            cmMedia.Add(_parent.oMenuItems.Play(caller, identifier));
            cmMedia.Add(_parent.oMenuItems.Enque(caller, identifier));

            if (caller != "album")
            {
                cmMedia.Add(_parent.oMenuItems.Seperator());
                cmMedia.Add(_parent.oMenuItems.CollapseAll());
            }

            if (caller == "file")
            {
                cmMedia.Add(_parent.oMenuItems.Seperator());
                cmMedia.Add(_parent.oMenuItems.ShowSongInfo("sharebrowser"));
            }

            cmMedia.ShowAll();
            cmMedia.Popup();
        }
Esempio n. 42
0
        // handler for mouse click
        private void OnImageClick(object o, ButtonPressEventArgs args)
        {
            if (args.Event.Button == 3) //right click
               		{
                Menu popupMenu = new Menu (); // creates the menu
              		ImageMenuItem menuPopup1 = new ImageMenuItem ("Quit");
              		Image appimg = new Image (Stock.Quit, IconSize.Menu);
              		menuPopup1.Image = appimg; // sets the menu item's image
              		popupMenu.Add (menuPopup1); // adds the menu item to the menu

              		menuPopup1.Activated += new EventHandler (this.OnPopupClick); // event when the user clicks the icon
                popupMenu.ShowAll (); // shows everything
                // pops up the actual menu when the user right clicks
              		popupMenu.Popup (null, null, null, IntPtr.Zero, args.Event.Button, args.Event.Time);
               		}
               		else
               		{
               			Menu mainPopupMenu = new Menu ();

               			ImageMenuItem menuPopupReload = new ImageMenuItem ("Reload");
               			ImageMenuItem menuPopupAbout = new ImageMenuItem ("About");

               			Image reloadimg = new Image (Stock.Refresh, IconSize.Menu);
               			Image aboutimg = new Image (Stock.About, IconSize.Menu);

               			menuPopupReload.Image = reloadimg;
               			menuPopupAbout.Image = aboutimg;

               			mainPopupMenu.Add (menuPopupReload);
               			mainPopupMenu.Add (menuPopupAbout);

               			menuPopupReload.Activated += new EventHandler (this.OnPopupReloadClick);
               			menuPopupAbout.Activated += new EventHandler (this.OnPopupAboutClick);
               			mainPopupMenu.ShowAll ();
               			mainPopupMenu.Popup (null, null, null, IntPtr.Zero, args.Event.Button, args.Event.Time);
               		}
        }
Esempio n. 43
0
    private void on_treeview_load_button_release_event(object o, ButtonReleaseEventArgs args)
    {
        Gdk.EventButton e = args.Event;
        if (e.Button == 3) {
            Menu myMenu = new Menu ();
            Gtk.MenuItem myItem;

            myItem = new MenuItem (Catalog.GetString("Delete selected"));
            myItem.Activated += on_delete_selected_row_clicked;
            myMenu.Attach( myItem, 0, 1, 0, 1 );

            myMenu.Popup();
            myMenu.ShowAll();
        }
    }
		void TemplatesTreeViewButtonPressed (object o, ButtonPressEventArgs args)
		{
			SolutionTemplate template = GetSelectedTemplate ();
			if ((template == null) || (template.AvailableLanguages.Count <= 1)) {
				return;
			}

			if (templateTextRenderer.IsLanguageButtonPressed (args.Event)) {
				var menu = new Menu ();
				menu.AttachToWidget (this, null);
				AddLanguageMenuItems (menu, template);
				menu.ModifyBg (StateType.Normal, GtkTemplateCellRenderer.LanguageButtonBackgroundColor);
				menu.ShowAll ();

				MenuPositionFunc posFunc = (Menu m, out int x, out int y, out bool pushIn) => {
					Gdk.Rectangle rect = templateTextRenderer.GetLanguageRect ();
					Gdk.Rectangle screenRect = GtkUtil.ToScreenCoordinates (templatesTreeView, templatesTreeView.ParentWindow, rect);
					x = screenRect.X;
					y = screenRect.Bottom;
					pushIn = false;
				};
				menu.Popup (null, null, posFunc, 0, args.Event.Time);
			}
		}
Esempio n. 45
0
        private void item_click(ButtonPressEventArgs args, UserLabel label, RightClickLabelButton b)
        {
            if (args.Event.Button == 1) {

                category.update_restriction_and_update_screen(label.metalabel);
                b.Active = !b.Active;

            } else if (args.Event.Button == 3) {
             	Menu popupMenu = new Menu();

                MenuItem rename_item = new MenuItem(Mono.Unix.Catalog.GetString("Rename label"));
                rename_item.Activated += delegate { rename_label(label); };
                popupMenu.Add(rename_item);

                MenuItem delete_item = new MenuItem(Mono.Unix.Catalog.GetString("Delete label"));
                delete_item.Activated += delegate { remove_label(label.metalabel); };
                popupMenu.Add(delete_item);

                popupMenu.Add(new Gtk.SeparatorMenuItem());

                MenuItem create_label = new MenuItem(Mono.Unix.Catalog.GetString("Create a new label"));
                create_label.Activated += delegate { add_new_label(); };
                popupMenu.Add(create_label);

                popupMenu.ShowAll();
              			popupMenu.Popup(null, null, null, args.Event.Button, args.Event.Time);
            }
        }
Esempio n. 46
0
        private void header_click(ButtonPressEventArgs args, Category cat)
        {
            if (args.Event.Button == 3) {
             	Menu popupMenu = new Menu();

                MenuItem create_label = new MenuItem(Mono.Unix.Catalog.GetString("Create a new label"));
                create_label.Activated += delegate { add_new_label(); };
                popupMenu.Add(create_label);

                MenuItem rename_item = new MenuItem(Mono.Unix.Catalog.GetString("Rename category"));
                rename_item.Activated += delegate { rename_category(false); };
                popupMenu.Add(rename_item);

                if (!category.initial) {
                    MenuItem delete_item = new MenuItem(Mono.Unix.Catalog.GetString("Delete category"));
                    delete_item.Activated += delegate { remove_category_callback(cat.metalabel.db_id); };
                    popupMenu.Add(delete_item);
                }

                popupMenu.Add(new Gtk.SeparatorMenuItem());

                MenuItem create_item = new MenuItem(Mono.Unix.Catalog.GetString("Create a new category"));
                create_item.Activated += delegate { add_new_category_to_ui_callback(); };
                popupMenu.Add(create_item);

                popupMenu.ShowAll();
              			popupMenu.Popup(null, null, null, args.Event.Button, args.Event.Time);
            }
        }
Esempio n. 47
0
 /// <summary>
 /// Render a tray menu which is displayed when user click on pidgeon icon in tray only
 /// </summary>
 /// <param name="o"></param>
 /// <param name="args"></param>
 private void TrayMenu(object o, EventArgs args)
 {
     Menu menu = new Menu();
     ImageMenuItem menuItemQuit = new ImageMenuItem(messages.Localize("[[common-quit]]"));
     Gtk.Image appimg = new Gtk.Image(Stock.Quit, IconSize.Menu);
     CheckMenuItem notifications = new CheckMenuItem(messages.Localize("[[tray-en]]"));
     menu.Add(notifications);
     notifications.Active = Configuration.Kernel.Notice;
     notifications.Activated += new EventHandler(itemNotification);
     if (!this.Visible)
     {
         MenuItem show = new MenuItem("Show");
         menu.Add(show);
         show.Activated += new EventHandler(itemShow);
     }
     else
     {
         MenuItem hide = new MenuItem("Hide");
         hide.Activated += new EventHandler(itemHide);
         menu.Add(hide);
     }
     menu.Add(new Gtk.SeparatorMenuItem());
     menuItemQuit.Image = appimg;
     menu.Add(menuItemQuit);
     // Quit the application when quit has been clicked.
     menuItemQuit.Activated += new EventHandler(shutDownToolStripMenuItem_Click);
     menu.ShowAll();
     menu.Popup();
 }
        void treeview_ButtonPressEvent(object o, ButtonPressEventArgs args)
        {
            if (args.Event.Button == 3)//F**k this should be a define
            {

                Gtk.TreeModel mod;
                Gtk.TreeIter iter;

                TreePath[] paths = treeview_members.Selection.GetSelectedRows(out mod);

                ChatSessionMember me = MainClass.client.Self.GroupChatSessions[session].Find(delegate(ChatSessionMember member)
                {
                    return member.AvatarKey == MainClass.client.Self.AgentID;
                });

                bool i_am_a_moderator = false;

                    if (me.IsModerator == true)
                        i_am_a_moderator = true;

                Gtk.Menu menu = new Gtk.Menu();

                if(i_am_a_moderator==true)
                {
                    bool muted=false;
                    bool not_muted=false;
                    foreach (TreePath path in paths)
                    {

                        store.GetIter(out iter, path);
                        ChatSessionMember member=(ChatSessionMember)store.GetValue(iter,1);
                        if(member.MuteText==true)
                            muted=true;

                        if(member.MuteText==false)
                            not_muted=true;
                    }

                    if(not_muted==true && muted==false)
                    {
                           //We can mute
                          Gtk.MenuItem menu_mute = new MenuItem("Mute");
                          menu_mute.ButtonPressEvent+=new ButtonPressEventHandler(menu_mute_ButtonPressEvent);
                          menu.Append(menu_mute);
                    }

                     if(not_muted==false && muted==true)
                    {
                           //We can mute
                          Gtk.MenuItem menu_unmute = new MenuItem("UN-mute");
                          menu_unmute.ButtonPressEvent+=new ButtonPressEventHandler(menu_unmute_ButtonPressEvent);
                          menu.Append(menu_unmute);
                    }
                }

                if (paths.Length == 1)
                {

                    Gtk.ImageMenuItem menu_IM = new ImageMenuItem("IM");
                    menu_IM.Image = new Gtk.Image(MainClass.GetResource("icon_group.png"));
                    menu_IM.ButtonPressEvent += new ButtonPressEventHandler(menu_IM_ButtonPressEvent);
                    menu.Append(menu_IM);
                }
                else if (paths.Length > 1)
                {
                    Gtk.ImageMenuItem menu_IM = new ImageMenuItem("Confrence");
                    menu_IM.Image = new Gtk.Image(MainClass.GetResource("icn_voice-groupfocus.png"));
                    menu_IM.ButtonPressEvent += new ButtonPressEventHandler(menu_IM_ButtonPressEvent);
                    menu.Append(menu_IM);
                }

                menu.Popup();
                menu.ShowAll();

            }
        }
Esempio n. 49
0
 private void OniFolderIconViewBackgroundClicked(object o, iFolderClickedArgs args)
 {
     iFoldersIconView.UnselectAll();
        if (args.Button == 3)
        {
     Menu menu = new Menu();
     MenuItem item_refresh =
      new MenuItem(Util.GS("Refresh"));
     menu.Append(item_refresh);
     item_refresh.Activated += new EventHandler(
      RefreshiFoldersHandler);
     menu.ShowAll();
     menu.Popup(null, null, null,
      IntPtr.Zero, 3,
      Gtk.Global.CurrentEventTime);
        }
 }
Esempio n. 50
0
    private void ShowPopupMenu(ILayer layer)
    {
        Menu popupMenu = new Menu();

        MenuItem addItem = new ImageMenuItem(Stock.Add, null);
        addItem.Activated += OnAdd;
        popupMenu.Append(addItem);

        if (layer is Tilemap) {
            MenuItem resizeItem = new MenuItem("Resize");
            resizeItem.Activated += OnResize;
            popupMenu.Append(resizeItem);

            MenuItem editPathItem = new MenuItem("Edit Path");
            editPathItem.Activated += OnEditPath;
            popupMenu.Append(editPathItem);

            MenuItem deletePathItem = new MenuItem("Delete Path");
            deletePathItem.Sensitive = application.CurrentTilemap != null && application.CurrentTilemap.Path != null;
            deletePathItem.Activated += OnDeletePath;
            popupMenu.Append(deletePathItem);

            MenuItem CheckIDsItem = new MenuItem("Check tile IDs");
            CheckIDsItem.Activated += OnCheckIDs;
            popupMenu.Append(CheckIDsItem);
        }

        MenuItem deleteItem = new ImageMenuItem(Stock.Delete, null);
        if (layer is Tilemap) {
            deleteItem.Sensitive = sector.GetObjects(typeof(Tilemap)).Count > 1;
        }
        deleteItem.Activated += OnDelete;
        popupMenu.Append(deleteItem);

        popupMenu.ShowAll();
        popupMenu.Popup();
    }
Esempio n. 51
0
        static void OnTrayIconPopup(object o, EventArgs args)
        {
            Menu popupMenu = new Menu ();
            ImageMenuItem menuItemQuit = new ImageMenuItem ("Quit");
            Gtk.Image appimg = new Gtk.Image (Stock.Quit, IconSize.Menu);
            menuItemQuit.Image = appimg;
            popupMenu.Add (menuItemQuit);
            // Quit the application when quit has been clicked.
            menuItemQuit.Activated += delegate {
                File.Delete(ep+"/Error.txt");
                trayIcon.Dispose();
                Application.Quit (); };

            MenuItem menuItemlog = new ImageMenuItem ("Log");
            popupMenu.Add (menuItemlog);
            // Quit the application when quit has been clicked.
            if (File.Exists(ep+"/Error.txt"))
            {
                menuItemlog.Activated += delegate {
                    System.Diagnostics.Process.Start(ep+"/Error.txt");
                };
                menuItemlog.Sensitive = true;
            }
            else menuItemlog.Sensitive = false;

            popupMenu.ShowAll ();
            popupMenu.Popup ();
        }
    protected void OnTreeviewPlacesPopupMenu(object o, Gtk.PopupMenuArgs args)
    {
        bool ItemSelected = treeviewPlaces.Selection.CountSelectedRows() == 1;
        TreeIter iter;
        bool setLessee = false;

        if(ItemSelected)
        {
            treeviewPlaces.Selection.GetSelected(out iter);
            setLessee = Convert.ToInt32(PlaceSort.GetValue(iter, (int)PlaceCol.lessee_id)) > 0;
        }
        Gtk.Menu popupBox = new Gtk.Menu();
        Gtk.MenuItem MenuItemOpenPlace = new MenuItem("Открыть торговое место");
        MenuItemOpenPlace.Activated += new EventHandler(OnPlaceOpenPlace);
        MenuItemOpenPlace.Sensitive = ItemSelected;
        popupBox.Add(MenuItemOpenPlace);
        Gtk.MenuItem MenuItemOpenLessee = new MenuItem("Открыть арендатора");
        MenuItemOpenLessee.Activated += new EventHandler(OnPlaceOpenLessee);
        MenuItemOpenLessee.Sensitive = ItemSelected && setLessee;
        popupBox.Add(MenuItemOpenLessee);
        popupBox.ShowAll();
        popupBox.Popup();
    }
Esempio n. 53
0
        public MainWindow()
            : base(WindowType.Toplevel)
        {
            AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask));

            VBox master = new VBox ();
            master.AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask));

            Title = "Ribbons Sample";
            AppPaintable = true;

            VariantsCombinaisonSwitcher page0 = new VariantsCombinaisonSwitcher ();

            RibbonGroup group0 = CreateGroup0 ();
            RibbonGroup group1 = CreateGroup1 ();
            RibbonGroup group2 = CreateGroup2 ();
            DropdownRibbonGroup dgroup0 = CreateDropdownGroup0 ();
            dgroup0.Group = group0;
            DropdownRibbonGroup dgroup1 = CreateDropdownGroup1 ();
            dgroup1.Group = group1;
            DropdownRibbonGroup dgroup2 = CreateDropdownGroup2 ();
            dgroup2.Group = group2;

            VariantsCombinaison combi0 = new VariantsCombinaison ();
            combi0.Append (group0);
            combi0.Append (group1);
            combi0.Append (group2);
            page0.AddCombinaison (combi0);

            VariantsCombinaison combi1 = new VariantsCombinaison ();
            combi1.Append (group0);
            combi1.Append (group1);
            combi1.Append (dgroup2);
            page0.AddCombinaison (combi1);

            VariantsCombinaison combi2 = new VariantsCombinaison ();
            combi2.Append (dgroup0);
            combi2.Append (dgroup1);
            combi2.Append (dgroup2);
            page0.AddCombinaison (combi2);

            HBox page1 = new HBox (false, 2);
            RibbonGroup group10 = new RibbonGroup ();
            group10.Label = "Welcome on the second page";
            page1.PackStart (group10, false, false, 0);

            HBox page2 = new HBox (false, 2);

            Label pageLabel0 = new Label ("Page 1");
            pageLabel1 = new Label ("Page 2");
            Label pageLabel2 = new Label ("Page 3");

            Ribbons.Button shortcuts = new Ribbons.Button ("Menu");
            shortcuts.Child.ModifyFg (Gtk.StateType.Normal, new Gdk.Color(255, 255, 255));

            Menu mainMenu = new Menu ();
            MenuItem mainMenu_quit = new MenuItem ("Quit");
            mainMenu_quit.Activated += delegate (object Sender, EventArgs e)
            {
                Application.Quit ();
            };
            mainMenu.Append (mainMenu_quit);

            shortcuts.Clicked += delegate (object Sender, EventArgs e)
            {
                mainMenu.Popup ();
                mainMenu.ShowAll ();
            };

            QuickAccessToolbar qat = new QuickAccessToolbar ();
            Ribbons.Button qatNew, qatSave;
            qat.Append (qatNew = Ribbons.Button.FromStockIcon (Gtk.Stock.New, false));
            qat.Append (qatSave = Ribbons.Button.FromStockIcon (Gtk.Stock.Save, false));

            ribbon = new Ribbon ();
            ribbon.ApplicationButton = new ApplicationButton ();
            ribbon.QuickAccessToolbar = qat;
            //ribbon.Shortcuts = shortcuts;
            ribbon.AppendPage (page0, pageLabel0);
            ribbon.AppendPage (page1, pageLabel1);
            ribbon.AppendPage (page2, pageLabel2);
            pageLabel1.AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask));
            pageLabel1.ButtonPressEvent += delegate (object sender, ButtonPressEventArgs e)
            {
                Console.WriteLine("label1 press");
            };
            pageLabel1.EnterNotifyEvent += delegate (object sender, EnterNotifyEventArgs e)
            {
                Console.WriteLine("label1 enter");
            };
            pageLabel1.LeaveNotifyEvent += delegate (object sender, LeaveNotifyEventArgs e)
            {
                Console.WriteLine("label1 leave");
            };

            ApplicationMenu appMenu = ribbon.ApplicationButton.Menu;
            TextView mnu = new TextView ();
            appMenu.DefaultMenu = mnu;
            mnu.Buffer.InsertAtCursor ("Default");
            ApplicationMenuItem mi = new ApplicationMenuItem ("Test 1");
            mnu = new TextView ();
            mi.Menu = mnu;
            mnu.Buffer.InsertAtCursor ("Test 1");
            appMenu.Append (mi);
            mi = new ApplicationMenuItem ("Test 2");
            appMenu.Append (mi);
            mi = new ApplicationMenuItem ("Test 3");
            appMenu.Append (mi);

            appMenu.OptionsButton = new Ribbons.Button ("Options");
            appMenu.ExitButton = new Ribbons.Button ("Exit");

            TextView txt = new TextView ();

            master.PackStart (ribbon, false, false, 0);
            master.PackStart (txt, true, true, 0);

            Add (master);

            ribbon.ApplicationButton.KeyTip = new KeyTip (appMenu, "A");
            qat.AddKeyTip (new KeyTip (qatNew, "B"));
            qat.AddKeyTip (new KeyTip (qatSave, "C"));
            ribbon.AddTabKeyTip (new KeyTip (pageLabel0, "D"));
            ribbon.AddTabKeyTip (new KeyTip (pageLabel1, "E"));
            ribbon.AddTabKeyTip (new KeyTip (pageLabel2, "F"));

            ScreenChanged += Window_OnScreenChanged;
            Window_OnScreenChanged (this, null);
            ExposeEvent += Window_OnExpose;
            DeleteEvent += Window_OnDelete;

            this.Resize (200, 200);
            this.ShowAll ();
        }
Esempio n. 54
0
File: Tray.cs Progetto: GNOME/nemo
        private void popupMenuHandler(object o, Gtk.PopupMenuArgs args)
        {
            Menu popupMenu = new Menu();

            // add show
              			ImageMenuItem menuPopup1;
              			if (hidden)
              				menuPopup1 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Show window"));
            else
              				menuPopup1 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Hide window"));
              			menuPopup1.Image = new Image(Stock.Refresh, IconSize.Menu);
              			popupMenu.Add(menuPopup1);
              			menuPopup1.Activated += delegate {
              				if (hidden)
              				{
                    main_window.ShowAll();
                    restore_position();
                    hidden = false;
                    main_window.Unref(); // restore correct reference count
              				}
              				else
              				{
                    hide_window();
              				}
              			};

              			ImageMenuItem menuPopup0 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Indexing status"));
              			popupMenu.Add(menuPopup0);
              			menuPopup0.Activated += delegate {
                Singleton<Indexing>.Instance.Show();
              			};

              			ImageMenuItem menuPopup2 = new ImageMenuItem(Mono.Unix.Catalog.GetString("About"));
              			menuPopup2.Image = new Image(Stock.About, IconSize.Menu);
              			popupMenu.Add(menuPopup2);
              			menuPopup2.Activated += delegate {
                Gtk.AboutDialog about = new AboutDialog();
                about.Name = "Nemo";
                about.Authors = new string[] { "Anders Rune Jensen", "Lau Bech Lauritzen", "Ole Laursen" };
                about.Artists = new string[] { "Linda Nhu", "Sune Theodorsen" };
                about.Comments = Mono.Unix.Catalog.GetString("Nemo is a file manager for those who would rather have their files manage themselves.");
                about.Logo = new Gdk.Pixbuf(null, "blue_guy_med.png");
                about.Response += delegate {
                    about.Destroy();
                };
                about.Show();
              			};

            // add quit
              			ImageMenuItem menuPopup3 = new ImageMenuItem (Mono.Unix.Catalog.GetString("Quit"));
              			menuPopup3.Image = new Image(Stock.Quit, IconSize.Menu);
              			popupMenu.Add(menuPopup3);
              			menuPopup3.Activated += new EventHandler(this.OnPopupClick);

            popupMenu.ShowAll();
              			popupMenu.Popup(null, null, null, (uint)args.Args[0], (uint)args.Args[1]);
        }
Esempio n. 55
0
    private void PopupMenu(int button)
    {
        if(selectedNode == null)
            return;

        Menu popupMenu = new Menu();

        MenuItem deleteItem = new ImageMenuItem(Stock.Delete, null);
        deleteItem.Activated += OnDelete;
        //Do not allow to delete already deleted node or to delete the last node
        deleteItem.Sensitive = (path.Nodes.IndexOf(selectedNode) > -1 && path.Nodes.Count > 1);
        popupMenu.Append(deleteItem);

        MenuItem shiftLeftItem = new ImageMenuItem(Stock.GoBack, null);
        shiftLeftItem.Activated += OnShiftLeft;
        shiftLeftItem.Sensitive = path.Nodes.Count > 1;
        popupMenu.Append(shiftLeftItem);

        MenuItem shiftRightItem = new ImageMenuItem(Stock.GoForward, null);
        shiftRightItem.Activated += OnShiftRight;
        shiftRightItem.Sensitive = path.Nodes.Count > 1;
        popupMenu.Append(shiftRightItem);

        popupMenu.ShowAll();
        popupMenu.Popup();
    }
Esempio n. 56
0
		internal void ShowDockPopupMenu (uint time)
		{
			Menu menu = new Menu ();
			
			// Hide menuitem
			if ((Behavior & DockItemBehavior.CantClose) == 0) {
				MenuItem mitem = new MenuItem (Catalog.GetString("Hide"));
				mitem.Activated += delegate { Visible = false; };
				menu.Append (mitem);
			}

			MenuItem citem;

			// Auto Hide menuitem
			if ((Behavior & DockItemBehavior.CantAutoHide) == 0 && Status != DockItemStatus.AutoHide) {
				citem = new MenuItem (Catalog.GetString("Minimize"));
				citem.Activated += delegate { Status = DockItemStatus.AutoHide; };
				menu.Append (citem);
			}

			if (Status != DockItemStatus.Dockable) {
				// Dockable menuitem
				citem = new MenuItem (Catalog.GetString("Dock"));
				citem.Activated += delegate { Status = DockItemStatus.Dockable; };
				menu.Append (citem);
			}

			// Floating menuitem
			if ((Behavior & DockItemBehavior.NeverFloating) == 0 && Status != DockItemStatus.Floating) {
				citem = new MenuItem (Catalog.GetString("Undock"));
				citem.Activated += delegate { Status = DockItemStatus.Floating; };
				menu.Append (citem);
			}

			if (menu.Children.Length == 0) {
				menu.Destroy ();
				return;
			}

			ShowingContextMemu = true;

			menu.ShowAll ();
			menu.Hidden += (o,e) => {
				ShowingContextMemu = false;
			};
			menu.Popup (null, null, null, 3, time);
		}
Esempio n. 57
0
 private void OniFolderClicked(object o, iFolderClickedArgs args)
 {
     iFolderHolder holder = args.Holder;
        if (holder == null) return;
        switch(args.Button)
        {
     case 3:
      Menu menu = new Menu();
      if (holder.iFolder.IsSubscription)
      {
       MenuItem item_download =
        new MenuItem(Util.GS("Download..."));
       menu.Append(item_download);
       item_download.Activated += new EventHandler(
     DownloadAvailableiFolderHandler);
       menu.Append(new SeparatorMenuItem());
       DomainInformation domain =
        domainController.GetDomain(holder.iFolder.DomainID);
       if (domain == null ||
        domain.MemberUserID == holder.iFolder.OwnerID)
       {
        MenuItem item_delete = new MenuItem (
      Util.GS("Delete from server"));
        menu.Append (item_delete);
        item_delete.Activated += new EventHandler(
      DeleteFromServerHandler);
       }
       else
       {
        MenuItem item_remove_membership = new MenuItem (
      Util.GS("Remove my membership"));
        menu.Append (item_remove_membership);
        item_remove_membership.Activated +=
     new EventHandler(
      RemoveMembershipHandler);
       }
      }
      else
      {
       MenuItem item_open =
        new MenuItem (Util.GS("Open..."));
       menu.Append (item_open);
       item_open.Activated += new EventHandler(
     OnOpenFolderMenu);
       menu.Append(new SeparatorMenuItem());
       if(holder.iFolder.HasConflicts)
       {
        MenuItem item_resolve = new MenuItem (
      Util.GS("Resolve conflicts..."));
        menu.Append (item_resolve);
        item_resolve.Activated += new EventHandler(
     OnResolveConflicts);
        menu.Append(new SeparatorMenuItem());
       }
       MenuItem item_sync =
        new MenuItem(Util.GS("Synchronize now"));
       menu.Append (item_sync);
       item_sync.Activated += new EventHandler(
     OnSynchronizeNow);
       MenuItem item_share =
        new MenuItem (Util.GS("Share with..."));
       menu.Append (item_share);
       item_share.Activated += new EventHandler(
     OnShareSynchronizedFolder);
       if (!holder.iFolder.Role.Equals("Master"))
       {
        MenuItem item_revert = new MenuItem (
      Util.GS("Revert to a normal folder"));
        menu.Append (item_revert);
        item_revert.Activated += new EventHandler(
      RemoveiFolderHandler);
       }
       else if(holder.iFolder.OwnerID !=
       holder.iFolder.CurrentUserID)
       {
        MenuItem item_delete = new MenuItem (
      Util.GS("Revert to a normal folder"));
        menu.Append (item_delete);
        item_delete.Activated += new EventHandler(
      RemoveiFolderHandler);
       }
       menu.Append(new SeparatorMenuItem());
       MenuItem item_properties =
        new MenuItem (Util.GS("Properties"));
       menu.Append (item_properties);
       item_properties.Activated +=
        new EventHandler(OnShowFolderProperties);
      }
      menu.ShowAll();
      menu.Popup(null, null, null,
       IntPtr.Zero, 3,
       Gtk.Global.CurrentEventTime);
      break;
     default:
      break;
        }
 }
Esempio n. 58
0
		public void Activate (Gdk.EventButton eb)
		{
			Menu popup_menu = new Menu ();
			
			if (icon_list.select_count >= 0) {
				GtkUtil.MakeMenuItem (popup_menu, "Copy Image Location", new EventHandler (Action_CopyImageLocation));
				GtkUtil.MakeMenuItem (popup_menu, "Remove Image", new EventHandler (Action_RemoveImage));
                        }
			
			popup_menu.Popup (null, null, null, IntPtr.Zero, eb.Button, eb.Time);
		}
 public void OnUserTreeViewButtonPressed(object obj,
    ButtonPressEventArgs args)
 {
     switch(args.Event.Button)
        {
     case 1:
      break;
     case 2:
      break;
     case 3:
     {
      TreePath tPath = null;
      TreeViewColumn tColumn = null;
      if(UserTreeView.GetPathAtPos( (int)args.Event.X,
      (int)args.Event.Y,
      out tPath,
      out tColumn) == true)
      {
       TreeSelection tSelect = UserTreeView.Selection;
       if( (ifolder.CurrentUserRights == "Admin") &&
        (tSelect.CountSelectedRows() > 0) )
       {
        Menu rightsMenu = new Menu();
        RadioMenuItem adminItem =
     new RadioMenuItem (Util.GS("Full Control"));
        rightsMenu.Append(adminItem);
        RadioMenuItem rwItem =
     new RadioMenuItem (adminItem.Group,
      Util.GS("Read/Write"));
        rightsMenu.Append(rwItem);
        RadioMenuItem roItem =
     new RadioMenuItem (adminItem.Group,
      Util.GS("Read Only"));
        rightsMenu.Append(roItem);
        if(SelectionHasOwnerOrCurrent())
        {
     adminItem.Sensitive = false;
     rwItem.Sensitive = false;
     roItem.Sensitive = false;
        }
        TreeIter iter;
        if(UserTreeStore.GetIter(out iter, tPath))
        {
     iFolderUser user = (iFolderUser)
       UserTreeStore.GetValue(iter, 0);
     if(user.Rights == "ReadWrite")
      rwItem.Active = true;
     else if(user.Rights == "Admin")
      adminItem.Active = true;
     else
      roItem.Active = true;
        }
        adminItem.Activated += new EventHandler(
      OnAdminRightsMenu);
        rwItem.Activated += new EventHandler(
      OnRWRightsMenu);
        roItem.Activated += new EventHandler(
      OnRORightsMenu);
        rightsMenu.ShowAll();
        rightsMenu.Popup(null, null, null,
     IntPtr.Zero, 3,
     Gtk.Global.CurrentEventTime);
       }
      }
      break;
     }
        }
 }
Esempio n. 60
0
        void treeview_inv_ButtonPressEvent(object o, ButtonPressEventArgs args)
        {
            lock (inventory)
            {
                if (args.Event.Button == 3)//F**k this should be a define
                {
                    // Do the context sensitive stuff here
                    // Detect type of asset selected and show an approprate menu
                    // maybe
                    Gtk.TreeModel mod;
                    Gtk.TreeIter iter;
                    InventoryBase item = null;

                    Logger.Log("ROOT IS " + MainClass.client.Inventory.Store.RootFolder.UUID.ToString(),Helpers.LogLevel.Debug);

                    TreePath[] paths = treeview_inv.Selection.GetSelectedRows(out mod);

                    if (paths.Length == 1)
                    {
                        //all good and simple
                        TreeIter itera;
                        mod.GetIter(out itera, paths[0]);
                        UUID ida = (UUID)mod.GetValue(itera, 2);
                        item = (InventoryBase)MainClass.client.Inventory.Store.GetNodeFor(ida).Data;

                    }

                    if (paths.Length > 1)
                    {
                        bool allsame = true;
                        bool wearables = true;
                        bool folders = true;
                        TreeIter itera, iterb;

                        foreach (TreePath path in paths)
                        {
                            mod.GetIter(out itera, path);
                            UUID ida = (UUID)mod.GetValue(itera, 2);
                            InventoryBase itema = (InventoryBase)MainClass.client.Inventory.Store.GetNodeFor(ida).Data;
                            if (!(itema is InventoryWearable))
                                wearables = false;
                            if (!(itema is InventoryFolder))
                                folders = false;

                            foreach (TreePath innerpath in paths)
                            {
                                mod.GetIter(out iterb, innerpath);
                                UUID idb = (UUID)mod.GetValue(iterb, 2);
                                InventoryBase itemb = (InventoryBase)MainClass.client.Inventory.Store.GetNodeFor(idb).Data;

                                if (itema.GetType() != itemb.GetType())
                                {
                                    allsame = false;
                                }
                            }

                        }

                        //ok if allsame==true we can allow specific extra menu options
                        //or if all wearables then we can allow wearable options
                        if (allsame)
                        {
                            mod.GetIter(out iter, paths[0]);
                            UUID ida = (UUID)mod.GetValue(iter, 2);
                            item = (InventoryBase)MainClass.client.Inventory.Store.GetNodeFor(ida).Data;
                        }
                        else if (wearables)
                        {
                            item = new InventoryWearable(UUID.Zero); //fake an item
                        }

                    }

                    if (item == null)
                        return;

                    Gtk.Menu menu = new Gtk.Menu();

                    Logger.Log("Item is " + item.ToString() + " ID is " + item.UUID.ToString(),Helpers.LogLevel.Debug);

                    Logger.Log("Item parent is " + item.ToString() + " ID is " + item.ParentUUID.ToString(),Helpers.LogLevel.Debug);

                    if (item is InventoryLandmark)
                    {
                        Gtk.ImageMenuItem menu_tp_lm = new ImageMenuItem("Teleport to Landmark");
                        menu_tp_lm.Image = new Gtk.Image(MainClass.GetResource("icon_place.png"));
                        menu_tp_lm.ButtonPressEvent += new ButtonPressEventHandler(Teleporttolandmark);
                        menu.Append(menu_tp_lm);
                    }

                    if (item is InventoryFolder)
                    {
                        if (item.UUID == trash_folder)
                        {
                            Gtk.ImageMenuItem menu_delete_folder = new ImageMenuItem("Empty Trash");
                            menu_delete_folder.Image = new Gtk.Image(MainClass.GetResource("inv_folder_trash.png"));
                            menu_delete_folder.ButtonPressEvent += new ButtonPressEventHandler(onemptytrash);
                            menu.Append(menu_delete_folder);
                        }
                        else
                        {

                          if (item.UUID == MainClass.client.Inventory.Store.LibraryFolder.UUID)
                                return;

                            Gtk.MenuItem menu_wear_folder = new MenuItem("Wear folder contents");
                            Gtk.ImageMenuItem menu_give_folder = new ImageMenuItem("Give folder to user");
                            menu_give_folder.Image = new Gtk.Image(MainClass.GetResource("ff_edit_theirs.png"));

                            Gtk.ImageMenuItem new_note = new ImageMenuItem("Create new notecard");
                            new_note.Image = new Gtk.Image(MainClass.GetResource("inv_item_notecard.png"));

                            Gtk.ImageMenuItem new_script = new ImageMenuItem("Create new script");
                            new_script.Image = new Gtk.Image(MainClass.GetResource("inv_item_script.png"));

                            Gtk.ImageMenuItem new_folder = new ImageMenuItem("Create new folder");
                            new_folder.Image = new Gtk.Image(MainClass.GetResource("inv_folder_plain_open.png"));

                            Gtk.ImageMenuItem menu_cut_folder = new ImageMenuItem("Cut Folder");
                            menu_cut_folder.Image = new Gtk.Image(Gtk.Stock.Cut, IconSize.Menu);

                            Gtk.ImageMenuItem menu_copy_folder = new ImageMenuItem("Copy Folder");
                            menu_copy_folder.Image = new Gtk.Image(Gtk.Stock.Copy, IconSize.Menu);

                            Gtk.ImageMenuItem menu_paste_folder = new ImageMenuItem("Paste here..");
                            menu_paste_folder.Image = new Gtk.Image(Gtk.Stock.Paste, IconSize.Menu);

                            Gtk.ImageMenuItem menu_delete_folder = new ImageMenuItem("Delete Folder");
                            menu_delete_folder.Image = new Gtk.Image(MainClass.GetResource("inv_folder_trash.png"));

                            menu_delete_folder.ButtonPressEvent += new ButtonPressEventHandler(ondeleteasset);
                            menu_give_folder.ButtonPressEvent += new ButtonPressEventHandler(ongiveasset);
                            menu_wear_folder.ButtonPressEvent += new ButtonPressEventHandler(menu_ware_ButtonPressEvent);
                            //menu_debork.ButtonPressEvent += new ButtonPressEventHandler(FixBorkedFolder);
                            new_note.ButtonPressEvent += new ButtonPressEventHandler(menu_on_new_note);
                            new_script.ButtonPressEvent += new ButtonPressEventHandler(menu_on_new_script);
                            new_folder.ButtonPressEvent += new ButtonPressEventHandler(menu_on_new_folder);
                            menu_cut_folder.ButtonPressEvent += new ButtonPressEventHandler(menu_on_cut_folder);
                            menu_copy_folder.ButtonPressEvent += new ButtonPressEventHandler(menu_on_copy_folder);
                            menu_paste_folder.ButtonPressEvent += new ButtonPressEventHandler(menu_on_paste_folder);

                            Gtk.Label x = new Gtk.Label("Folder Item");

                            if (item.UUID != MainClass.client.Inventory.Store.RootFolder.UUID)
                            {
                                //menu.Append(menu_debork);
                                menu.Append(menu_wear_folder);
                            }

                            if (paths.Length == 1)
                            {
                                menu.Append(new Gtk.SeparatorMenuItem());
                                menu.Append(new_note);
                                menu.Append(new_script);
                                menu.Append(new_folder);
                            }

                            if (item.UUID != MainClass.client.Inventory.Store.RootFolder.UUID)
                            {
                                menu.Append(new Gtk.SeparatorMenuItem());
                                menu.Append(menu_give_folder);
                            }

                            menu.Append(new Gtk.SeparatorMenuItem());

                            if (item.UUID != MainClass.client.Inventory.Store.RootFolder.UUID)
                            {
                                menu.Append(menu_cut_folder);
                            }
                                //menu.Append(menu_copy_folder);
                            if (cutcopylist.Count > 0)
                                menu.Append(menu_paste_folder);

                            if (item.UUID != MainClass.client.Inventory.Store.RootFolder.UUID)
                            {
                                menu.Append(new Gtk.SeparatorMenuItem());
                                menu.Append(menu_delete_folder);
                            }
                        }
                    }
                    if (item is InventoryNotecard)
                    {
                        Gtk.MenuItem menu_read_note = new MenuItem("Open notecard");
                        menu_read_note.ButtonPressEvent += new ButtonPressEventHandler(onOpenNotecard);
                        menu.Append(menu_read_note);

                    }

                    if (item is InventoryLSL)
                    {
                        Gtk.MenuItem menu_read_note = new MenuItem("Open script");
                        menu_read_note.ButtonPressEvent += new ButtonPressEventHandler(onOpenScript);
                        menu.Append(menu_read_note);

                    }

                    if (item is InventoryTexture || item is InventorySnapshot)
                    {
                        Gtk.MenuItem menu_view_texture = new MenuItem("View texture");
                        menu_view_texture.ButtonPressEvent += new ButtonPressEventHandler(onViewTexture);
                        menu.Append(menu_view_texture);
                    }

                    if (item is InventoryAttachment || item is InventoryObject)
                    {
                        Gtk.MenuItem menu_attach_item = new MenuItem("Attach (default pos)");
                        menu_attach_item.ButtonPressEvent += new ButtonPressEventHandler(menu_attach_item_ButtonPressEvent);
                        menu.Append(menu_attach_item);
                    }

                    if (item is InventoryWearable)
                    {
                        Gtk.MenuItem menu_attach_item = new MenuItem("Wear");
                        menu_attach_item.ButtonPressEvent += new ButtonPressEventHandler(menu_wear_item_ButtonPressEvent);
                        menu.Append(menu_attach_item);
                    }

                    if (item is InventoryItem)
                    {

                        Gtk.ImageMenuItem menu_give_item = new ImageMenuItem("Give item to user");
                        menu_give_item.Image = new Gtk.Image(MainClass.GetResource("ff_edit_theirs.png"));

                        Gtk.ImageMenuItem menu_delete_item = new ImageMenuItem("Delete item");
                        menu_delete_item.Image = new Gtk.Image(MainClass.GetResource("inv_folder_trash.png"));

                        menu_give_item.ButtonPressEvent += new ButtonPressEventHandler(ongiveasset);
                        menu_delete_item.ButtonPressEvent += new ButtonPressEventHandler(ondeleteasset);
                        menu.Append(new Gtk.SeparatorMenuItem());
                        menu.Append(menu_give_item);
                        menu.Append(new Gtk.SeparatorMenuItem());

                        Gtk.ImageMenuItem menu_cut_folder = new ImageMenuItem("Cut Item(s)");
                        menu_cut_folder.Image = new Gtk.Image(Gtk.Stock.Cut, IconSize.Menu);
                        Gtk.ImageMenuItem menu_copy_folder = new ImageMenuItem("Copy Item(s)");
                        menu_copy_folder.Image = new Gtk.Image(Gtk.Stock.Copy, IconSize.Menu);
                        menu_cut_folder.ButtonPressEvent += new ButtonPressEventHandler(menu_on_cut_folder);
                        menu_copy_folder.ButtonPressEvent += new ButtonPressEventHandler(menu_on_copy_folder);
                        menu.Append(menu_cut_folder);
                        // menu.Append(menu_copy_folder);

                        menu.Append(new Gtk.SeparatorMenuItem());
                        menu.Append(menu_delete_item);
                    }

                    menu.Popup();
                    menu.ShowAll();

                }
            }
        }