本文整理汇总了C#中Gtk.MenuBar.Add方法的典型用法代码示例。如果您正苦于以下问题:C# MenuBar.Add方法的具体用法?C# MenuBar.Add怎么用?C# MenuBar.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.MenuBar
的用法示例。
在下文中一共展示了MenuBar.Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 ();
}
示例2: MainWindow
public MainWindow(string title)
: base(title)
{
// when this window is deleted, it'll run delete_event()
DeleteEvent += delete_event;
Shown += new EventHandler(window_Shown);
// Add the button to the window and display everything
MenuBar menuBar = new MenuBar();
menuBar.Add(new MenuItem("File"));
treeView = new TreeView();
// Create a column for the artist name
Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn();
nameColumn.Title = "Name";
// Create the text cell that will display the artist name
Gtk.CellRendererText fileNameCell = new Gtk.CellRendererText();
// Add the cell to the column
nameColumn.PackStart(fileNameCell, true);
// Add the columns to the TreeView
treeView.AppendColumn(nameColumn);
// Tell the Cell Renderers which items in the model to display
nameColumn.AddAttribute(fileNameCell, "text", 0);
listView = new TreeView();
SetupListView();
treeMapView = new TreeMapView();
ScrolledWindow scrolledTreeView = new ScrolledWindow();
scrolledTreeView.Add(treeView);
ScrolledWindow scrolledListView = new ScrolledWindow();
scrolledListView.Add(listView);
HPaned hpaned = new HPaned();
hpaned.Pack1(scrolledTreeView, true, true);
hpaned.Pack2(scrolledListView, false, true);
VPaned vpaned = new VPaned();
vpaned.Pack1(hpaned, true, true);
vpaned.Pack2(treeMapView, false, true);
VBox vbox = new VBox(false, 1);
vbox.PackStart(menuBar, false, true, 0);
vbox.PackStart(vpaned, true, true, 0);
Add(vbox);
}
示例3: Main
public static void Main(string[] args)
{
Application.Init();
//Create the Window
Window myWin = new Window("My first GTK# Application! ");
myWin.Resize(500,500);
myLabel = new Label();
userInputField = new TextView();
Button runCommand = new Button("run_command");
runCommand.Clicked += HandleRunCommandClicked;
MenuBar mainBar = new MenuBar();
MenuItem exitItem = new MenuItem("File");
MenuBar subMenu = new MenuBar();
MenuItem subItem = new MenuItem("File");
subMenu.Add(subItem);
mainBar.Add(exitItem);
VBox testBox = new VBox(false, 3);
testBox.PackStart(mainBar);
testBox.PackStart(userInputField);
testBox.PackStart(myLabel);
testBox.PackStart(runCommand);
myWin.Add(testBox);
//Show Everything
myWin.ShowAll();
Application.Run();
}
示例4: DisplayWindow
public DisplayWindow()
: base(WindowType.Toplevel)
{
MenuBar mb = new MenuBar();
MenuItem mi_file = new MenuItem("File");
Menu m_file = new Menu();
MenuItem mi_file_opendll = new MenuItem("Connect with algorithm library...");
mi_file_opendll.Activated += openLibFile;
MenuItem mi_file_openxml = new MenuItem("Open configuration file...");
mi_file_openxml.Activated += openConfigFile;
MenuItem mi_file_quit = new MenuItem("Quit");
mi_file_quit.Activated += delegate {
Application.Quit();
};
MenuItem mi_edit = new MenuItem("Edit");
Menu m_edit = new Menu();
RadioMenuItem mi_edit_move = new RadioMenuItem("Move nodes");
RadioMenuItem mi_edit_insp = new RadioMenuItem(mi_edit_move, "Inspect node");
MenuItem mi_edit_play = new ImageMenuItem(Stock.MediaPlay, null);
MenuItem mi_edit_pause = new ImageMenuItem(Stock.MediaPause, null);
mb.Add(mi_file);
mi_file.Submenu = m_file;
m_file.Add(mi_file_opendll);
m_file.Add(mi_file_openxml);
m_file.Add(new SeparatorMenuItem());
m_file.Add(mi_file_quit);
mi_edit.Submenu = m_edit;
m_edit.Add(mi_edit_move);
m_edit.Add(mi_edit_insp);
m_edit.Add(new SeparatorMenuItem());
m_edit.Add(mi_edit_play);
m_edit.Add(mi_edit_pause);
mb.Add(mi_edit);
Toolbar tb = new Toolbar();
StockItem si;
StockManager.Lookup(Stock.MediaPlay, ref si);
ToolButton tb_opendll = new ToolButton(Stock.Connect);
tb_opendll.Clicked += openLibFile;
ToolButton tb_openxml = new ToolButton(Stock.Open);
tb_openxml.Clicked += openConfigFile;
ToolButton tb_move = new ToggleToolButton(Stock.Preferences);
ToolButton tb_insp = new ToggleToolButton(Stock.ZoomIn);
ToolButton tb_play = new ToolButton(Stock.MediaPlay);
ToolButton tb_pause = new ToolButton(Stock.MediaPause);
tb.Add(tb_opendll);
tb.Add(tb_openxml);
tb.Add(new SeparatorToolItem());
tb.Add(tb_move);
tb.Add(tb_insp);
tb.Add(new SeparatorToolItem());
tb.Add(tb_play);
tb.Add(tb_pause);
this.bpsp = new BlueprintParallelStatePainter();
this.bm = new BlueprintMediabar();
this.bm.CurrentChanged += HandleBmhandleCurrentChanged;
this.bm.CurrentChanged += this.bpsp.RepaintEdges;
this.bs = new BlueprintTabControl(1, 1, 1);
this.bs.CurrentChanged += HandleBshandleCurrentChanged;
;
vb.PackStart(mb, false, false, 0x00);
vb.PackStart(tb, false, false, 0x00);
vb.PackStart(this.bpsp, true, true, 0x00);
vb.PackStart(this.bm, false, false, 0x00);
vb.PackStart(this.bs, false, false, 0x00);
this.Title = "Parallel Visualizer";
this.Resize(640, 480);
this.Add(vb);
this.ShowAll();
}