本文整理汇总了C#中Gtk.Menu.Append方法的典型用法代码示例。如果您正苦于以下问题:C# Menu.Append方法的具体用法?C# Menu.Append怎么用?C# Menu.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Menu
的用法示例。
在下文中一共展示了Menu.Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MenuBarController
public MenuBarController()
{
MenuBar mb = new MenuBar();
Menu filemenu = new Menu();
MenuItem file = new MenuItem("File");
file.Submenu = filemenu;
ImageMenuItem importDirectoryMenuItem = new ImageMenuItem("Import Directory");
importDirectoryMenuItem.Activated += ImportDirectoryMenuItemOnActivated;
filemenu.Append(importDirectoryMenuItem);
ImageMenuItem open = new ImageMenuItem(Stock.Open);
filemenu.Append(open);
SeparatorMenuItem sep = new SeparatorMenuItem();
filemenu.Append(sep);
ImageMenuItem exit = new ImageMenuItem(Stock.Quit);
exit.Activated += (sender, args) => Application.Quit();
filemenu.Append(exit);
mb.Append(file);
View = mb;
}
示例2: 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 ();
}
示例3: VolatileReader
public VolatileReader()
: base("Volatile Reader")
{
this.Build ();
SetDefaultSize(250,200);
SetPosition(Gtk.WindowPosition.Center);
DeleteEvent += delegate(object o, DeleteEventArgs args) {
Application.Quit();
};
MenuBar bar = new MenuBar();
Menu fileMenu = new Menu();
MenuItem fileMenuItem = new MenuItem("File");
fileMenuItem.Submenu = fileMenu;
MenuItem exit = new MenuItem("Exit");
exit.Activated += delegate(object sender, EventArgs e) {
Application.Quit();
};
MenuItem openFile = new MenuItem("Open file...");
openFile.Activated += OpenFile;
fileMenu.Append(openFile);
fileMenu.Append(exit);
bar.Append(fileMenuItem);
_vbox = new VBox(false, 2);
_vbox.PackStart(bar, false, false, 0);
this.Add(_vbox);
this.ShowAll();
}
示例4: PlayListTreeView
public PlayListTreeView()
{
this.HeadersVisible = false;
ls = new ListStore(typeof(PlayListPlay));
this.Model = ls;
menu = new Menu();
MenuItem title = new MenuItem(Catalog.GetString("Edit Title"));
title.Activated += new EventHandler(OnTitle);
title.Show();
MenuItem delete = new MenuItem(Catalog.GetString("Delete"));
delete.Activated += new EventHandler(OnDelete);
delete.Show();
setRate = new MenuItem(Catalog.GetString("Apply current play rate"));
setRate.Activated += new EventHandler(OnApplyRate);
setRate.Show();
menu.Append(title);
menu.Append(setRate);
menu.Append(delete);
Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn();
nameColumn.Title = Catalog.GetString("Name");
Gtk.CellRendererText nameCell = new Gtk.CellRendererText();
nameColumn.PackStart(nameCell, true);
nameColumn.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc(RenderName));
this.AppendColumn(nameColumn);
}
示例5: AppMenuBar
public AppMenuBar()
: base()
{
/* File menu */
fileMenuItem =
new MenuItem (Catalog.GetString ("_File"));
Append (fileMenuItem);
Menu menu = new Menu ();
fileMenuItem.Submenu = menu;
menu.Append (new SeparatorMenuItem ());
ImageMenuItem item =
new ImageMenuItem (Catalog.
GetString ("_Quit"));
item.Image = new Image (Stock.Quit, IconSize.Menu);
item.Activated += OnQuit;
quitMenuItem = item;
menu.Append (item);
/* Edit menu */
editMenuItem =
new MenuItem (Catalog.GetString ("_Edit"));
editMenuItem.Submenu = new Menu ();
Append (editMenuItem);
/* View menu */
viewMenuItem =
new MenuItem (Catalog.GetString ("_View"));
viewMenuItem.Submenu = new Menu ();
Append (viewMenuItem);
/* Help menu */
helpMenuItem =
new MenuItem (Catalog.GetString ("_Help"));
Append (helpMenuItem);
menu = new Menu ();
helpMenuItem.Submenu = menu;
item = new ImageMenuItem (Catalog.
GetString ("_About"));
item.Image = new Image (Stock.About, IconSize.Menu);
item.Activated += OnAbout;
menu.Append (item);
item = new ImageMenuItem (Catalog.
GetString ("_Contents"));
item.Activated += OnContents;
item.Image = new Image (Stock.Help, IconSize.Menu);
menu.Append (item);
ShowAll ();
}
示例6: MakeMenu
private Gtk.Menu MakeMenu (Gtk.Widget parent)
{
Gtk.Menu menu = new Gtk.Menu ();
menu.AttachToWidget (parent, new Gtk.MenuDetachFunc (DetachWidget));
Gtk.ImageMenuItem item;
// Quick Search menu items
if (recent_searches.Count == 0) {
item = new Gtk.ImageMenuItem (Catalog.GetString ("No Recent Searches"));
item.Sensitive = false;
menu.Append (item);
menu_to_query_map = null;
} else {
item = new Gtk.ImageMenuItem (Catalog.GetString ("Recent Searches"));
item.Sensitive = false;
item.Image = new Gtk.Image (Stock.Find, IconSize.Menu);
menu.Append (item);
menu_to_query_map = new Hashtable ();
foreach (string s in recent_searches) {
// Replace all occurences of '_' with "__"
// so that underscores don't become mnemonics.
string query = s.Replace ("_", "__");
item = new Gtk.ImageMenuItem (query);
item.Activated += new EventHandler (OnSearch);
menu.Append (item);
menu_to_query_map [item] = s;
}
}
if (recent_searches.Count > 0) {
item = new Gtk.ImageMenuItem (Catalog.GetString ("Clear"));
item.Image = new Gtk.Image (Gtk.Stock.Clear, Gtk.IconSize.Menu);
item.Activated += new EventHandler (OnClear);
menu.Append (item);
}
menu.Append (new Gtk.SeparatorMenuItem ());
item = new Gtk.ImageMenuItem (Catalog.GetString ("Quit"));
item.Image = new Gtk.Image (Gtk.Stock.Quit, Gtk.IconSize.Menu);
item.Activated += new EventHandler (OnQuit);
menu.Append (item);
menu.ShowAll ();
return menu;
}
示例7: 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;
}
示例8: 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();
}
示例9: 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;
}
示例10: 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 ();
}
示例11: Build
public void Build()
{
// file menu
file = new MenuItem("File");
fileMenu = new Menu();
file.Submenu = fileMenu;
openMenuItem = new MenuItem ("Open Sqlite database");
openMenuItem.Activated += OnNewSqliteDbActivated;
fileMenu.Append (openMenuItem);
newSqlEditorMenuItem = new MenuItem ("New Sql Editor Tab");
newSqlEditorMenuItem.Sensitive = false;
newSqlEditorMenuItem.Activated += OnNewSqlEditorWindowActivated;
fileMenu.Append (newSqlEditorMenuItem);
exitMenuItem = new MenuItem ("Exit");
exitMenuItem.Activated += OnExitActivated;
fileMenu.Append (exitMenuItem);
this.Append (file);
// setup edit menu
edit = new MenuItem("Edit");
editMenu = new Menu ();
edit.Submenu = editMenu;
this.Append (edit);
// setup database menu
database = new MenuItem("Database");
databaseMenu = new Menu ();
database.Submenu = databaseMenu;
newSqliteDbMenuItem = new MenuItem ("New Sqlite DB");
newSqliteDbMenuItem.Activated += OnNewSqliteDbActivated;
databaseMenu.Append (newSqliteDbMenuItem);
openSqliteDbMenuItem = new MenuItem ("Open Sqlite DB");
openSqliteDbMenuItem.Activated += OnOpenSqliteDbActivated;
databaseMenu.Append (openSqliteDbMenuItem);
this.Append (database);
// initialize event handlers
ApplicationState.Instance.CurrentConnectionChanged += (sender, e) => newSqlEditorMenuItem.Sensitive = e.DbServerConnection != null;
}
示例12: ChatPageMenu
public ChatPageMenu(ChatSubpageBase page)
{
m_Page = page;
m_Menu = new Menu();
var closeItem = new ImageMenuItem(Stock.Close, null);
closeItem.Activated += HandleCloseItemActivated;
m_Menu.Append(closeItem);
m_Menu.ShowAll();
}
示例13: Main
public static void Main(string[] args)
{
Application.Init ();
//MainWindow win = new MainWindow ();
//win.Show ();
MoonlightRuntime.Init ();
Window w = new Window ("mldsp");
w.DefaultHeight = 520;
w.DefaultWidth = 760;
w.DeleteEvent += delegate { Application.Quit (); };
var moon = new MoonlightHost ();
var xappath = System.IO.Path.Combine (System.IO.Path.GetDirectoryName (new Uri (typeof (MainClass).Assembly.CodeBase).LocalPath), "mldsp.clr.xap");
moon.LoadXap (xappath);
if (args.Length > 0) {
int device;
if (int.TryParse (args [0], out device))
((mldsp.App) moon.Application).OutputDeviceID = device;
else {
Console.WriteLine ("WARNING: wrong device ID speficication. Specify an index.");
foreach (var dev in PortMidiSharp.MidiDeviceManager.AllDevices)
if (dev.IsOutput)
Console.WriteLine ("{0} {1}", dev.ID, dev.Name);
}
}
var vbox = new VBox (false, 0);
w.Add (vbox);
var mainmenu = new MenuBar ();
vbox.PackStart (mainmenu, false, true, 0);
var optmi = new MenuItem ("_Options");
mainmenu.Add (optmi);
var devmi = new MenuItem ("Select Device");
var optmenu = new Menu ();
optmi.Submenu = optmenu;
optmenu.Append (devmi);
var devlist = new SList (IntPtr.Zero);
var devmenu = new Menu ();
devmi.Submenu = devmenu;
foreach (var dev in PortMidiSharp.MidiDeviceManager.AllDevices) {
if (dev.IsOutput) {
var mi = new RadioMenuItem (devlist, dev.Name);
mi.Data ["Device"] = dev.ID;
devlist = mi.Group;
int id = dev.ID;
mi.Activated += delegate {
((mldsp.App) moon.Application).ResetDevice ((int) mi.Data ["Device"]);
};
devmenu.Append (mi);
}
}
vbox.PackEnd (moon);
w.ShowAll ();
Application.Run ();
}
示例14: BuildAddToMenu
public Menu BuildAddToMenu(System.EventHandler handler)
{
Menu bookmarkMenu = new Menu();
string[] bookmarks = m_App.CacheStore.GetBookmarkLists();
foreach(string bookmark in bookmarks)
{
Action action = new Action(bookmark, bookmark);
action.Activated += handler;
bookmarkMenu.Append(action.CreateMenuItem());
}
return bookmarkMenu;
}
示例15: CreateMenu
private Gtk.MenuBar CreateMenu ()
{
MenuBar menu = new MenuBar ();
// File
Menu fileSub = new Menu ();
MenuItem file = new MenuItem ("File");
file.Submenu = fileSub;
MenuItem login = new MenuItem ("Login");
MenuItem exit = new MenuItem ("Exit");
fileSub.Append (login);
fileSub.Append (exit);
// Options
Menu optionSub = new Menu ();
MenuItem option = new MenuItem ("Options");
option.Submenu = optionSub;
MenuItem preferences = new MenuItem ("Preferences");
optionSub.Append (preferences);
// Help
Menu helpSub = new Menu ();
MenuItem help = new MenuItem ("Help");
help.Submenu = helpSub;
MenuItem about = new MenuItem ("About");
helpSub.Append (about);
// Menubar
menu.Append (file);
menu.Append (option);
menu.Append (help);
return menu;
}