当前位置: 首页>>代码示例>>C#>>正文


C# Gtk.MenuBar类代码示例

本文整理汇总了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 ();
		}
开发者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


注:本文中的Gtk.MenuBar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。