本文整理汇总了C#中Gtk.Menu类的典型用法代码示例。如果您正苦于以下问题:C# Menu类的具体用法?C# Menu怎么用?C# Menu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Menu类属于Gtk命名空间,在下文中一共展示了Menu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConnectionMenu
public ConnectionMenu(TreeView connectionList)
{
this.connectionList = connectionList;
Glade.XML xmlMnuConnections = new Glade.XML(null, "FileFind.Meshwork.GtkClient.meshwork.glade", "mnuConnections", null);
mnuConnections = (xmlMnuConnections.GetWidget("mnuConnections") as Gtk.Menu);
xmlMnuConnections.Autoconnect (this);
}
示例2: 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);
}
示例3: TransfersMenu
public TransfersMenu(TreeView transfersList, IFileTransfer transfer)
{
Glade.XML glade = new Glade.XML(null, "FileFind.Meshwork.GtkClient.meshwork.glade", "TransfersMenu", null);
glade.Autoconnect(this);
this.menu = (Gtk.Menu) glade.GetWidget("TransfersMenu");
this.transfersList = transfersList;
this.transfer = transfer;
if (transfer != null) {
mnuCancelAndRemoveTransfer.Visible = true;
mnuShowTransferDetails.Sensitive = true;
mnuClearFinishedFailedTransfers.Sensitive = true;
if (transfer.Status == FileTransferStatus.Paused) {
mnuPauseTransfer.Visible = false;
mnuResumeTransfer.Visible = true;
mnuResumeTransfer.Sensitive = true;
mnuCancelTransfer.Sensitive = true;
} else if (transfer.Status == FileTransferStatus.Canceled || transfer.Status == FileTransferStatus.Completed) {
mnuPauseTransfer.Sensitive = false;
mnuResumeTransfer.Visible = false;
mnuCancelTransfer.Sensitive = false;
}
} else {
mnuCancelAndRemoveTransfer.Visible = false;
mnuShowTransferDetails.Sensitive = false;
mnuPauseTransfer.Sensitive = false;
mnuResumeTransfer.Visible = false;
mnuCancelTransfer.Sensitive = false;
}
}
示例4: CreateMenus
Gtk.MenuBar CreateMenus ()
{
AccelGroup group = new AccelGroup ();
MenuBar bar = new MenuBar ();
Menu file_menu = new Menu ();
MenuItem file_menu_item = new MenuItem ("_File");
file_menu_item.Submenu = file_menu;
ImageMenuItem file_exit = new ImageMenuItem (Gtk.Stock.Quit, group);
file_exit.Activated += new EventHandler (exit_cb);
file_menu.Append (file_exit);
bar.Append (file_menu_item);
Menu help_menu = new Menu ();
ImageMenuItem help_menu_item = new ImageMenuItem (Gtk.Stock.Help, group);
help_menu_item.Submenu = help_menu;
ImageMenuItem file_help = new ImageMenuItem (Gnome.Stock.About, group);
file_help.Activated += new EventHandler (about_cb);
help_menu.Append (file_help);
bar.Append (help_menu_item);
bar.ShowAll ();
return bar;
}
示例5: TrackListHeaderMenuController
public TrackListHeaderMenuController(BaseTrackListViewController trackListViewController)
{
var visibleColumns = trackListViewController.GetColumnTrackProperties().ToHashSet();
Menu headerMenu = new Menu();
foreach (TrackProperty trackProperty in Enum.GetValues(typeof(TrackProperty)))
{
var trackPropertyMenuItem = new CheckMenuItem(Extensions.GetEnumDescription(trackProperty));
if (visibleColumns.Contains(trackProperty))
trackPropertyMenuItem.Active = true;
TrackProperty property = trackProperty;
trackPropertyMenuItem.Toggled += (sender, args) =>
{
if (trackPropertyMenuItem.Active)
trackListViewController.InsertColumn(property, ClickedProperty);
else
trackListViewController.RemoveColumn(property);
};
headerMenu.Append(trackPropertyMenuItem);
}
View = headerMenu;
View.ShowAll();
}
示例6: ParseTreeWindow
public ParseTreeWindow(RuntimeThread runtimeThread) : base("Parse Tree")
{
runtimeThread.Runtime.ParseTrace.ParsedEvent += OnParsed;
SetDefaultSize(250, 300);
SkipPagerHint = true;
SkipTaskbarHint = true;
scroller = new ScrolledWindow();
scroller.BorderWidth = 5;
scroller.ShadowType = ShadowType.In;
Add(scroller);
store = new TreeStore(typeof(string), typeof(object));
view = new TreeView(store);
column = view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
view.HeadersVisible = false;
view.RowActivated += OnTreeRowActivated;
view.ButtonPressEvent += OnTreeButtonPress;
scroller.Add(view);
MenuBuilder menuBuilder = new MenuBuilder();
menu = menuBuilder.StartMenu();
menuBuilder.Add("Show source", OnMenuShowSource);
menuBuilder.Add("Show object", OnMenuShowObject);
menu.ShowAll();
}
示例7: HandleTrayIconPopupMenu
static void HandleTrayIconPopupMenu(object o, PopupMenuArgs args)
{
Menu popupMenu = new Menu ();
ImageMenuItem menuItemQuit = new ImageMenuItem ("Quit");
ImageMenuItem menuItemEnabled;
if(Preferences.Enabled)
{
menuItemEnabled = new ImageMenuItem ("Disable");
menuItemEnabled.Image = new Gtk.Image (Gtk.Stock.Yes, IconSize.Menu);
}
else
{
// hopefully prevent any major mem leaks
menuItemEnabled = new ImageMenuItem ("Enable");
menuItemEnabled.Image = new Gtk.Image(Gtk.Stock.Yes, IconSize.Menu);
}
menuItemQuit.Image = new Gtk.Image (Gtk.Stock.Quit, IconSize.Menu);
popupMenu.Add(menuItemQuit);
popupMenu.Add(menuItemEnabled);
menuItemQuit.Activated += delegate(object sender, EventArgs e) {
Application.Quit();
};
menuItemEnabled.Activated += HandleMenuItemEnabledActivated;
popupMenu.ShowAll();
popupMenu.Popup();
}
示例8: Main21
public static void Main21 (string[] args)
{
Application.Init();
Window win = new Window ("Menu Sample App");
win.DeleteEvent += new DeleteEventHandler (delete_cb);
win.DefaultWidth = 200;
win.DefaultHeight = 150;
VBox box = new VBox (false, 2);
MenuBar mb = new MenuBar ();
Menu file_menu = new Menu ();
MenuItem exit_item = new MenuItem("Exit");
exit_item.Activated += new EventHandler (exit_cb);
file_menu.Append (exit_item);
MenuItem file_item = new MenuItem("File");
file_item.Submenu = file_menu;
mb.Append (file_item);
box.PackStart(mb, false, false, 0);
Button btn = new Button ("Yep, that's a menu");
box.PackStart(btn, true, true, 0);
win.Add (box);
win.ShowAll ();
Application.Run ();
}
示例9: VideoContextMenu
// create the context menu
public VideoContextMenu()
: base()
{
MenuItem aspect_ratio = new MenuItem ("Aspect Ratio");
ImageMenuItem fullscreen = new ImageMenuItem (Stock.Fullscreen, null);
Menu aspect_menu = new Menu ();
aspect_auto = new RadioMenuItem ("Auto");
aspect_4x3 = new RadioMenuItem (aspect_auto, "4:3");
aspect_16x9 = new RadioMenuItem (aspect_auto, "16:9");
aspect_16x10 = new RadioMenuItem (aspect_auto, "16:10");
aspect_menu.Add (aspect_auto);
aspect_menu.Add (aspect_4x3);
aspect_menu.Add (aspect_16x9);
aspect_menu.Add (aspect_16x10);
aspect_ratio.Submenu = aspect_menu;
this.Add (aspect_ratio);
showVisualisations ();
this.Add (new SeparatorMenuItem ());
this.Add (fullscreen);
fullscreen.Activated += fullscreen_activated;
aspect_auto.ButtonReleaseEvent += aspect_auto_toggled;
aspect_4x3.ButtonReleaseEvent += aspect_4x3_toggled;
aspect_16x9.ButtonReleaseEvent += aspect_16x9_toggled;
aspect_16x10.ButtonReleaseEvent += aspect_16x10_toggled;
toggle_aspect_value ();
}
示例10: CreateMenu
private Menu CreateMenu (int depth, bool tearoff)
{
if (depth < 1)
return null;
Menu menu = new Menu ();
RadioMenuItem[] group = null;
if (tearoff) {
TearoffMenuItem menuitem = new TearoffMenuItem ();
menu.Append (menuitem);
}
for (int i = 0, j = 1; i < 5; i++, j++) {
RadioMenuItem menuitem = new RadioMenuItem (group, String.Format ("item {0} - {1}", depth, j));
group = menuitem.Group;
menu.Append (menuitem);
if (i == 3)
menuitem.Sensitive = false;
menuitem.Submenu = CreateMenu ((depth - 1), true);
}
return menu;
}
示例11: EquipmentReceptionView
public EquipmentReceptionView()
{
this.Build();
ytreeEquipment.ColumnsConfig = Gamma.GtkWidgets.ColumnsConfigFactory.Create<ReceptionEquipmentItemNode> ()
.AddColumn ("Номенклатура").AddTextRenderer (node => node.Name)
.AddColumn ("Серийный номер").AddTextRenderer (node => node.Serial)
.AddColumn ("Кол-во")
.AddToggleRenderer (node => node.Returned, false)
.AddNumericRenderer (node => node.Amount, false)
.AddColumn("Номер заявки на сервис")
.AddTextRenderer(
node => node.ServiceClaim != null
? node.ServiceClaim.Id.ToString()
: "")
.AddColumn("")
.Finish ();
ytreeEquipment.Selection.Changed += YtreeEquipment_Selection_Changed;
ytreeEquipment.ItemsDataSource = ReceptionEquipmentList;
//Создаем меню в кнопке выбора СН
var menu = new Menu();
menuitemRegisterSerial = new MenuItem("Зарегистрировать новый СН");
menuitemRegisterSerial.Activated += MenuitemRegisterSerial_Activated;
menu.Add(menuitemRegisterSerial);
menuitemSelectFromClient = new MenuItem("Выбрать по клиенту");
menuitemSelectFromClient.Activated += MenuitemSelectFromClient_Activated;
menu.Add(menuitemSelectFromClient);
var menuitemSelectFromUnused = new MenuItem("Незадействованные СН");
menuitemSelectFromUnused.Activated += MenuitemSelectFromUnused_Activated;
menu.Add(menuitemSelectFromUnused);
menu.ShowAll();
buttonSelectSerial.Menu = menu;
}
示例12: GlobalKeybinder
/// <summary>
/// Create a global keybinder for the given Gtk.AccelGroup.
/// </summary>
/// </param>
public GlobalKeybinder(Gtk.AccelGroup accel_group)
{
this.accel_group = accel_group;
fake_menu = new Gtk.Menu ();
fake_menu.AccelGroup = accel_group;
}
示例13: 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;
}
示例14: TIcon
public TIcon(CInterfaceGateway in_krnGateway, Gtk.Window mwindow)
{
krnGateway = in_krnGateway;
mainwindow = mwindow;
menu = new Gtk.Menu ();
EventBox eb = new EventBox ();
eb.ButtonPressEvent += new ButtonPressEventHandler (TIconClicked);
eb.Add (new Gtk.Image (new Gdk.Pixbuf (null, "lPhant.png")));
MenuItem it_show = new MenuItem ("Show");
it_show.Activated += new EventHandler (TIconShow);
MenuItem it_options = new MenuItem ("Options");
it_options.Activated += new EventHandler (TIconOptions);
ImageMenuItem it_quit = new ImageMenuItem("Quit");
it_quit.Activated += new EventHandler (TIconQuit);
menu.Append (it_show);
menu.Append (it_options);
menu.Append (it_quit);
t = new TrayIcon ("eLePhantGTK");
t.Add (eb);
t.ShowAll ();
}
示例15: GrammarWindow
public GrammarWindow(RuntimeThread runtimeThread) : base("Grammar")
{
runtimeThread.Runtime.Grammar.Trace.PatternDefinedEvent += OnGrammarPatternDefined;
runtimeThread.Runtime.Grammar.Trace.PatternChangedEvent += OnGrammarPatternChanged;
SetDefaultSize(250, 300);
SkipPagerHint = true;
SkipTaskbarHint = true;
scroller = new ScrolledWindow();
scroller.BorderWidth = 5;
scroller.ShadowType = ShadowType.In;
Add(scroller);
store = new TreeStore(typeof(string), typeof(Source));
// FIXME - only want to sort top level
//TreeModelSort storeSort = new TreeModelSort(store);
//storeSort.SetSortColumnId(0, SortType.Ascending);
view = new TreeView(store);
view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
view.HeadersVisible = false;
view.RowActivated += OnTreeRowActivated;
view.ButtonPressEvent += OnTreeButtonPress;
scroller.Add(view);
MenuBuilder menuBuilder = new MenuBuilder();
menu = menuBuilder.StartMenu();
menuBuilder.Add("Show source", OnMenuShowSource);
menuBuilder.Add("Show object", OnMenuShowObject);
menu.ShowAll();
}