本文整理汇总了C#中Gtk.MenuBar类的典型用法代码示例。如果您正苦于以下问题:C# MenuBar类的具体用法?C# MenuBar怎么用?C# MenuBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuBar类属于Gtk命名空间,在下文中一共展示了MenuBar类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 ();
}
开发者ID:akrisiun,项目名称:gtk-sharp,代码行数:28,代码来源:Menu.cs
示例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();
}
开发者ID:mubix,项目名称:volatile_reader,代码行数:35,代码来源:VolatileReader.cs
示例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;
}
开发者ID:gclark916,项目名称:Howler,代码行数:26,代码来源:MenuBarController.cs
示例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;
}
开发者ID:dlbeer,项目名称:olishell,代码行数:29,代码来源:AppMenu.cs
示例5: CreateMenu
private MenuBar CreateMenu(MenuItem[] items)
{
var acc = new MenuBar();
foreach (var item in items)
acc.Append(Map(item));
return acc;
}
开发者ID:rajsite,项目名称:lvcef,代码行数:7,代码来源:MainViewImpl.cs
示例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();
}
开发者ID:BackupTheBerlios,项目名称:nyfolder-svn,代码行数:35,代码来源:Login.cs
示例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;
}
开发者ID:directhex,项目名称:xamarin-gnome-sharp2,代码行数:26,代码来源:GnomeHelloWorld.cs
示例8: StartMenuBar
public MenuBar StartMenuBar()
{
MenuBar menuBar = new MenuBar();
stack.Push(menuBar);
return menuBar;
}
开发者ID:KevinKelley,项目名称:katahdin,代码行数:8,代码来源:MenuBuilder.cs
示例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 ();
}
开发者ID:atsushieno,项目名称:mldsp,代码行数:57,代码来源:Main.cs
示例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;
}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:10,代码来源:WindowShell.cs
示例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);
}
开发者ID:joncham,项目名称:NDirStat,代码行数:52,代码来源:MainWindow.cs
示例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();
}
开发者ID:oraora81,项目名称:NOCmono,代码行数:50,代码来源:MainWindow_Table.cs
示例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);
}
开发者ID:draptik,项目名称:RepoSync,代码行数:19,代码来源:MenuBarWidget.cs
示例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);
}
开发者ID:nhannd,项目名称:Xian,代码行数:42,代码来源:MainWindow.cs
示例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;
}
开发者ID:hekar,项目名称:Vaporized,代码行数:40,代码来源:Friends.cs
示例16: CreateWidget
protected override Widget CreateWidget(WindowContext context)
{
switch(this.Kind)
{
case MenuExpressionKind.MenuBar:
MenuBar bar = new MenuBar();
AppendItems(bar, context);
return bar;
case MenuExpressionKind.Menu:
MenuItem item = CreateMenuItem(context);
Menu menu = new Menu();
item.Submenu = menu;
AppendItems(menu, context);
return item;
case MenuExpressionKind.MenuItem:
return CreateMenuItem(context);
case MenuExpressionKind.ItemSeparator:
return new SeparatorMenuItem();
default:
throw new NotImplementedException();
}
}
开发者ID:langpavel,项目名称:LPS-old,代码行数:22,代码来源:MenuExpression.cs
示例17: DemoMenus
public DemoMenus () : base ("Menus")
{
AccelGroup accel_group = new AccelGroup ();
AddAccelGroup (accel_group);
VBox box1 = new VBox (false, 0);
Add (box1);
MenuBar menubar = new MenuBar ();
box1.PackStart (menubar, false, true, 0);
MenuItem menuitem = new MenuItem ("test\nline2");
menuitem.Submenu = CreateMenu (2, true);
menubar.Append (menuitem);
MenuItem menuitem1 = new MenuItem ("foo");
menuitem1.Submenu = CreateMenu (3, true);
menubar.Append (menuitem1);
menuitem = new MenuItem ("bar");
menuitem.Submenu = CreateMenu (4, true);
menuitem.RightJustified = true;
menubar.Append (menuitem);
VBox box2 = new VBox (false, 10);
box2.BorderWidth = 10;
box1.PackStart (box2, false, true, 0);
Button close = new Button ("close");
close.Clicked += new EventHandler (CloseClicked);
box2.PackStart (close, true, true, 0);
close.CanDefault = true;
close.GrabDefault ();
ShowAll ();
}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:37,代码来源:DemoMenus.cs
示例18: 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();
}
开发者ID:OshinKaramian,项目名称:nosql-management-studio,代码行数:37,代码来源:Main.cs
示例19: UpdateStyle
public void UpdateStyle(Gdk.Window win, MenuBar bar)
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT ||
Environment.OSVersion.Platform == PlatformID.Win32S ||
Environment.OSVersion.Platform == PlatformID.Win32Windows ||
Environment.OSVersion.Platform == PlatformID.WinCE)
{
Settings.Default.SetStringProperty("gtk-color-scheme",
"fg_color:" + ColorToHex(System.Drawing.SystemColors.ControlText) + "\n" +
"bg_color:" + ColorToHex(System.Drawing.SystemColors.Control) + "\n" +
"base_color:" + ColorToHex(System.Drawing.SystemColors.Window) + "\n" +
"text_color:" + ColorToHex(System.Drawing.SystemColors.ControlText) + "\n" +
"selected_bg_color:" + ColorToHex(System.Drawing.SystemColors.Highlight) + "\n" +
"selected_fg_color:" + ColorToHex(System.Drawing.SystemColors.HighlightText), null);
// TODO: Implement Glass skins for Vista and Win7
if (false && Environment.OSVersion.Version.Major >= 6)
{
// This is Vista or later. We can use glass styling
IntPtr hwnd = gdk_win32_drawable_get_handle(win.Handle);
int mw, mh;
bar.GdkWindow.GetSize(out mw, out mh);
DwmApi.MARGINS m = new DwmApi.MARGINS(0, mh + 1 , 0, 0);
DwmApi.DwmExtendFrameIntoClientArea(hwnd, m);
DwmApi.DWM_BLURBEHIND bb = new DwmApi.DWM_BLURBEHIND();
bb.fEnable = true;
bb.dwFlags = DwmApi.DWM_BLURBEHIND.DWM_BB_ENABLE | DwmApi.DWM_BLURBEHIND.DWM_BB_BLURREGION;
bb.hRegionBlur = DwmApi.CreateRectRgn(30, 30, 150, 300);
DwmApi.DwmEnableBlurBehindWindow(hwnd, bb);
}
}
}
开发者ID:bigfatbrowncat,项目名称:CatEye,代码行数:36,代码来源:WindowsGtkStyle.cs
示例20: UninstallMenuBar
void UninstallMenuBar()
{
if (topMenu == null)
return;
rootWidget.Remove (topMenu);
topMenu.Destroy ();
topMenu = null;
}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:9,代码来源:DefaultWorkbench.cs
注:本文中的Gtk.MenuBar类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论