本文整理汇总了C#中Gtk.MenuBar类的典型用法代码示例。如果您正苦于以下问题:C# MenuBar类的具体用法?C# MenuBar怎么用?C# MenuBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuBar类属于Gtk命名空间,在下文中一共展示了MenuBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 ();
}
示例2: 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();
}
示例3: 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;
}
示例4: AppMenu
public AppMenu(DebugManager mgr, AccelGroup agr,
Settings set, Window parent,
DebugPane pane, string argsOverride)
{
settings = set;
debugPane = pane;
debugManager = mgr;
menuBar = new MenuBar();
preferences = new PreferencesDialog(set, parent, argsOverride);
menuBar.Append(CreateFileMenu(agr));
menuBar.Append(CreateEditMenu(agr));
menuBar.Append(CreateViewMenu(agr));
menuBar.Append(CreateDebuggerMenu(agr));
menuBar.Append(CreateHelpMenu(agr));
debugManager.DebuggerBusy += OnDebuggerBusy;
debugManager.DebuggerReady += OnDebuggerReady;
debugManager.DebuggerStarted += OnDebuggerStarted;
debugManager.DebuggerExited += OnDebuggerExited;
menuBar.Destroyed += OnDestroy;
debuggerStop.Sensitive = false;
debuggerInterrupt.Sensitive = false;
foreach (MenuItem m in commandMacros)
m.Sensitive = false;
}
示例5: CreateMenu
private MenuBar CreateMenu(MenuItem[] items)
{
var acc = new MenuBar();
foreach (var item in items)
acc.Append(Map(item));
return acc;
}
示例6: Login
// ============================================
// PUBLIC Constructors
// ============================================
/// Create New Login Dialog
public Login()
{
SetDefaultSize(240, 355);
DefaultIcon = StockIcons.GetPixbuf("NyFolderIcon");
// Initialize Dialog Options
Title = Info.Name + " Login";
Logo = StockIcons.GetPixbuf("NyFolderLogo", 240, 140);
// Remember Password (CheckButton)
checkRememberPassword.Image = new Gtk.Image(Stock.Save, IconSize.Button);
// Secure Authentication (CheckButton)
checkSecureAuth = new CheckButton("Use Secure Authentication");
checkSecureAuth.Active = true;
checkSecureAuth.Image = StockIcons.GetImage("Lock", 22);
checkSecureAuth.Toggled += new EventHandler(OnCheckSecureAuthToggled);
VBox.PackStart(checkSecureAuth, false, false, 2);
// Initialize MenuBar
this.menuBar = new Gtk.MenuBar();
VBox.PackStart(this.menuBar, false, false, 0);
this.VBox.ReorderChild(this.menuBar, 0);
InitializeMenuBar();
// Initialize Dialog Buttons
AddButton(Gtk.Stock.Ok, ResponseType.Ok);
AddButton(Gtk.Stock.Quit, ResponseType.Close);
ShowAll();
}
示例7: 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;
}
示例8: StartMenuBar
public MenuBar StartMenuBar()
{
MenuBar menuBar = new MenuBar();
stack.Push(menuBar);
return menuBar;
}
示例9: 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 ();
}
示例10: CreateMainMenu
public MenuBar CreateMainMenu(string name)
{
m_mainMenu = new MenuBar();
m_mainMenu.Name = name;
m_menuLayout.PackStart(m_mainMenu, false, false, 0);
m_mainMenu.Show();
return m_mainMenu;
}
示例11: 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);
}
示例12: MainWindow_Table
public MainWindow_Table()
: base("Table")
{
SetDefaultSize(250, 230);
SetPosition(WindowPosition.Center);
DeleteEvent += delegate { Application.Quit(); };
VBox vbox = new VBox(false, 2);
MenuBar mb = new MenuBar();
Menu filemenu = new Menu();
MenuItem file = new MenuItem("File");
file.Submenu = filemenu;
mb.Append(file);
vbox.PackStart(mb, false, false, 0);
Table table = new Table(5, 4, true);
table.Attach(new Button("Cls"), 0, 1, 0, 1);
table.Attach(new Button("Bck"), 1, 2, 0, 1);
table.Attach(new Label(), 2, 3, 0, 1);
table.Attach(new Button("Close"), 3, 4, 0, 1);
table.Attach(new Button("7"), 0, 1, 1, 2);
table.Attach(new Button("8"), 1, 2, 1, 2);
table.Attach(new Button("9"), 2, 3, 1, 2);
table.Attach(new Button("/"), 3, 4, 1, 2);
table.Attach(new Button("4"), 0, 1, 2, 3);
table.Attach(new Button("5"), 1, 2, 2, 3);
table.Attach(new Button("6"), 2, 3, 2, 3);
table.Attach(new Button("*"), 3, 4, 2, 3);
table.Attach(new Button("1"), 0, 1, 3, 4);
table.Attach(new Button("2"), 1, 2, 3, 4);
table.Attach(new Button("3"), 2, 3, 3, 4);
table.Attach(new Button("-"), 3, 4, 3, 4);
table.Attach(new Button("0"), 0, 1, 4, 5);
table.Attach(new Button("."), 1, 2, 4, 5);
table.Attach(new Button("="), 2, 3, 4, 5);
table.Attach(new Button("+"), 3, 4, 4, 5);
vbox.PackStart(new Entry(), false, false, 0);
vbox.PackEnd(table, true, true, 0);
Add(vbox);
ShowAll();
}
示例13: Init
private void Init ()
{
Menu helpMenu = new Menu ();
MenuItem aboutItem = new MenuItem ("About");
aboutItem.Activated += HandleAboutActivated;
helpMenu.Append (aboutItem);
MenuItem helpItem = new MenuItem ("Help");
helpItem.Submenu = helpMenu;
MenuBar menuBar = new MenuBar ();
menuBar.Append (helpItem);
var vbox = new Gtk.VBox ();
vbox.PackStart (menuBar, false, false, 0);
this.Add (vbox);
}
示例14: MainWindow
public MainWindow()
: base("ClearCanvas")
{
this.SetDefaultSize(Screen.Width, Screen.Height);
_workspaceToolViewManagers = new Dictionary<IWorkspace, ToolViewManager>();
_mainMenu = new MenuBar();
_toolBar = new Toolbar();
_notebook = new Notebook();
_notebook.TabPos = PositionType.Top;
_notebook.SwitchPage += OnNotebookSwitchPage;
// this box holds the main menu
HBox menuBox = new HBox(false, 0);
menuBox.PackStart(_mainMenu, true, true, 0);
// this box holds the toolbar
_toolBarBox = new HBox(false, 0);
_toolBarBox.PackStart(_toolBar, true, true, 0);
// this box holds the overall layout
_outerBox = new VBox(false, 0);
_outerBox.PackStart(menuBox, false, false, 0);
_outerBox.PackStart(_toolBarBox, false, false, 0);
_outerBox.PackStart(_notebook, true, true, 0);
//WorkstationModel.WorkspaceManager.Workspaces.ItemAdded += new EventHandler<WorkspaceEventArgs>(OnWorkspaceAdded);
//WorkstationModel.WorkspaceManager.Workspaces.ItemRemoved += new EventHandler<WorkspaceEventArgs>(OnWorkspaceRemoved);
//WorkstationModel.WorkspaceManager.WorkspaceActivated += new EventHandler<WorkspaceEventArgs>(OnWorkspaceActivated);
DesktopApplication.WorkspaceManager.Workspaces.ItemAdded += new EventHandler<WorkspaceEventArgs>(OnWorkspaceAdded);
DesktopApplication.WorkspaceManager.Workspaces.ItemRemoved += new EventHandler<WorkspaceEventArgs>(OnWorkspaceRemoved);
DesktopApplication.WorkspaceManager.WorkspaceActivated += new EventHandler<WorkspaceEventArgs>(OnWorkspaceActivated);
this.Add(_outerBox);
this.ShowAll();
BuildMenusAndToolBars(null);
UpdateToolViews(null);
}
示例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;
}