本文整理汇总了C#中Gtk.Menu.Popup方法的典型用法代码示例。如果您正苦于以下问题:C# Menu.Popup方法的具体用法?C# Menu.Popup怎么用?C# Menu.Popup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Menu
的用法示例。
在下文中一共展示了Menu.Popup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Activate
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);
}
示例2: MainWindow
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;
}
示例3: OnPressed
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);
}
示例4: OnConfigListTreeviewButtonPressEvent
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();
}
}
示例5: CreateDirectoryMenu
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();
}
示例6: FileMaskEntry
//(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();
}
示例7: OnTrayIconPopup
// 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";
}
示例8: CreateDefaultMenu
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();
}
示例9: OnTrayIconPopup
// 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();
}
示例10: Activate
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);
}
示例11: CreateMediaMenu
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();
}
示例12: OnImageClick
// 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);
}
}
示例13: Activate
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);
}
示例14: OnUserTreeViewButtonPressed
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;
}
}
}
示例15: OnTreeviewPlacesPopupMenu
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();
}