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); }
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; } }
public static void Main() { Application.Init(); var window = new Window("TextEditor"); window.DeleteEvent += OnDelete; window.SetDefaultSize(1000, 640); VBox vbox = new VBox(false, 1); HBox toolbar = new HBox(); MenuBar menubar = new MenuBar(); TextEditor tex = new TextEditor(window); menubar.Append(tex.file); menubar.Append(tex.edit); toolbar.PackStart(tex.fileToolbar, true, true, 0); toolbar.PackStart(new SeparatorToolItem(), false, false, 0); toolbar.PackStart(tex.editToolbar, true, true, 0); vbox.PackStart(menubar, false, false, 0); vbox.PackStart(toolbar, false, false, 0); vbox.PackStart(tex.editorWindow, true, true, 0); window.Add(vbox); window.ShowAll(); Application.Run(); }
private MenuBar CreateMenuBar() { var ag = new AccelGroup(); this.AddAccelGroup(ag); var fileMenu = new Menu(); ImageMenuItem newMenuItem = new ImageMenuItem(Stock.New, ag); newMenuItem.Activated += NewMenuItem_Activated; fileMenu.Append(newMenuItem); ImageMenuItem openMenuItem = new ImageMenuItem(Stock.Open, ag); openMenuItem.Activated += OpenMenuItem_Activated; fileMenu.Append(openMenuItem); fileMenu.Append(new SeparatorMenuItem()); ImageMenuItem quitMenuItem = new ImageMenuItem(Stock.Quit, ag); quitMenuItem.Activated += QuitMenuItem_Activated; fileMenu.Append(quitMenuItem); var menu = new MenuBar(); menu.Append(new ImageMenuItem(Stock.File, null) { Submenu = fileMenu }); ImageMenuItem generateMenuItem = new ImageMenuItem("Generate"); generateMenuItem.Activated += GenerateMenuItem_Activated; menu.Append(generateMenuItem); menu.Append(new ImageMenuItem(Stock.About, ag)); return(menu); }
private MenuBar MakeMenuBar() { MenuBar menuBar = new MenuBar(); menuBar.Append(MakeFileMenu()); menuBar.Append(MakeEditMenu()); menuBar.Append(MakeHelpMenu()); return(menuBar); }
void AddMenuButton() { var mb = new MenuBar(); mb.Append(GetMenuTool()); mb.Append(GetMenuHelp()); _windowBox.PackStart(mb, false, false, 0); }
public static MenuBar MontaBarraDeMenu() { MenuBar item0 = new MenuBar(); Menu item1 = new Menu(); item1.Append(MNU_CADASSUNTOS, "Assuntos", ""); item1.Append(MNU_CADAUTORES, "Autores", ""); item1.Append(MNU_CADENDERECOS, "Endereços", ""); item1.Append(MNU_CADIDIOMAS, "Idiomas", ""); item1.Append(MNU_CADPAISES, "Países", ""); item1.Append(MNU_CADPROFISSOES, "Profissões", ""); item1.AppendSeparator(); item1.Append(MNU_CADCLIENTES, "Clientes", ""); item1.Append(MNU_CADLIVROS, "Livros", ""); item0.Append(item1, "Cadastros"); Menu item2 = new Menu(); item2.Append(MNU_CONASSUNTOS, "Assuntos", ""); item2.Append(MNU_CONAUTORES, "Autores", ""); item2.Append(MNU_CONENDERECOS, "Endereços", ""); item2.Append(MNU_CONIDIOMAS, "Idiomas", ""); item2.Append(MNU_CONPAISES, "Países", ""); item2.Append(MNU_CONPROFISSOES, "Profissões", ""); item2.AppendSeparator(); item2.Append(MNU_CONCLIENTES, "Clientes", ""); item2.Append(MNU_CONLIVROS, "Livros", ""); item0.Append(item2, "Pesquisas"); Menu item3 = new Menu(); item3.Append(MNU_VENDER, "Vender", ""); item3.Append(MNU_VENDASREALIZADAS, "Vendas Realizadas", ""); item0.Append(item3, "Vendas"); Menu item4 = new Menu(); item4.Append(MNU_LADOALADOHORIZONTAL, "Lado a lado horizontal", ""); item4.Append(MNU_LADOALADOVERTICAL, "Lado a lado vertical", ""); item4.Append(MNU_EMCASCATA, "Em cascata", ""); item4.Append(MNU_ORGANIZARICONES, "Organizar Ícones", ""); item0.Append(item4, "Janelas"); Menu item5 = new Menu(); item5.Append(MNU_ALTERARSENHA, "Alterar Senha", ""); item5.AppendSeparator(); item5.Append(MNU_SOBRE, "Sobre", ""); item5.Append(MNU_SAIR, "Sair", ""); item0.Append(item5, "Opções"); return(item0); }
/// <summary> /// Tells the window to the add the given menu. /// </summary> /// <param name="menu">Menu and its item to add</param> public void AddMenu(MenuContribution menu) { if (iMenuBar == null) { iMenuBar = new MenuBar(); iVBox = new VBox(false, 2); Add(iVBox); } Menu fileMenu = new Menu(); MenuItem fileMenuItem = new MenuItem(menu.Label.Replace('&', '_')); fileMenuItem.Submenu = fileMenu; foreach (MenuItemContribution mi in menu.MenuItems) { MenuItem mnuItem = new MenuItem(mi.Label.Replace('&', '_')); mnuItem.Activated += (sender, args) => mi.ActionHandler.Run(); mnuItem.SetStateFlags(mi.ActionHandler.IsEnabled ? StateFlags.Normal : StateFlags.Insensitive, false); fileMenu.Append(mnuItem); } iMenuBar.Append(fileMenuItem); iVBox.PackStart(iMenuBar, false, false, 0); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Application.Init (); this.Resize(640,480); //menu bar very top MenuBar mb = new MenuBar (); Menu fileMenu = new Menu (); MenuItem menuItem = new MenuItem ("_File"); menuItem.Submenu = fileMenu; mb.Append(menuItem); MenuItem menuFileQuit = new MenuItem("Quit"); fileMenu.Append(menuFileQuit); vboxMain.PackStart(mb,false,false,0); //toolbar Toolbar tbTop = new Toolbar (); //toolbutton Staff ToolButton tbStaff = new ToolButton (Gtk.Stock.OrientationPortrait); tbStaff.Label="Staff"; tbStaff.IsImportant=true; tbStaff.Clicked += HandleTbStaffClicked; tbTop.Insert(tbStaff,0); //toolbutton Clients ToolButton tbClients = new ToolButton (Gtk.Stock.About); tbClients.Label="Clients"; tbClients.IsImportant=true; tbClients.Clicked+= HandleTbClientsClicked; tbTop.Insert(tbClients,1); //media bar Label lbMediaTemp = new Label (); lbMediaTemp.Text="Media holder"; lbMediaTemp.Show(); //pack the toolbar and media bar in the top hbox// hbTop.PackStart(tbTop); hbTop.PackStart(lbMediaTemp); //pack the top hbox in the main vbox vboxMain.PackStart(hbTop,false,false,1); // horizontal pane verticalPane.Position=200; verticalPane.Pack1(scrollWindowLeft,false,false); verticalPane.Pack2(scrollWindowRight,false,false); vboxMain.PackStart(verticalPane); scrollWindowLeft.Add(viewPortLeft); scrollWindowRight.Add(viewPortRight); Label lbMain = new Label (); lbMain.Text= "main"; viewPortRight.Add(lbMain); verticalPane.ShowAll(); //status bar very bottom Statusbar sb = new Statusbar (); vboxMain.PackStart(sb,false,false,1); this.Add(vboxMain); //hb1.Add(tbTop); this.ShowAll (); Build (); }
public static void Main(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(); }
public static MenuBar MyMenuBarFunc() { MenuBar item0 = new MenuBar(); Menu item1 = new Menu(); item1.Append( (int)MenuIDs.wxID_ABOUT, "&About...", "Helptext for About" ); item1.AppendSeparator(); Menu item2 = new Menu(); item2.Append( ID_TEST1, "Test 1\tF1", "", ItemKind.wxITEM_CHECK ); item2.Append( ID_TEST2, "Test 2\tF2", "", ItemKind.wxITEM_CHECK ); item2.Append( ID_TEST3, "Test 3\tF3", "", ItemKind.wxITEM_CHECK ); item1.Append( ID_MENU, "Submenu", item2, "" ); Menu item3 = new Menu(); item3.Append( ID_RADIO, "Radio 1", "", ItemKind.wxITEM_RADIO ); item3.Append( ID_RADIO, "Radio 2", "", ItemKind.wxITEM_RADIO ); item1.Append( ID_MENU, "Radio submenu", item3, "" ); item1.AppendSeparator(); item1.Append( (int)MenuIDs.wxID_EXIT, "&Quit\tAlt-Q", "Helptext for Quit" ); item0.Append( item1, "&File" ); return item0; }
public static MenuBar MyMenuBarFunc() { MenuBar item0 = new MenuBar(); Menu item1 = new Menu(); item1.Append((int)MenuIDs.wxID_ABOUT, "&About...", "Helptext for About"); item1.AppendSeparator(); Menu item2 = new Menu(); item2.Append(ID_TEST1, "Test 1\tF1", "", ItemKind.wxITEM_CHECK); item2.Append(ID_TEST2, "Test 2\tF2", "", ItemKind.wxITEM_CHECK); item2.Append(ID_TEST3, "Test 3\tF3", "", ItemKind.wxITEM_CHECK); item1.Append(ID_MENU, "Submenu", item2, ""); Menu item3 = new Menu(); item3.Append(ID_RADIO, "Radio 1", "", ItemKind.wxITEM_RADIO); item3.Append(ID_RADIO, "Radio 2", "", ItemKind.wxITEM_RADIO); item1.Append(ID_MENU, "Radio submenu", item3, ""); item1.AppendSeparator(); item1.Append((int)MenuIDs.wxID_EXIT, "&Quit\tAlt-Q", "Helptext for Quit"); item0.Append(item1, "&File"); return(item0); }
//build menubar void BuildMenuBar() { //create new menu bar menuBar = new MenuBar(); //create 'file' dropdown filemenu = new Gtk.Menu(); file = new Gtk.MenuItem("File"); file.Submenu = filemenu; agr = new AccelGroup(); mainWindowTracker.AddAccelGroup(agr); //add new button to file dropdown newi = new ImageMenuItem(Stock.New, agr); newi.AddAccelerator("activate", agr, new AccelKey( Gdk.Key.n, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); newi.Activated += NewCrop; filemenu.Append(newi); //add hr line sep = new SeparatorMenuItem(); filemenu.Append(sep); //add close button exit = new ImageMenuItem(Stock.Quit, agr); exit.AddAccelerator("activate", agr, new AccelKey( Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); //set up exit button exit.Activated += OnActivated; filemenu.Append(exit); //add to menu bar menuBar.Append(file); //add new vbox vbox = new VBox(false, 2); vbox.PackStart(menuBar, true, true, 0); //add our event box that contains our image vbox.PackStart(toCropBox); //add our upload button hbox = new HBox(); uploadButton = new Gtk.Button(); uploadButton.Label = "Upload Image"; uploadButton.Clicked += UploadCroppedImage; hbox.PackEnd(uploadButton, false, false, 2); vbox.PackEnd(hbox, false, false, 5); //finally add to main window mainWindowTracker.Add(vbox); mainWindowTracker.ShowAll(); }
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(); }
private MenuBar CreateMenu(MenuItem[] items) { var acc = new MenuBar(); foreach (var item in items) { acc.Append(Map(item)); } return(acc); }
private void InitMenuBar() { MenuBar menuBar = new MenuBar(); Menu fileMenu = new Menu(); fileMenu.Append(ID_FileExit, "E&xit\tAlt+F4", "Exit this app"); EvtMenu(ID_FileExit, (s, e) => Close()); menuBar.Append(fileMenu, "&File"); MenuBar = menuBar; }
// WDR: methods for MyFrame public void CreateMyMenuBar() { Menu file_menu = new Menu(); file_menu.Append( (int)MenuIDs.wxID_ABOUT, "About...", "Program info" ); file_menu.Append( (int)MenuIDs.wxID_EXIT, "Quit...", "Quit program" ); MenuBar menu_bar = new MenuBar(); menu_bar.Append( file_menu, "File" ); MenuBar = menu_bar; }
private MenuBar CreateMenu(WindowHandle handle, List <MenuPrototype> menuItemsProt) { MenuBar menuBar = new MenuBar(); foreach (MenuPrototype menuItemProt in menuItemsProt) { menuBar.Append(CreateMenuItem(handle, menuItemProt)); } return(menuBar); }
public static MenuBar Create(Window window, WindowModel model) { MenuBar result = new MenuBar(); foreach (GenericMenu menuModel in model.Menus) { MenuItem menuContainer = new MenuItem(menuModel.Title); menuContainer.Submenu = BuildMenu(window, menuModel); result.Append(menuContainer); } return(result); }
public static MenuBar MyMenuBarFunc() { MenuBar item0 = new MenuBar(); Menu item1 = new Menu(); item1.Append( (int)MenuIDs.wxID_ABOUT, "About\tAlt-A", "" ); item1.Append( (int)MenuIDs.wxID_SAVE, "Save\tAlt-S", "" ); item1.Append( (int)MenuIDs.wxID_EXIT, "Quit\tAlt-Q", "" ); item0.Append( item1, "File" ); return item0; }
public gamewindow() { System.Console.WriteLine("inside gamewindow"); win = new Gtk.Window("Breakout"); win.SetDefaultSize(breakout_definitions.x_win, breakout_definitions.y_win); win.SetPosition(WindowPosition.Center); DeleteEvent += delegate { Application.Quit(); }; area = new DrawingArea(); area.AddEvents((int)(EventMask.ButtonPressMask | EventMask.ButtonReleaseMask)); area.ExposeEvent += OnDrawingAreaExposed; area.KeyPressEvent += new KeyPressEventHandler(key_handler); area.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressHandler); area.ButtonReleaseEvent += new ButtonReleaseEventHandler(ButtonReleaseHandler); MenuBar mb = new MenuBar(); Menu file_menu = new Menu(); MenuItem file = new MenuItem("File"); file.Submenu = file_menu; MenuItem run = new MenuItem("Run"); run.Activated += do_run; file_menu.Append(run); MenuItem exit = new MenuItem("Exit"); exit.Activated += do_exit; file_menu.Append(exit); mb.Append(file); VBox vbox = new VBox(false, 3); vbox.PackStart(mb, false, false, 0); HBox hbox = new HBox(); hbox.Add(area); vbox.Add(hbox); System.Console.WriteLine("before win.Add"); win.Add(vbox); System.Console.WriteLine("before win.ShowAll"); win.ShowAll(); System.Console.WriteLine("before context"); context = Gdk.CairoHelper.Create(area.GdkWindow); System.Console.WriteLine("finish gamewindow"); }
public static MenuBar MyMenuBarFunc() { MenuBar item0 = new MenuBar(); Menu item1 = new Menu(); item1.Append((int)MenuIDs.wxID_ABOUT, "About\tAlt-A", ""); item1.Append((int)MenuIDs.wxID_SAVE, "Save\tAlt-S", ""); item1.Append((int)MenuIDs.wxID_EXIT, "Quit\tAlt-Q", ""); item0.Append(item1, "File"); return(item0); }
// WDR: methods for MyFrame public void CreateMyMenuBar() { Menu file_menu = new Menu(); file_menu.Append((int)MenuIDs.wxID_ABOUT, "About...", "Program info"); file_menu.Append((int)MenuIDs.wxID_EXIT, "Quit...", "Quit program"); MenuBar menu_bar = new MenuBar(); menu_bar.Append(file_menu, "File"); MenuBar = menu_bar; }
public SharpApp() : base("Calculator") { 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(); }
public Calculator() : base("Calculator") { SetDefaultSize(250, 200); 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(); }
static Gtk.MenuBar Create_Menu() { MenuBar mb = new MenuBar(); Menu file_menu = new Menu(); ImageMenuItem scramble_item = new ImageMenuItem("_Scramble"); scramble_item.Image = new Gtk.Image(Gtk.Stock.Refresh, IconSize.Menu); scramble_item.Activated += new EventHandler(Scramble); ImageMenuItem quit_item = new ImageMenuItem("_Quit"); quit_item.Image = new Gtk.Image(Gtk.Stock.Quit, IconSize.Menu); quit_item.Activated += new EventHandler(Quit); file_menu.Append(scramble_item); file_menu.Append(new SeparatorMenuItem()); file_menu.Append(quit_item); MenuItem file_item = new MenuItem("_File"); file_item.Submenu = file_menu; mb.Append(file_item); Menu help_menu = new Menu(); MenuItem help_item = new MenuItem("_Help"); help_item.Submenu = help_menu; ImageMenuItem about = new ImageMenuItem(Gnome.Stock.About, new AccelGroup()); about.Activated += new EventHandler(About_Box); help_menu.Append(about); mb.Append(help_item); return(mb); }
private void MusicMenu() { MenuItem Music = new MenuItem("Music"); Menu music = new Menu(); Music.Submenu = music; menuBar.Append(Music); ImageMenuItem AddDir = new ImageMenuItem("Add Directory"); AddDir.Image = new Image(Stock.Add, IconSize.Menu); AddDir.Activated += new EventHandler(AddDirActivated); music.Append(AddDir); ImageMenuItem CleanDB = new ImageMenuItem("Clean Database"); CleanDB.Image = new Image(Stock.Clear, IconSize.Menu); CleanDB.Activated += new EventHandler(CleanDBActivated); music.Append(CleanDB); music.Append(new SeparatorMenuItem()); ImageMenuItem Preferences = new ImageMenuItem("Preferences"); Preferences.Image = new Image(Stock.Preferences, IconSize.Menu); Preferences.Activated += new EventHandler(PreferencesActivated); music.Append(Preferences); music.Append(new SeparatorMenuItem()); ImageMenuItem Exit = new ImageMenuItem("Quit"); Exit.Image = new Image(Stock.Quit, IconSize.Menu); Exit.Activated += new EventHandler(QuitActivated); music.Append(Exit); }
public RatingEntryTestModule() : base("Rating Entry") { var pbox = new VBox(); Add(pbox); var m = new Menu(); var b = new MenuBar(); var item = new MenuItem("Rate Me!") { Submenu = m }; b.Append(item); m.Append(new MenuItem("Apples")); m.Append(new MenuItem("Pears")); m.Append(new RatingMenuItem()); m.Append(new ImageMenuItem("gtk-remove", null)); m.ShowAll(); pbox.PackStart(b, false, false, 0); var box = new VBox { BorderWidth = 10, Spacing = 10 }; pbox.PackStart(box, true, true, 0); var entry1 = new RatingEntry(); box.PackStart(entry1, true, true, 0); var entry2 = new RatingEntry(); box.PackStart(entry2, false, false, 0); box.PackStart(new Entry("Normal GtkEntry"), false, false, 0); var entry3 = new RatingEntry(); Pango.FontDescription fd = entry3.PangoContext.FontDescription.Copy(); fd.Size = (int)(fd.Size * Pango.Scale.XXLarge); entry3.ModifyFont(fd); fd.Dispose(); box.PackStart(entry3, true, true, 0); pbox.ShowAll(); }
void AddMenu() { var mb = new MenuBar(); var filemenu = new Menu(); var file = new MenuItem("文件") { Submenu = filemenu }; var agr = new AccelGroup(); AddAccelGroup(agr); var newi = new ImageMenuItem(Stock.New, agr); newi.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.n, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); filemenu.Append(newi); var open = new ImageMenuItem(Stock.Open, agr); open.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.n, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); filemenu.Append(open); var sep = new SeparatorMenuItem(); filemenu.Append(sep); var exit = new ImageMenuItem(Stock.Quit, agr); exit.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); //var exit = new MenuItem("退出"); exit.Activated += (sender, args) => { Application.Quit(); }; filemenu.Append(exit); mb.Append(file); //var _windowBox = new VBox(false, 2); _windowBox.PackStart(mb, false, false, 0); //_windowBox.PackStart(new Label("2333"), false, false, 0); //Add(_windowBox); }
public static void Main() { Application.Init (); window = new Window ("Top level test"); VBox box = new VBox (true, 0); MenuBar mb = new MenuBar (); item = new MenuItem ("_Test"); mb.Append (item); box.PackStart (mb, true, true, 0); label = new Label ("Text"); box.PackStart (label, true, true, 0); window.Add (box); window.ShowAll (); window.DeleteEvent += new DeleteEventHandler (OnDelete); Application.Run (); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { _regexes = new Dictionary <string, string>(); _regexes.Add("Possible Email Addresses", @"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}"); _regexes.Add("Possible Environment Variables", @"^[A-Za-z]{3,}=[A-Za-z]+"); _regexes.Add("Possible File Paths", @"[A-Za-z]:\\"); _regexes.Add("Possible URLS", @"/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/"); _regexes.Add("Custom", string.Empty); Build(); this.Title = "VolatileMinds Pagefile Analyzer"; 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(); }
public View() : base("(untitled)") { AddEvents((int)(EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.KeyPressMask | EventMask.PointerMotionMask)); Resize(1000, 1000); MenuItem makeItem(string name, EventHandler handler) { MenuItem i = new MenuItem(name); i.Activated += handler; return(i); } EventHandler menuChanger(State s) => (sender, args) => { state = s; handleStates(); QueueDraw(); }; MenuItem[] items = { makeItem("New", menuChanger(New)), makeItem("Open", menuChanger(Open)), makeItem("Save", menuChanger(Save)), makeItem("Quit", (sender, args) =>{ state = QuitProgram; checkIfSaved("Quit"); }) }; Menu fileMenu = new Menu(); foreach (MenuItem i in items) { fileMenu.Append(i); } MenuItem fileItem = new MenuItem("File"); fileItem.Submenu = fileMenu; MenuBar bar = new MenuBar(); bar.Append(fileItem); VBox vbox = new VBox(); vbox.PackStart(bar, false, false, 0); Add(vbox); init(); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { _regexes = new Dictionary<string, string>(); _regexes.Add("Possible Email Addresses",@"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}"); _regexes.Add("Possible Environment Variables", @"^[A-Za-z]{3,}=[A-Za-z]+"); _regexes.Add("Possible File Paths", @"[A-Za-z]:\\"); _regexes.Add("Possible URLS", @"/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/"); _regexes.Add("Custom", string.Empty); Build (); this.Title = "VolatileMinds Pagefile Analyzer"; 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 (); }
private MenuBar CreateShortcutsBar() { // Adds a hidden menubar that contains to enable keyboard // shortcuts to close the log MenuBar = new MenuBar(); MenuItem file_item = new MenuItem("File"); Menu file_menu = new Menu(); MenuItem close_1 = new MenuItem("Close1"); MenuItem close_2 = new MenuItem("Close2"); // adds specific Ctrl+W and Esc key accelerators to Log Window AccelGroup accel_group = new AccelGroup(); AddAccelGroup(accel_group); // Close on Esc close_1.AddAccelerator("activate", accel_group, new AccelKey(Gdk.Key.W, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); close_1.Activated += delegate { HideAll(); }; // Close on Ctrl+W close_2.AddAccelerator("activate", accel_group, new AccelKey(Gdk.Key.Escape, Gdk.ModifierType.None, AccelFlags.Visible)); close_2.Activated += delegate { HideAll(); }; file_menu.Append(close_1); file_menu.Append(close_2); file_item.Submenu = file_menu; MenuBar.Append(file_item); // Hacky way to hide the menubar, but the accellerators // will simply be disabled when using Hide () MenuBar.HeightRequest = 1; MenuBar.ModifyBg(StateType.Normal, Style.Background(StateType.Normal)); return(MenuBar); }
public MainWindow() : base("Lachesis") { Application.Init(); SetDefaultSize(250, 200); DeleteEvent += Quit; #region --Menu Bar Initialization-- MenuBar mb = new MenuBar(); Menu fileMenu = new Menu(); MenuItem file = new MenuItem("File"); file.Submenu = fileMenu; MenuItem quit = new MenuItem("Quit"); quit.Activated += Quit; fileMenu.Append(quit); mb.Append(file); VBox menuBar = new VBox(false, 2); menuBar.PackStart(mb, false, false, 0); Add(menuBar); #endregion --End-- #region --Project Initializaition Frame-- //TODO: Build Project Initialization Frame #endregion #region --Design Phase Frame-- //TODO: Build Design Phase Frame #endregion #region --Drawing Release Frame-- //TODO: Build Drawing Release Frame #endregion #region --Purchasing And Fabrication Frame-- //TODO: Build Purchasing and Fabrication Frame #endregion ShowAll(); Application.Run(); }
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); }
static MenuBar CreateMenuBar() { MenuBar bar = new MenuBar(); MenuItem file = new MenuItem("File"); file.AddEvents((int)Gdk.EventMask.AllEventsMask); bar.Append(file); Menu fileMenu = new Menu(); file.Submenu = fileMenu; fileMenu.Append(new MenuItem("Open...")); // FIXME: Hook up callbacks // FIXME: On windows (and Mac) there should be no delay // on the ability to close the menu when you've opened it. // Atm there is a delay after opening the menu and when // you can close it... return(bar); }
public SharpApp() : base("Simple menu") { SetDefaultSize(250,200); SetPosition(WindowPosition.Center); DeleteEvent+= delegate { Application.Quit();}; MenuBar mb = new MenuBar(); Menu filemenu = new Menu(); MenuItem file = new MenuItem("File"); file.Submenu = filemenu; MenuItem exit = new MenuItem("Exit"); exit.Activated += OnActivated; filemenu.Append(exit); mb.Append(file); VBox vbox = new VBox(false, 2); vbox.PackStart(mb, false, false, 0); Add(vbox); ShowAll(); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build (); this.Title = "VolatileMinds Registry Reader"; 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 (); }
public static void Main(string[] args) { Application.Init(); Gtk.Window w = new Gtk.Window("Encodroyd"); HBox mainHBox = new HBox(); HBox dropHBox = new HBox(); HBox spinVideoHBox = new HBox(); HBox spinAudioHBox = new HBox(); HBox statusButtonHBox = new HBox(); VBox mainVBox = new VBox(); VBox leftVBox = new VBox(); VBox rightVBox = new VBox(); VBox prefVBox = new VBox(); VBox statusVBox = new VBox(); MenuBar mb = new MenuBar (); //Gtk.Frame dndFrame = new Gtk.Frame(); Gtk.Frame prefFrame = new Gtk.Frame("Preferences"); Gtk.Frame statusFrame = new Gtk.Frame("Status"); icon = new Pixbuf(null, "encodroyd.png"); Gtk.EventBox image = new Gtk.EventBox(); Gtk.Label dropLabel = new Gtk.Label("Drop videos here\nto convert"); highQualityRadio = new RadioButton(null, "High Quality (H.264)"); prefVBox.PackStart(highQualityRadio, true, true, 0); lowQualityRadio = new RadioButton(highQualityRadio, "Low Quality (MPEG4)"); lowQualityRadio.Active = true; prefVBox.PackStart(lowQualityRadio, true, true, 0); statusLabel = new Gtk.Label("Idle"); pBar = new ProgressBar(); skipCurrentButton = new Gtk.Button(); Gtk.ScrolledWindow scrollWin = new Gtk.ScrolledWindow(); Gtk.TreeView tree = new TreeView(); listStore = new ListStore(typeof (String)); // set properties w.Icon = icon; // transparence //if (w.Screen.RgbaColormap != null) // Gtk.Widget.DefaultColormap = w.Screen.RgbaColormap; mainHBox.BorderWidth = 6; mainHBox.Spacing = 6; dropHBox.BorderWidth = 6; dropHBox.Spacing = 6; spinVideoHBox.BorderWidth = 6; spinVideoHBox.Spacing = 6; spinAudioHBox.BorderWidth = 6; spinAudioHBox.Spacing = 6; statusButtonHBox.BorderWidth = 0; statusButtonHBox.Spacing = 6; leftVBox.BorderWidth = 6; leftVBox.Spacing = 6; rightVBox.BorderWidth = 6; rightVBox.Spacing = 6; prefVBox.BorderWidth = 6; prefVBox.Spacing = 6; statusVBox.BorderWidth = 6; statusVBox.Spacing = 6; statusLabel.Ellipsize = Pango.EllipsizeMode.Middle; scrollWin.ShadowType = ShadowType.In; statusLabel.SetSizeRequest(120,-1); skipCurrentButton.Sensitive = false; skipCurrentButton.Label = "Skip"; // first hbox image.Add(new Gtk.Image(icon)); dropHBox.Add(image); dropHBox.Add(dropLabel); // preferences frame prefFrame.Add(prefVBox); prefVBox.Add(spinVideoHBox); prefVBox.Add(spinAudioHBox); // status frame statusFrame.Add(statusVBox); statusVBox.Add(statusButtonHBox); statusVBox.Add(pBar); statusButtonHBox.Add(statusLabel); statusButtonHBox.Add(skipCurrentButton); // leftvbox leftVBox.Add(dropHBox); leftVBox.Add(prefFrame); leftVBox.Add(statusFrame); // right tree.Model = listStore; tree.HeadersVisible = true; tree.AppendColumn ("Queue", new CellRendererText (), "text", 0); // scrolledwindow scrollWin.Add(tree); // rightvbox rightVBox.Add(scrollWin); rightVBox.SetSizeRequest(200,-1); // menubar Menu fileMenu = new Menu (); MenuItem exitItem = new MenuItem("Exit"); exitItem.Activated += new EventHandler (OnExitItemActivate); fileMenu.Append (exitItem); MenuItem fileItem = new MenuItem("File"); fileItem.Submenu = fileMenu; mb.Append (fileItem); Menu helpMenu = new Menu (); MenuItem aboutItem = new MenuItem("About"); aboutItem.Activated += new EventHandler (OnAboutItemActivate); helpMenu.Append (aboutItem); MenuItem helpItem = new MenuItem("Help"); helpItem.Submenu = helpMenu; mb.Append (helpItem); // mainHBox mainVBox.Add(mb); mainVBox.Add(mainHBox); mainHBox.Add(leftVBox); mainHBox.Add(rightVBox); // window w.Add(mainVBox); w.ShowAll(); // events Gtk.Drag.DestSet(dropHBox, DestDefaults.All, targetTable, Gdk.DragAction.Copy); dropHBox.DragDataReceived += DataReceived; skipCurrentButton.Clicked += new EventHandler(OnSkipOneButtonClicked); w.DeleteEvent += OnWindowDelete; Application.Run(); }
static Gtk.MenuBar Create_Menu () { MenuBar mb = new MenuBar (); Menu file_menu = new Menu (); ImageMenuItem scramble_item = new ImageMenuItem ("_Scramble"); scramble_item.Image = new Gtk.Image (Gtk.Stock.Refresh, IconSize.Menu); scramble_item.Activated += new EventHandler (Scramble); ImageMenuItem quit_item = new ImageMenuItem ("_Quit"); quit_item.Image = new Gtk.Image (Gtk.Stock.Quit, IconSize.Menu); quit_item.Activated += new EventHandler (Quit); file_menu.Append (scramble_item); file_menu.Append (new SeparatorMenuItem ()); file_menu.Append (quit_item); MenuItem file_item = new MenuItem ("_File"); file_item.Submenu = file_menu; mb.Append (file_item); Menu help_menu = new Menu (); MenuItem help_item = new MenuItem ("_Help"); help_item.Submenu = help_menu; ImageMenuItem about = new ImageMenuItem (Gnome.Stock.About, new AccelGroup ()); about.Activated += new EventHandler (About_Box); help_menu.Append (about); mb.Append (help_item); return mb; }
protected void Populate() { this.SetDefaultSize(1024,768); Window pingpong = new Window(Gtk.WindowType.Toplevel); pingpong.SetDefaultSize(500,50); pingpong.SetPosition(Gtk.WindowPosition.CenterOnParent); pingpong.Title = "Loading..."; _pulseBar = new ProgressBar(); pingpong.Add(_pulseBar); pingpong.ShowAll(); pingpong.Show(); while (_currentStrs == null) { Application.Invoke( delegate { _pulseBar.Pulse(); }); Thread.Sleep(100); } Application.Invoke( delegate { pingpong.Destroy(); this.Remove(_vbox); _vbox = new VBox(false, 10); 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.PackStart(bar, false, false, 0); _regxTitle = ComboBox.NewText(); _regxTitle.Changed += HandleChanged; foreach (KeyValuePair<string, string> pair in _regexes) _regxTitle.AppendText(pair.Key); _regx = new Entry(); _regx.IsEditable = false; _regx.CanFocus = false; HBox comboRegexBox = new HBox(true, 10); comboRegexBox.SetSizeRequest(768, 50); comboRegexBox.PackStart(_regxTitle, false,false, 0); comboRegexBox.PackStart(_regx, true, true, 0); Button search = new Button("Search!"); search.Clicked += HandleClicked; comboRegexBox.PackStart(search, false, false, 20); _vbox.PackStart(comboRegexBox, true, true, 10); ScrolledWindow sw = new ScrolledWindow(); _tv = new TreeView(); sw.Add(_tv); CellRendererText tsText = new CellRendererText(); TreeViewColumn match = new TreeViewColumn(); match.Title = "Match"; match.PackStart(tsText, true); match.AddAttribute(tsText, "text", 0); _tv.AppendColumn(match); TreeStore store = new TreeStore(typeof(string)); foreach (string str in _currentStrs) store.AppendValues(str); _tv.Model = store; sw.SetSizeRequest(768,600); _vbox.PackStart(sw, false, false, 0); this.Add(_vbox); this.ShowAll(); }); }
public static void Main(string [] args) { Application.Init(); Window win = new Window("EFL# Demo App"); win.Resize(640, 480); Application.EE.ResizeEvent += AppResizeHandler; /* integrate this code in the Window class */ Edje win_bg = new Edje(Application.EE.Get()); win_bg.FileSet(DataConfig.DATADIR + "/data/eblocks/themes/e17.edj","window"); win_bg.Resize(640, 480); win_bg.Move(0, 0); win_bg.Lower(); win_bg.Show(); MenuItem item; MenuItem entry; MenuBar mb = new MenuBar(); mb.Move(0, 0); mb.Resize(640, 35); mb.Spacing = 15; item = new MenuItem("_File"); Menu file_menu = new Menu(); entry = new MenuItem(file_menu.Canvas, "_Open"); file_menu.Append(entry); entry = new MenuItem(file_menu.Canvas, "_Close"); file_menu.Append(entry); entry = new MenuItem(file_menu.Canvas, "_Save"); file_menu.Append(entry); item.SubMenu = file_menu; mb.Append(item); item = new MenuItem("_Edit"); Menu edit_menu = new Menu(); entry = new MenuItem(edit_menu.Canvas, "_Copy"); edit_menu.Append(entry); entry = new MenuItem(edit_menu.Canvas, "_Cut"); edit_menu.Append(entry); entry = new MenuItem(edit_menu.Canvas, "_Paste"); edit_menu.Append(entry); item.SubMenu = edit_menu; mb.Append(item); item = new MenuItem("_About"); //item.SubMenu = about_menu; mb.Append(item); mb.Show(); Button button; HBox box_left = new HBox(); box_left.Move(0, 37); box_left.Resize(70, 480 - 37); VBox box_icons = new VBox(); box_icons.Spacing = 0; box_icons.Resize(64, 480 - 37); button = new Button("Tile"); button.Resize(64, 64); box_icons.PackEnd(button); button = new Button("Stretch"); button.Resize(64, 64); box_icons.PackEnd(button); button = new Button("Rotate"); button.Resize(64, 64); box_icons.PackEnd(button); button = new Button("Flip"); button.Resize(64, 64); box_icons.PackEnd(button); button = new Button("Quit"); button.MouseUpEvent += new Enlightenment.Evas.Item.EventHandler(AppQuitButtonHandler); button.Resize(64, 64); box_icons.PackEnd(button); box_left.PackEnd(box_icons); Enlightenment.Eblocks.Line vline = new Enlightenment.Eblocks.Line(Application.EE.Get()); vline.Vertical = true; vline.Resize(6, 480 - 37); box_left.PackEnd(vline); box_left.Show(); dir = args[0]; imageTable = new Table(Application.EE.Get(), items); HBox box_images = new HBox(); box_images.Move(70, 37); box_images.Spacing = 0; box_images.Resize(640 - 70 - 2, 480 - 37 - 2); box_images.PackStart(imageTable); Application.EE.DataSet("box_images", box_images); Application.EE.DataSet("box_left", box_left); Application.EE.DataSet("box_icons", box_icons); Application.EE.DataSet("win_bg", win_bg); Application.EE.DataSet("vline", vline); Application.EE.DataSet("mb", mb); WaitCallback callback = new WaitCallback(Callback); ThreadPool.QueueUserWorkItem(callback); win.ShowAll(); Application.Run(); }
protected void SetupMenu() { menuBar = new MenuBar(); Menu fileMenu = new Menu(); MenuItem exitItem = new MenuItem("Exit"); exitItem.Activated += QuitHandler; fileMenu.Append(exitItem); MenuItem fileItem = new MenuItem("File"); fileItem.Submenu = fileMenu; menuBar.Append(fileItem); vbox.PackStart(menuBar); }
public static void TestBoxesButtonMenus(object o, object eventargs) { Window w = new Window("Boxes, Buttons & Menus Test"); VBox vbx = new VBox (); vbx.Spacing = 4; MenuBar mb = new MenuBar(); vbx.PackStart (mb, false, false, 0); MenuItem item = new MenuItem ("File"); Menu file_menu = new Menu (); item.Submenu = file_menu; MenuItem file_item = new MenuItem ("Open"); file_item.Activated += TestButtons_FileOpenHandler; file_menu.Append (file_item); file_item = new MenuItem ("Close"); file_menu.Append (file_item); Menu close_menu = new Menu (); file_item.Submenu = close_menu; MenuItem close_menu_item = new MenuItem ("Close This"); close_menu.Append (close_menu_item); close_menu_item = new MenuItem ("Close All"); close_menu.Append (close_menu_item); file_item = new MenuItem ("Save"); file_menu.Append (file_item); file_item = new MenuItem ("Save As"); file_menu.Append (file_item); file_item = new MenuItem ("Quit"); file_item.Activated += TestButtons_FileQuitHandler; file_menu.Append (file_item); mb.Append (item); item = new MenuItem ("Edit"); Menu edit_menu = new Menu (); item.Submenu = edit_menu; mb.Append (item); item = new MenuItem ("About"); Menu about_menu = new Menu (); item.Submenu = about_menu; MenuItem about_item = new MenuItem ("Help"); about_item.Activated += TestButtons_AboutHelpHandler; about_menu.Append (about_item); about_item = new MenuItem ("Authors"); about_item.Activated += TestButtons_AboutAuthorsHandler; about_menu.Append (about_item); mb.Append (item); HBox bx = new HBox (); vbx.PackStart (bx); bx.Spacing = 0; Button l1 = new Button ("one"); Button l2 = new Button ("two"); Button l3 = new Button ("three"); Button l4 = new Button ("four"); Button l5 = new Button ("five"); l5.Clicked += TestButtons_ButtonClicked; bx.PackStart(l1); bx.PackStart(l2); bx.PackStart(l3); bx.PackStart(l4); bx.PackStart(l5); /* HBox inbox = new HBox (); inbox.Spacing = 5; inbox.BorderWidth = 2; vbx.PackStart (inbox); Label input_label = new Label ("What is your name?"); input_label.Xalign = 0; inbox.PackStart (input_label, false, false, 0); input = new Entry (); inbox.PackStart (input); HBox bbox = new HBox (); Button get_text = new Button ("Get Text"); get_text.Clicked += Get_Text; bbox.PackStart (get_text, false, false, 0); vbx.PackStart (bbox, false, false, 0); */ w.Add(vbx); w.SetDefaultSize(300, 200); w.ShowAll(); }
public static void Main(string [] args) { Application.Init(); Window w = new Window("EFL# Demo App"); VBox vbx = new VBox (); vbx.Spacing = 4; MenuBar mb = new MenuBar(); vbx.PackStart (mb, false, false, 0); MenuItem item = new MenuItem ("File"); Menu file_menu = new Menu (); item.Submenu = file_menu; MenuItem file_item = new MenuItem ("Open"); file_item.Activated += FileOpenHandler; file_menu.Append (file_item); file_item = new MenuItem ("Close"); file_menu.Append (file_item); file_item = new MenuItem ("Save"); file_menu.Append (file_item); file_item = new MenuItem ("Save As"); file_menu.Append (file_item); file_item = new MenuItem ("Quit"); file_item.Activated += FileQuitHandler; file_menu.Append (file_item); mb.Append (item); item = new MenuItem ("Edit"); Menu edit_menu = new Menu (); item.Submenu = edit_menu; mb.Append (item); item = new MenuItem ("About"); Menu about_menu = new Menu (); item.Submenu = about_menu; MenuItem about_item = new MenuItem ("Help"); about_item.Activated += AboutHelpHandler; about_menu.Append (about_item); about_item = new MenuItem ("Authors"); about_item.Activated += AboutAuthorsHandler; about_menu.Append (about_item); mb.Append (item); HBox bx = new HBox (); vbx.PackStart (bx); bx.Spacing = 0; Button l1 = new Button ("one"); Button l2 = new Button ("two"); Button l3 = new Button ("three"); Button l4 = new Button ("four"); Button l5 = new Button ("five"); l5.Clicked += Button_Clicked; bx.PackStart(l1); bx.PackStart(l2); bx.PackStart(l3); bx.PackStart(l4); bx.PackStart(l5); Label input_label = new Label ("What is your name?"); input_label.Xalign = 0.5f; input_label.Yalign = 1; vbx.PackStart (input_label); Entry input = new Entry (); vbx.PackStart (input); w.Add(vbx); //w.SetDefaultSize(300, 200); w.ShowAll(); Application.Run(); }
MenuBar CreateMenuBar() { MenuBar mb = new MenuBar(); AccelGroup agrp = new AccelGroup(); AddAccelGroup(agrp); Menu fileMenu = new Menu(); MenuItem item = new MenuItem("_File"); item.Submenu = fileMenu; mb.Append(item); item = new ImageMenuItem(Stock.Quit, agrp); item.Activated += OnMenuQuit; fileMenu.Append(item); Menu viewMenu = new Menu(); item = new MenuItem("_View"); item.Submenu = viewMenu; mb.Append(item); item = new ImageMenuItem(Stock.ZoomIn, agrp); item.Activated += OnZoomIn; viewMenu.Append(item); item = new ImageMenuItem(Stock.ZoomOut, agrp); item.Activated += OnZoomOut; viewMenu.Append(item); item = new ImageMenuItem(Stock.Refresh, agrp); item.Activated += OnReload; viewMenu.Append(item); CheckMenuItem cmi = new CheckMenuItem("_Automatic reload"); cmi.Active = true; cmi.Toggled += OnToggleAuto; viewMenu.Append(cmi); return mb; }
private MenuBar MakeMenuBar() { MenuBar menuBar = new MenuBar(); menuBar.Append(MakeFileMenu()); menuBar.Append(MakeEditMenu()); menuBar.Append(MakeHelpMenu()); return menuBar; }
private void Populate() { this.Remove(_vbox); _vbox = new VBox(false, 3); //_vbox. 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 menu = new VBox (false, 2); menu.PackStart (bar, false, false, 0); _vbox.PackStart(menu, false, false, 0); _hbox = new HBox(); ScrolledWindow sw = new ScrolledWindow(); _tv= new TreeView(); sw.Add(_tv); _tv.RowActivated += HandleRowActivated; CellRendererText tsText = new CellRendererText(); TreeViewColumn timestamp = new TreeViewColumn(); timestamp.Title = "Filename"; timestamp.PackStart(tsText, true); timestamp.AddAttribute(tsText, "text", 0); CellRendererText dlText = new CellRendererText(); TreeViewColumn datalength = new TreeViewColumn(); datalength.Title = "Hive type"; datalength.PackStart(dlText, true); datalength.AddAttribute(dlText, "text", 1); _tv.AppendColumn(timestamp); _tv.AppendColumn(datalength); TreeStore store = new TreeStore(typeof(string), typeof(string)); _hives = _hives.OrderBy(h => h.GetType().Name).ToList(); foreach (RegistryHive hive in _hives) { string[] strs = hive.Filepath.Split(System.IO.Path.DirectorySeparatorChar); store.AppendValues(strs[strs.Length-1], hive.GetType().Name); } _tv.Model = store; _hbox.PackStart(sw, true, true, 0); _vbox.PackStart (_hbox, true, true, 0); this.Add(_vbox); this.ShowAll(); }