// ============================================ // 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(); }
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; }
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 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(); }
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 (); }
private MenuBar CreateMenu(MenuItem[] items) { var acc = new MenuBar(); foreach (var item in items) acc.Append(Map(item)); return acc; }
public MenuBar StartMenuBar() { MenuBar menuBar = new MenuBar(); stack.Push(menuBar); return menuBar; }
// ============================================ // PUBLIC Constructors // ============================================ /// Create New NyFolder Window public Window() : base(Info.Name + " " + Info.Version) { // Initialize Window this.SetDefaultSize(620, 320); DefaultIcon = StockIcons.GetPixbuf("NyFolderIcon"); this.DeleteEvent += new DeleteEventHandler(OnWindowDelete); // Initialize VBox this.vboxMain = new Gtk.VBox(false, 2); this.Add(this.vboxMain); // Initialize Menu Manager this.menuManager = new MenuManager(); this.menuManager.Activated += new EventHandler(OnMenuActivated); this.AddAccelGroup(this.menuManager.AccelGroup); // Initialize HBox Menu this.hboxMenu = new Gtk.HBox(false, 0); this.vboxMain.PackStart(hboxMenu, false, false, 0); // Initialize MenuBar Gtk.MenuBar menuBar = this.MenuBar; this.hboxMenu.PackStart(menuBar, false, false, 0); // Initialize HBox this.hbox = new Gtk.HBox(); this.vboxMain.PackStart(this.hbox, true, true, 2); // Initialize Left VBox this.vboxLeft = new Gtk.VBox(false, 2); this.hbox.PackStart(this.vboxLeft, false, false, 2); // Initialize User Panel this.userPanel = new UserPanel(); this.vboxLeft.PackStart(this.userPanel, false, false, 2); // Initialize Right VBox this.vboxRight = new Gtk.VBox(false, 2); this.hbox.PackStart(this.vboxRight, true, true, 2); // Initialize ToolBar Gtk.Toolbar toolBar = this.ToolBar; toolBar.ShowArrow = true; toolBar.IconSize = Gtk.IconSize.LargeToolbar; toolBar.ToolbarStyle = ToolbarStyle.Both; this.vboxRight.PackStart(toolBar, false, false, 2); // Initialize Notebook Viewer this.notebookViewer = new NotebookViewer(); this.vboxRight.PackStart(this.notebookViewer, true, true, 2); // Initialize Status Bar this.statusBar = new Gtk.Statusbar(); this.vboxMain.PackEnd(this.statusBar, false, false, 0); // Window Show All this.ShowAll(); }
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 (); }
void DestroyMenuBar() { if (topMenu == null) { return; } rootWidget.Remove(topMenu); topMenu = null; }
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; }
public void CreateMainMenu(Gtk.MenuBar menu) { // File menu ImageMenuItem file = (ImageMenuItem)menu.Children[0]; file.Submenu = new Menu(); File.CreateMainMenu((Menu)file.Submenu); //Edit menu ImageMenuItem edit = (ImageMenuItem)menu.Children[1]; edit.Submenu = new Menu(); Edit.CreateMainMenu((Menu)edit.Submenu); // View menu ImageMenuItem view = (ImageMenuItem)menu.Children[2]; View.CreateMainMenu((Menu)view.Submenu); // Image menu ImageMenuItem image = (ImageMenuItem)menu.Children[3]; image.Submenu = new Menu(); Image.CreateMainMenu((Menu)image.Submenu); //Layers menu ImageMenuItem layer = (ImageMenuItem)menu.Children[4]; layer.Submenu = new Menu(); Layers.CreateMainMenu((Menu)layer.Submenu); //Adjustments menu ImageMenuItem adj = (ImageMenuItem)menu.Children[5]; adj.Submenu = new Menu(); Adjustments.CreateMainMenu((Menu)adj.Submenu); // Effects menu ImageMenuItem eff = (ImageMenuItem)menu.Children[6]; eff.Submenu = new Menu(); Effects.CreateMainMenu((Menu)eff.Submenu); // Window menu ImageMenuItem window = (ImageMenuItem)menu.Children[7]; window.Submenu = new Menu(); Window.CreateMainMenu((Menu)window.Submenu); //Help menu ImageMenuItem help = (ImageMenuItem)menu.Children[8]; help.Submenu = new Menu(); Help.CreateMainMenu((Menu)help.Submenu); }
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); }
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(); }
public void SetupChildren () { VBox l = new VBox (false, 0); Add (l); menubar = CreateMenu (); toolbar = CreateToolbar (); statusbar = CreateStatusBar (); friends = CreateFriends (); l.PackStart (menubar, false, false, 0); l.PackStart (toolbar); l.PackStart (statusbar); }
//------------------------------------------------------------------------------ public MainMenu() { uim = new Gtk.UIManager(); Gtk.ActionGroup actions = new Gtk.ActionGroup("MenuBarActions" + Guid.NewGuid()); actions.Add(getActionEntries()); uim.InsertActionGroup(actions, 0); // Put the XML definition of the controls (widgets) into the UIManager's buffer -and- create controls (widgets). uim.AddUiFromString(UI.ToString()); instance = (Gtk.MenuBar)uim.GetWidget("/menubar"); instance.ShowAll(); }
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); }
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); }
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; }
Gtk.MenuBar CreateMenuBar() { ActionManager am = Tomboy.ActionManager; menubar_ui = Tomboy.ActionManager.UI.AddUiFromResource( "TasksUIManagerLayout.xml"); Gtk.MenuBar menubar = Tomboy.ActionManager.GetWidget("/TaskListWindowMenubar") as Gtk.MenuBar; am ["NewTaskAction"].Activated += OnNewTask; am ["OpenTaskAction"].Activated += OnOpenTask; am ["OpenOriginNoteAction"].Activated += OnOpenOriginNote; am ["OpenOriginNoteAction"].Sensitive = false; am ["CloseTaskListWindowAction"].Activated += OnCloseWindow; am ["DeleteTaskAction"].Activated += OnDeleteTask; am ["ShowTaskHelpAction"].Activated += OnShowHelp; // View Options bool pref_val; show_completed_tasks_toggle_action = am ["ShowCompletedTasksAction"] as Gtk.ToggleAction; pref_val = GetPref(TaskListWindow.ShowCompletedTasksPreference); show_completed_tasks_toggle_action.Active = pref_val; show_completed_tasks_toggle_action.Activated += OnShowCompletedTasks; show_completed_tasks = pref_val; show_due_date_column_toggle_action = am ["ShowDueDateColumnAction"] as Gtk.ToggleAction; pref_val = GetPref(TaskListWindow.ShowDueDateColumnPreference); show_due_date_column_toggle_action.Active = pref_val; show_due_date_column_toggle_action.Activated += OnShowDueDateColumn; show_priority_column_toggle_action = am ["ShowPriorityColumnAction"] as Gtk.ToggleAction; pref_val = GetPref(TaskListWindow.ShowPriorityColumnPreference); show_priority_column_toggle_action.Active = pref_val; show_priority_column_toggle_action.Activated += OnShowPriorityColumn; return(menubar); }
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(); } }
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(); }
void IPlugin.Init(object context) { morphose = context as IDataMorphose; Gtk.MenuBar mainMenuBar = morphose.GetMainMenu(); Gtk.MenuItem fileMenu = null; // Find the File menu if present foreach (Gtk.Widget w in mainMenuBar.Children) { if (w.Name == "FileAction") { fileMenu = w as Gtk.MenuItem; break; } } // If not present - create it if (fileMenu == null) { Gtk.Menu menu = new Gtk.Menu(); fileMenu = new Gtk.MenuItem("File"); fileMenu.Submenu = menu; mainMenuBar.Append(fileMenu); } // Setting up the Import and Export menu item in File menu Gtk.MenuItem import = new Gtk.MenuItem("Import"); import.Activated += OnImportActivated; (fileMenu.Submenu as Gtk.Menu).Prepend(import); Gtk.MenuItem export = new Gtk.MenuItem("Export"); export.Activated += OnExportActivated; (fileMenu.Submenu as Gtk.Menu).Prepend(export); }
// ======================================== // PUBLIC Constructors // ======================================== public Window() : base(Info.Name + " " + Info.Version) { // Initialize Window Properties this.SetDefaultSize(500, 300); DefaultIcon = StockIcons.GetPixbuf("NyIVIcon"); this.DeleteEvent += new DeleteEventHandler(OnWindowDelete); // Initialize VBox this.vbox = new Gtk.VBox(false, 0); this.Add(this.vbox); // Initialize Menu & Toolbar this.uiMenuManager = new UiMenuManager(); this.uiMenuManager.Activated += new EventHandler(OnMenuActivated); this.AddAccelGroup(this.uiMenuManager.AccelGroup); // Initialize MenuBar Gtk.MenuBar menubar = this.MenuBar; this.vbox.PackStart(menubar, false, false, 0); // Initialize ToolBar Gtk.Toolbar toolbar = this.ToolBar; toolbar.ToolbarStyle = ToolbarStyle.Both; toolbar.IconSize = IconSize.LargeToolbar; this.vbox.PackStart(toolbar, false, false, 0); // Initialize Viewer this.viewer = new Viewer(); this.vbox.PackStart(this.viewer, true, true, 2); // Initialize StatusBar this.statusBar = new Gtk.Statusbar(); this.vbox.PackEnd(this.statusBar, false, false, 0); // Set Sensitive Menu SetSensitiveImageMenu(false); }
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 (); }
void CreateMenuBar() { topMenu = new Gtk.MenuBar(); Menu fileMenu = new Menu(); MenuItem file = new MenuItem("File"); file.Submenu = fileMenu; AccelGroup agr = new AccelGroup(); AddAccelGroup(agr); ImageMenuItem exit = new ImageMenuItem(Stock.Quit, agr); exit.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); exit.Activated += onButtonPressEvent; fileMenu.Append(exit); topMenu.Append(file); ((VBox)fullViewVBox).PackStart(topMenu, false, false, 0); ((Gtk.Box.BoxChild)fullViewVBox [topMenu]).Position = 0; topMenu.ShowAll(); }
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); } } }
void OnExtensionChanged (object s, ExtensionEventArgs args) { if (args.PathChanged (mainMenuPath)) { if (DesktopService.SetGlobalMenu (IdeApp.CommandService, mainMenuPath)) return; UninstallMenuBar (); topMenu = IdeApp.CommandService.CreateMenuBar (mainMenuPath); InstallMenuBar (); } if (args.PathChanged (toolbarsPath)) { toolbars = IdeApp.CommandService.CreateToolbarSet (toolbarsPath); string cl = toolbarFrame.CurrentLayout; DockToolbarFrameStatus mem = toolbarFrame.GetStatus (); toolbarFrame.ClearToolbars (); foreach (DockToolbar tb in toolbars) { tb.ToolbarStyle = Gtk.ToolbarStyle.Icons; tb.ShowAll (); toolbarFrame.AddBar (tb); } toolbarFrame.SetStatus (mem); toolbarFrame.CurrentLayout = cl; } }
/// <summary> /// Creates the menubar elements of a GUI. /// </summary> /// <returns></returns> private Widget CreateGuiMenubar() { // Create the menu items we'll be using. newMenuItem = new ImageMenuItem(Stock.New, accelerators); newMenuItem.Activated += OnProjectMenuNewItem; openMenuItem = new ImageMenuItem(Stock.Open, accelerators); openMenuItem.Activated += OnProjectMenuOpenItem; closeMenuItem = new ImageMenuItem(Stock.Close, accelerators) { Sensitive = false }; closeMenuItem.Activated += OnProjectMenuCloseItem; saveMenuItem = new ImageMenuItem(Stock.Save, accelerators) { Sensitive = false }; saveMenuItem.Activated += OnProjectMenuSaveItem; exitMenuItem = new ImageMenuItem(Stock.Quit, accelerators); exitMenuItem.Activated += OnProjectMenuExitItem; aboutMenuItem = new ImageMenuItem(Stock.About, accelerators); aboutMenuItem.Activated += OnHelpMenuAboutItem; // Create the project menu. var projectMenu = new Menu { newMenuItem, openMenuItem, closeMenuItem, new SeparatorMenuItem(), saveMenuItem, new SeparatorMenuItem(), exitMenuItem }; var projectMenuItem = new MenuItem("_Project") { Submenu = projectMenu }; // Create the about menu. var helpMenu = new Menu { aboutMenuItem, }; var helpMenuItem = new MenuItem("_Help") { Submenu = helpMenu }; // Create the menu bar and reutrn it. var menuBar = new MenuBar { projectMenuItem, helpMenuItem, }; return menuBar; }
private MenuBar CreateNormalMenu() { MenuBar menubar = new MenuBar (); AccelGroup agrp = new AccelGroup(); this.AddAccelGroup(agrp); Menu iFolderMenu = new Menu(); NewMenuItem = new ImageMenuItem (Util.GS("_Upload a folder...")); NewMenuItem.Image = new Image( new Gdk.Pixbuf(Util.ImagesPath("ifolder24.png"))); iFolderMenu.Append(NewMenuItem); NewMenuItem.AddAccelerator("activate", agrp, new AccelKey(Gdk.Key.N, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); NewMenuItem.Activated += new EventHandler(AddiFolderHandler); DownloadMenuItem = new MenuItem (Util.GS("_Download...")); iFolderMenu.Append(DownloadMenuItem); DownloadMenuItem.Activated += new EventHandler(DownloadAvailableiFolderHandler); DeleteMenuItem = new ImageMenuItem (Util.GS("Dele_te from server")); DeleteMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu); iFolderMenu.Append(DeleteMenuItem); DeleteMenuItem.Activated += new EventHandler(DeleteFromServerHandler); RemoveMenuItem = new ImageMenuItem (Util.GS("Re_move my membership")); RemoveMenuItem.Image = new Image(Stock.Delete, Gtk.IconSize.Menu); iFolderMenu.Append(RemoveMenuItem); RemoveMenuItem.Activated += new EventHandler(RemoveMembershipHandler); iFolderMenu.Append(new SeparatorMenuItem()); OpenMenuItem = new ImageMenuItem ( Stock.Open, agrp ); iFolderMenu.Append(OpenMenuItem); OpenMenuItem.Activated += new EventHandler(OnOpenSynchronizedFolder); ShareMenuItem = new MenuItem (Util.GS("Share _with...")); iFolderMenu.Append(ShareMenuItem); ShareMenuItem.Activated += new EventHandler(OnShareSynchronizedFolder); ConflictMenuItem = new MenuItem (Util.GS("Resolve conflic_ts")); iFolderMenu.Append(ConflictMenuItem); ConflictMenuItem.Activated += new EventHandler(OnResolveConflicts); SyncNowMenuItem = new MenuItem(Util.GS("S_ynchronize now")); iFolderMenu.Append(SyncNowMenuItem); SyncNowMenuItem.Activated += new EventHandler(OnSynchronizeNow); RevertMenuItem = new ImageMenuItem (Util.GS("C_hange to a normal folder")); RevertMenuItem.Image = new Image(Stock.Undo, Gtk.IconSize.Menu); iFolderMenu.Append(RevertMenuItem); RevertMenuItem.Activated += new EventHandler(RemoveiFolderHandler); PropMenuItem = new ImageMenuItem (Stock.Properties, agrp); iFolderMenu.Append(PropMenuItem); PropMenuItem.Activated += new EventHandler(OnShowFolderProperties); iFolderMenu.Append(new SeparatorMenuItem()); CloseMenuItem = new ImageMenuItem (Stock.Close, agrp); iFolderMenu.Append(CloseMenuItem); CloseMenuItem.Activated += new EventHandler(CloseEventHandler); QuitMenuItem = new ImageMenuItem(Stock.Quit, agrp); iFolderMenu.Append(QuitMenuItem); QuitMenuItem.Activated += new EventHandler(QuitEventHandler); MenuItem iFolderMenuItem = new MenuItem(Util.GS("i_Folder")); iFolderMenuItem.Submenu = iFolderMenu; menubar.Append (iFolderMenuItem); Menu EditMenu = new Menu(); AccountsMenuItem = new MenuItem (Util.GS("_Account Settings...")); EditMenu.Append(AccountsMenuItem); AccountsMenuItem.Activated += new EventHandler(AccountsMenuItemHandler); PreferencesMenuItem = new ImageMenuItem(Util.GS("_Preferences")); PreferencesMenuItem.Image = new Image(Stock.Preferences, Gtk.IconSize.Menu); EditMenu.Append(PreferencesMenuItem); PreferencesMenuItem.Activated += new EventHandler(ShowPreferencesHandler); MenuItem EditMenuItem = new MenuItem(Util.GS("_Edit")); EditMenuItem.Submenu = EditMenu; menubar.Append(EditMenuItem); Menu ViewMenu = new Menu(); RefreshMenuItem = new ImageMenuItem(Stock.Refresh, agrp); ViewMenu.Append(RefreshMenuItem); RefreshMenuItem.Activated += new EventHandler(RefreshiFoldersHandler); ViewMenu.Append(new SeparatorMenuItem()); SyncLogMenuItem = new MenuItem (Util.GS("Synchronization _Log")); ViewMenu.Append(SyncLogMenuItem); SyncLogMenuItem.Activated += new EventHandler(SyncLogMenuItemHandler); ViewMenu.Append(new SeparatorMenuItem()); ViewServeriFoldersMenuItem = new CheckMenuItem(Util.GS("View _available iFolders")); ViewMenu.Append(ViewServeriFoldersMenuItem); ViewServeriFoldersMenuItem.Toggled += new EventHandler(OnToggleViewServeriFoldersMenuItem); MenuItem showColorPaletteMenuItem = new MenuItem("Show _Color Palette (FIXME: Remove this before shipping)..."); ViewMenu.Append(showColorPaletteMenuItem); showColorPaletteMenuItem.Activated += ShowColorPalette; MenuItem ViewMenuItem = new MenuItem(Util.GS("_View")); ViewMenuItem.Submenu = ViewMenu; menubar.Append(ViewMenuItem); Menu HelpMenu = new Menu(); HelpMenuItem = new ImageMenuItem(Stock.Help, agrp); HelpMenu.Append(HelpMenuItem); HelpMenuItem.Activated += new EventHandler(OnHelpMenuItem); AboutMenuItem = new ImageMenuItem(Util.GS("A_bout")); AboutMenuItem.Image = new Image(Gnome.Stock.About, Gtk.IconSize.Menu); HelpMenu.Append(AboutMenuItem); AboutMenuItem.Activated += new EventHandler(OnAbout); MenuItem MainHelpMenuItem = new MenuItem(Util.GS("_Help")); MainHelpMenuItem.Submenu = HelpMenu; menubar.Append(MainHelpMenuItem); return menubar; }
private MenuBar CreateWelcomeMenuBar() { MenuBar menubar = new MenuBar (); AccelGroup agrp = new AccelGroup(); this.AddAccelGroup(agrp); Menu menu = new Menu(); ImageMenuItem imageMenuItem = new ImageMenuItem (Util.GS("Connect to a _server")); Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(Util.ImagesPath("add-account.png")); pixbuf = pixbuf.ScaleSimple(24, 24, Gdk.InterpType.Bilinear); imageMenuItem.Image = new Image(pixbuf); menu.Append(imageMenuItem); imageMenuItem.AddAccelerator("activate", agrp, new AccelKey(Gdk.Key.S, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); imageMenuItem.Activated += new EventHandler(OnAddNewAccount); menu.Append(new SeparatorMenuItem()); imageMenuItem = new ImageMenuItem (Stock.Close, agrp); menu.Append(imageMenuItem); imageMenuItem.Activated += new EventHandler(CloseEventHandler); imageMenuItem = new ImageMenuItem(Stock.Quit, agrp); menu.Append(imageMenuItem); imageMenuItem.Activated += new EventHandler(QuitEventHandler); MenuItem menuItem = new MenuItem(Util.GS("i_Folder")); menuItem.Submenu = menu; menubar.Append (menuItem); menu = new Menu(); imageMenuItem = new ImageMenuItem(Util.GS("_Preferences")); imageMenuItem.Image = new Image(Stock.Preferences, Gtk.IconSize.Menu); menu.Append(imageMenuItem); imageMenuItem.Activated += new EventHandler(ShowPreferencesHandler); menuItem = new MenuItem(Util.GS("_Edit")); menuItem.Submenu = menu; menubar.Append(menuItem); menu = new Menu(); imageMenuItem = new ImageMenuItem(Stock.Help, agrp); menu.Append(imageMenuItem); imageMenuItem.Activated += new EventHandler(OnHelpMenuItem); imageMenuItem = new ImageMenuItem(Util.GS("A_bout")); imageMenuItem.Image = new Image(Gnome.Stock.About, Gtk.IconSize.Menu); menu.Append(imageMenuItem); imageMenuItem.Activated += new EventHandler(OnAbout); menuItem = new MenuItem(Util.GS("_Help")); menuItem.Submenu = menu; menubar.Append(menuItem); return menubar; }
public RatingEntryTestModule() : base("Rating Entry") { VBox pbox = new VBox (); Add (pbox); Menu m = new Menu (); MenuBar b = new MenuBar (); MenuItem item = new MenuItem ("Rate Me!"); item.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); VBox box = new VBox (); box.BorderWidth = 10; box.Spacing = 10; pbox.PackStart (box, true, true, 0); RatingEntry entry1 = new RatingEntry (); box.PackStart (entry1, true, true, 0); RatingEntry entry2 = new RatingEntry (); box.PackStart (entry2, false, false, 0); box.PackStart (new Entry ("Normal GtkEntry"), false, false, 0); RatingEntry entry3 = new RatingEntry (); Pango.FontDescription fd = entry3.PangoContext.FontDescription.Copy (); fd.Size = (int)(fd.Size * Pango.Scale.XXLarge); entry3.OverrideFont (fd); fd.Dispose (); box.PackStart (entry3, true, true, 0); pbox.ShowAll (); }
public Gui() { dlayer = new DataLayer (); window_addtag.SetSizeRequest (100, 100); window.Icon = new Gdk.Pixbuf ("lipsticktower.jpg"); //Kalle, Andreas :: Call for Icon! Gtk.Entry tagEntry = new Gtk.Entry (); Gtk.VBox tagbox = new Gtk.VBox (false, 0); tagbox.PackStart (tagEntry, true, true, 0); window_addtag.Add (tagbox); window_addtag.ShowAll (); window.SetSizeRequest (300, 500); window.DeleteEvent += DeleteEvent; window.Icon = new Gdk.Pixbuf ("lipsticktower.jpg"); //Kalle, Andreas :: Call for Icon! Gtk.VBox box = new Gtk.VBox (false, 0); Gtk.HBox top = new Gtk.HBox (false, 0); //Gtk.ComboBox selector = new Gtk.ComboBox (); Gtk.ComboBox selector = ComboBox.NewText (); ScrolledWindow scroll = new ScrolledWindow (); filterEntry = new Gtk.Entry (); filterEntry.MaxLength = 1; filterEntry.Changed += OnFilterEntryTextChanged; //Gtk.TreeView tree = new Gtk.TreeView (); tree.HeadersVisible = false; tree.Reorderable = true; tree.EnableSearch = false; tree.RowActivated += OnRowActivate; Gtk.TreeViewColumn iconCol = new Gtk.TreeViewColumn ( ); iconCol.Title = "Icon"; Gtk.CellRendererPixbuf iconCell = new Gtk.CellRendererPixbuf (); iconCol.PackStart (iconCell, true); iconCol.SetCellDataFunc (iconCell, new Gtk.TreeCellDataFunc (RenderIcon)); Gtk.TreeViewColumn primCol = new Gtk.TreeViewColumn ( ); primCol.Title = "Primary Info"; Gtk.CellRendererText primInfoCell = new Gtk.CellRendererText (); primCol.PackStart (primInfoCell, true); primCol.SetCellDataFunc (primInfoCell, new Gtk.TreeCellDataFunc (RenderPrimary)); Gtk.TreeViewColumn secCol = new Gtk.TreeViewColumn ( ); secCol.Title = "Secondary Info"; Gtk.CellRendererText secInfoCell = new Gtk.CellRendererText (); secCol.PackStart (secInfoCell, true); secCol.SetCellDataFunc (secInfoCell, new Gtk.TreeCellDataFunc (RenderSecondary)); projects = DataLayer.GetProjectNames (); foreach (string project in projects) { Console.WriteLine (project); selector.AppendText (project); } selector.Changed += new EventHandler (OnSelectorChanged); //Store AssetStore = dlayer.GetAssets (projID); /*filter = new Gtk.TreeModelFilter (AssetStore, null); filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc (FilterTree); tree.Model = filter;*/ //tree.Model = dlayer.GetAssets (projID); tree.AppendColumn (iconCol); tree.AppendColumn (primCol); tree.AppendColumn (secCol); MenuBar menu = new MenuBar (); Menu fileMenu = new Menu(); MenuItem menuItem = new MenuItem("_File"); menuItem.Submenu = fileMenu; menu.Append(menuItem); Statusbar status = new Statusbar (); Toolbar tool = new Toolbar (); ToolButton plus = new ToolButton (Gtk.Stock.Add); plus.Clicked += OnAddClicked; ToolButton minus = new ToolButton (Gtk.Stock.Remove); minus.Clicked += OnMinusClicked; box.PackStart (menu, false, true, 0); box.PackStart (tool, false, true, 0); tool.Insert(minus, 0); tool.Insert(plus, 0); top.PackStart (filterEntry, true, true, 0); top.PackStart (selector, true, true, 0); box.PackStart (top, false, true, 0); scroll.Add (tree); box.PackStart (scroll, true, true, 0); box.PackStart (status, false, true, 0); window.Add (box); window.ShowAll (); }
public DemoMain() { window = new Gtk.Window("TestForm1"); Gtk.HBox hbox = new Gtk.HBox(false, 0); hbox1 = new Gtk.HBox(false, 0); Gtk.HBox hbox2 = new Gtk.HBox(false, 0); Gtk.HBox hbox3 = new Gtk.HBox(false, 0); hbox.Add(hbox1); window.SetDefaultSize(600, 400); window.DeleteEvent += new DeleteEventHandler(WindowDelete); button1 = new Gtk.Button("button1"); button1.Clicked += Button1Clicked; button2 = new Gtk.Button("button2"); button3 = new Gtk.Button("button3"); Gtk.Button button4 = new Gtk.Button("button4"); button4.Clicked += Button4Clicked; Gtk.Button button5 = new Gtk.Button("button5"); Gtk.Button button6 = new Gtk.Button("button6"); Gtk.Button button7 = new Gtk.Button("button7"); button7.Sensitive = false; scaleButton1 = new Gtk.ScaleButton(0, 0, 100, 10, new string [0]); hbox1.Add(hbox3); hbox1.Add(hbox2); hbox1.Add(button3); hbox1.Add(button2); button3.Accessible.Description = "help text 3"; button3.Sensitive = false; label1 = new Gtk.Label("label1"); textBox1 = new Gtk.Entry(); Gtk.Entry textBox2 = new Gtk.Entry(); textBox2.Visibility = false; textBox2.Sensitive = false; textBox2.IsEditable = false; textBox3 = new Gtk.TextView(); // TODO: scrollbars Gtk.CheckButton checkbox1 = new Gtk.CheckButton("checkbox1"); Gtk.CheckButton checkbox2 = new Gtk.CheckButton("checkbox2"); checkbox2.Sensitive = false; Gtk.TreeStore store = new Gtk.TreeStore(typeof(string), typeof(string)); Gtk.TreeIter [] iters = new Gtk.TreeIter [2]; iters [0] = store.AppendNode(); store.SetValues(iters [0], "item 1", "item 1 (2)"); iters [1] = store.AppendNode(iters [0]); store.SetValues(iters [1], "item 1a", "item 1a (2)"); iters [0] = store.AppendNode(); store.SetValues(iters [0], "item 2", "item 2 (2)"); iters [1] = store.AppendNode(iters [0]); store.SetValues(iters [1], "item 2a", "item 2a (2)"); iters [1] = store.AppendNode(iters [0]); store.SetValues(iters [1], "item 2b", "item 2b (2)"); treeView1 = new Gtk.TreeView(store); AddTreeViewColumn(treeView1, 0, "column 1"); treeView1.CollapseAll(); treeView2 = new Gtk.TreeView(store); AddTreeViewColumn(treeView2, 0, "column 1"); AddTreeViewColumn(treeView2, 1, "column 2"); treeView2.CollapseAll(); treeView2.Accessible.Name = "treeView2"; tableStore = new Gtk.TreeStore(typeof(string), typeof(string), typeof(string), typeof(string)); iters [0] = tableStore.AppendNode(); tableStore.SetValues(iters [0], "False", "Alice", "24", ""); iters [0] = tableStore.AppendNode(); tableStore.SetValues(iters [0], "True", "Bob", "28", ""); dataGridView1 = new Gtk.TreeView(tableStore); dataGridView1 = new Gtk.TreeView(tableStore); dataGridView1 = new Gtk.TreeView(tableStore); AddTreeViewColumn(dataGridView1, 0, "Gender"); AddTreeViewColumn(dataGridView1, 1, "Name"); AddTreeViewColumn(dataGridView1, 2, "Age"); dataGridView1.Accessible.Name = "dataGridView1"; hboxPanel = new Gtk.HBox(); Gtk.Button btnRemoveTextBox = new Gtk.Button("Remove"); btnRemoveTextBox.Clicked += RemoveTextBoxClicked; Gtk.Button btnAddTextBox = new Gtk.Button("Add"); btnAddTextBox.Clicked += AddTextBoxClicked; txtCommand = new Gtk.Entry(); txtCommand.Accessible.Name = "txtCommand"; Gtk.Button btnRun = new Gtk.Button("Run"); btnRun.Clicked += btnRunClicked; hboxPanel.Add(btnRemoveTextBox); hboxPanel.Add(btnAddTextBox); Gtk.TreeStore treeStore = new Gtk.TreeStore(typeof(string)); Gtk.TreeIter iter = treeStore.AppendNode(); treeStore.SetValue(iter, 0, "Item 0"); iter = treeStore.AppendNode(); treeStore.SetValue(iter, 0, "Item 1"); listView1 = new Gtk.TreeView(treeStore); AddTreeViewColumn(listView1, 0, "items"); listView1.Accessible.Name = "listView1"; listView1.ExpandAll(); hbox2.Add(button5); hbox2.Add(checkbox1); hbox2.Add(checkbox2); hbox2.Add(button4); hbox2.Accessible.Name = "groupBox2"; hbox3.Add(button7); hbox3.Add(button6); hbox3.Sensitive = false; hbox3.Accessible.Name = "groupBox3"; hbox.Add(textBox3); hbox.Add(textBox2); hbox.Add(textBox1); hbox.Add(label1); hbox.Add(button1); hbox.Add(treeView1); hbox.Add(treeView2); hbox.Add(listView1); hbox.Add(dataGridView1); hbox.Add(txtCommand); hbox.Add(btnRun); hbox.Add(hboxPanel); hbox.Add(scaleButton1); Gtk.Menu file = new Gtk.Menu(); file.Append(new Gtk.MenuItem("_New")); file.Append(new Gtk.MenuItem("_Open")); file.Append(new Gtk.CheckMenuItem("Check")); Gtk.MenuItem fileItem = new Gtk.MenuItem("File"); fileItem.Submenu = file; Gtk.Menu edit = new Gtk.Menu(); edit.Append(new Gtk.MenuItem("_Undo")); edit.Append(new Gtk.SeparatorMenuItem()); edit.Append(new Gtk.MenuItem("_Cut")); edit.Append(new Gtk.MenuItem("Copy")); edit.Append(new Gtk.MenuItem("_Paste")); Gtk.MenuItem editItem = new Gtk.MenuItem("Edit"); editItem.Submenu = edit; Gtk.MenuBar menuBar = new Gtk.MenuBar(); menuBar.Append(fileItem); menuBar.Append(editItem); hbox.Add(menuBar); hbox.Add(new Gtk.SpinButton(0, 100, 1)); hbox.Add(new Gtk.ToggleButton("ToggleButton")); Gtk.Adjustment adj = new Gtk.Adjustment(50, 0, 100, 1, 10, 10); hbox.Add(new Gtk.VScrollbar(adj)); window.Add(hbox); window.ShowAll(); }
public static Gtk.Window Create() { window = new Window ("Menus"); AccelGroup accel_group = new AccelGroup (); window.AddAccelGroup (accel_group); VBox box1 = new VBox (false, 0); window.Add (box1); MenuBar menubar = new MenuBar (); box1.PackStart (menubar, false, false, 0); Menu menu = Create_Menu (2, true); MenuItem menuitem = new MenuItem ("foo"); menuitem.Submenu = menu; menubar.Append (menuitem); menuitem = new MenuItem ("bar"); menuitem.Submenu = Create_Menu (3, true); menubar.Append (menuitem); Image image = new Image (Stock.Help, IconSize.Menu); menuitem = new ImageMenuItem ("Help"); ((ImageMenuItem) menuitem).Image = image; menuitem.Submenu = Create_Menu (4, true); menuitem.RightJustified = true; menubar.Append (menuitem); menubar = new MenuBar (); box1.PackStart (menubar, false, true, 0); menu = Create_Menu (2, true); menuitem = new MenuItem ("Second menu bar"); menuitem.Submenu = menu; menubar.Append (menuitem); VBox box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, true, true, 0); menu = Create_Menu (1, false); menu.AccelGroup = accel_group; menu.Append (new SeparatorMenuItem ()); menuitem = new CheckMenuItem ("Accelerate Me"); menu.Append (menuitem); menuitem.AddAccelerator ("activate", accel_group, 0xFFBE, 0, AccelFlags.Visible); menuitem = new CheckMenuItem ("Accelerator locked"); menu.Append (menuitem); menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible | AccelFlags.Locked); menuitem = new CheckMenuItem ("Accelerator Frozen"); menu.Append (menuitem); menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible); menuitem.AddAccelerator ("activate", accel_group, 0xFFC0, 0, AccelFlags.Visible); OptionMenu option_menu = new OptionMenu (); option_menu.Menu = menu; option_menu.SetHistory (3); box2.PackStart (option_menu, true, true, 0); box1.PackStart (new HSeparator (), false, false, 0); box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, false, true, 0); Button close_button = new Button (Stock.Close); close_button.Clicked += new EventHandler (Close_Button); box2.PackStart (close_button, true, true, 0); close_button.CanDefault = true; close_button.GrabDefault (); window.ShowAll (); return window; }
void CreateMenuBar() { topMenu = IdeApp.CommandService.CreateMenuBar (mainMenuPath); var appMenu = IdeApp.CommandService.CreateMenu (appMenuPath); if (appMenu != null && appMenu.Children.Length > 0) { var item = new MenuItem (BrandingService.ApplicationName); item.Submenu = appMenu; topMenu.Insert (item, 0); } }
internal Client(bool loadFiles) { app_count++; Window = new Gtk.Window(Gtk.WindowType.Toplevel) { Title = Catalog.GetString("PDF Mod") }; Window.SetSizeRequest(640, 480); Window.DeleteEvent += delegate(object o, DeleteEventArgs args) { Quit(); args.RetVal = true; }; // PDF Icon View IconView = new DocumentIconView(this); var iconview_sw = new Gtk.ScrolledWindow(); iconview_sw.AddWithViewport(IconView); query_box = new QueryBox(this) { NoShowAll = true }; query_box.Hide(); // ActionManager ActionManager = new Hyena.Gui.ActionManager(); Window.AddAccelGroup(ActionManager.UIManager.AccelGroup); Actions = new Actions(this, ActionManager); // Status bar StatusBar = new Gtk.Statusbar() { HasResizeGrip = true }; status_label = new Label() { Xalign = 0.0f }; StatusBar.PackStart(status_label, true, true, 6); StatusBar.ReorderChild(status_label, 0); var zoom_slider = new ZoomSlider(this); StatusBar.PackEnd(zoom_slider, false, false, 0); StatusBar.ReorderChild(zoom_slider, 1); // Properties editor box EditorBox = new MetadataEditorBox(this) { NoShowAll = true }; EditorBox.Hide(); // Menubar menu_bar = ActionManager.UIManager.GetWidget("/MainMenu") as MenuBar; // Toolbar HeaderToolbar = ActionManager.UIManager.GetWidget("/HeaderToolbar") as Gtk.Toolbar; HeaderToolbar.ShowArrow = false; HeaderToolbar.ToolbarStyle = ToolbarStyle.Icons; HeaderToolbar.Tooltips = true; HeaderToolbar.NoShowAll = true; HeaderToolbar.Visible = Configuration.ShowToolbar; // BookmarksView BookmarkView = new BookmarkView(this); BookmarkView.NoShowAll = true; BookmarkView.Visible = false; var vbox = new VBox(); vbox.PackStart(menu_bar, false, false, 0); vbox.PackStart(HeaderToolbar, false, false, 0); vbox.PackStart(EditorBox, false, false, 0); vbox.PackStart(query_box, false, false, 0); var hbox = new HPaned(); hbox.Add1(BookmarkView); hbox.Add2(iconview_sw); vbox.PackStart(hbox, true, true, 0); vbox.PackStart(StatusBar, false, true, 0); Window.Add(vbox); Window.ShowAll(); if (loadFiles) { RunIdle(LoadFiles); Application.Run(); } }
private MenuBar CreateShortcutsBar() { // Adds a hidden menubar that contains to enable keyboard // shortcuts to close the log MenuBar menu_bar = 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; menu_bar.Append (file_item); // Hacky way to hide the menubar, but the accellerators // will simply be disabled when using Hide () menu_bar.HeightRequest = 1; menu_bar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal)); return menu_bar; }
protected TaskListWindow(TaskManager manager) : base(Catalog.GetString("To Do List")) { this.manager = manager; this.IconName = "tomboy"; this.SetDefaultSize(500, 300); this.sort_column = SortColumn.CompletionDate; AddAccelGroup(Tomboy.ActionManager.UI.AccelGroup); action_group = new Gtk.ActionGroup("TaskList"); action_group.Add(new Gtk.ActionEntry [] { new Gtk.ActionEntry("TaskListFileMenuAction", null, Catalog.GetString("_File"), null, null, null), new Gtk.ActionEntry("NewTaskAction", Gtk.Stock.New, Catalog.GetString("New _Task"), "<Control>T", Catalog.GetString("Create a new task"), null), new Gtk.ActionEntry("OpenTaskAction", String.Empty, Catalog.GetString("_Options..."), "<Control>O", Catalog.GetString("Open the selected task"), null), new Gtk.ActionEntry("CloseTaskListWindowAction", Gtk.Stock.Close, Catalog.GetString("_Close"), "<Control>W", Catalog.GetString("Close this window"), null), new Gtk.ActionEntry("TaskListEditMenuAction", null, Catalog.GetString("_Edit"), null, null, null), new Gtk.ActionEntry("DeleteTaskAction", Gtk.Stock.Preferences, Catalog.GetString("_Delete"), "Delete", Catalog.GetString("Delete the selected task"), null), new Gtk.ActionEntry("OpenOriginNoteAction", null, Catalog.GetString("Open Associated _Note"), null, Catalog.GetString("Open the note containing the task"), null), new Gtk.ActionEntry("TaskListViewMenuAction", null, Catalog.GetString("_View"), null, null, null), new Gtk.ActionEntry("TaskListHelpMenuAction", null, Catalog.GetString("_Help"), null, null, null), new Gtk.ActionEntry("ShowTaskHelpAction", Gtk.Stock.Help, Catalog.GetString("_Contents"), "F1", Catalog.GetString("Tasks Help"), null) }); action_group.Add(new Gtk.ToggleActionEntry [] { new Gtk.ToggleActionEntry("ShowCompletedTasksAction", null, Catalog.GetString("Show _Completed Tasks"), null, Catalog.GetString("Show completed tasks in the list"), null, true), new Gtk.ToggleActionEntry("ShowDueDateColumnAction", null, Catalog.GetString("Show _Due Date Column"), null, Catalog.GetString("Show the due date column in the list"), null, true), new Gtk.ToggleActionEntry("ShowPriorityColumnAction", null, Catalog.GetString("Show _Priority Column"), null, Catalog.GetString("Show the priority column in the list"), null, true) }); Tomboy.ActionManager.UI.InsertActionGroup(action_group, 0); menu_bar = CreateMenuBar(); MakeTasksTree(); tree.Show(); // Update on changes to tasks TaskManager.TaskAdded += OnTaskAdded; TaskManager.TaskDeleted += OnTaskDeleted; TaskManager.TaskStatusChanged += OnTaskStatusChanged; tasks_sw = new Gtk.ScrolledWindow(); tasks_sw.ShadowType = Gtk.ShadowType.In; tasks_sw.VscrollbarPolicy = Gtk.PolicyType.Automatic; tasks_sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; // Reign in the window size if there are notes with long // names, or a lot of notes... Gtk.Requisition tree_req = tree.SizeRequest(); if (tree_req.Height > 420) { tasks_sw.HeightRequest = 420; } if (tree_req.Width > 480) { tasks_sw.WidthRequest = 480; } tasks_sw.Add(tree); tasks_sw.Show(); task_count = new Gtk.Label(); task_count.Xalign = 0; task_count.Show(); Gtk.HBox status_box = new Gtk.HBox(false, 8); status_box.PackStart(task_count, true, true, 0); status_box.Show(); Gtk.VBox vbox = new Gtk.VBox(false, 8); vbox.BorderWidth = 6; vbox.PackStart(tasks_sw, true, true, 0); vbox.PackStart(status_box, false, false, 0); vbox.Show(); // Use another VBox to place the MenuBar // right at thetop of the window. content_vbox = new Gtk.VBox(false, 0); content_vbox.PackStart(menu_bar, false, false, 0); content_vbox.PackStart(vbox, true, true, 0); content_vbox.Show(); this.Add(content_vbox); this.DeleteEvent += OnDelete; this.KeyPressEvent += OnKeyPressed; // For Escape SetUpTreeModel(); }
void UninstallMenuBar() { if (topMenu == null) return; rootWidget.Remove (topMenu); topMenu.Destroy (); topMenu = null; }
public MainWindow(string directory) { log.Debug("Beginning Program"); Gtk.Window.DefaultIcon = new Gdk.Pixbuf(Helper.GetResourceStream("LynnaLab.icon.ico")); Gtk.Builder builder = new Builder(); builder.AddFromString(Helper.ReadResourceFile("LynnaLab.Glade.MainWindow.ui")); builder.Autoconnect(this); mainWindow = (builder.GetObject("mainWindow") as Gtk.Window); menubar1 = (Gtk.MenuBar)builder.GetObject("menubar1"); editMenuItem = (Gtk.MenuItem)builder.GetObject("editMenuItem"); actionMenuItem = (Gtk.MenuItem)builder.GetObject("actionMenuItem"); debugMenuItem = (Gtk.MenuItem)builder.GetObject("debugMenuItem"); minimapNotebook = (Gtk.Notebook)builder.GetObject("minimapNotebook"); contextNotebook = (Gtk.Notebook)builder.GetObject("contextNotebook"); worldSpinButton = (Gtk.SpinButton)builder.GetObject("worldSpinButton"); viewObjectsCheckButton = (Gtk.CheckButton)builder.GetObject("viewObjectsCheckButton"); viewWarpsCheckButton = (Gtk.CheckButton)builder.GetObject("viewWarpsCheckButton"); darkenDungeonRoomsCheckbox = (Gtk.CheckButton)builder.GetObject("darkenDungeonRoomsCheckbox"); dungeonSpinButton = (Gtk.SpinButton)builder.GetObject("dungeonSpinButton"); floorSpinButton = (Gtk.SpinButton)builder.GetObject("floorSpinButton"); roomVreHolder = (Gtk.Box)builder.GetObject("roomVreHolder"); chestAddHolder = (Gtk.Box)builder.GetObject("chestAddHolder"); chestEditorBox = (Gtk.Box)builder.GetObject("chestEditorBox"); chestVreHolder = (Gtk.Box)builder.GetObject("chestVreHolder"); treasureVreHolder = (Gtk.Box)builder.GetObject("treasureVreHolder"); nonExistentTreasureHolder = (Gtk.Box)builder.GetObject("nonExistentTreasureHolder"); overallEditingContainer = (Gtk.Box)builder.GetObject("overallEditingContainer"); treasureDataFrame = (Gtk.Widget)builder.GetObject("treasureDataFrame"); treasureDataLabel = (Gtk.Label)builder.GetObject("treasureDataLabel"); editTilesetButton = new Gtk.Button("Edit"); editTilesetButton.Clicked += OnTilesetEditorButtonClicked; roomSpinButton = new SpinButtonHexadecimal(); roomSpinButton.Digits = 3; objectgroupeditor1 = new ObjectGroupEditor(); tilesetViewer1 = new TilesetViewer(); roomeditor1 = new RoomEditor(); worldMinimap = new HighlightingMinimap(); dungeonMinimap = new Minimap(); warpEditor = new WarpEditor(this); statusbar1 = new PriorityStatusbar(); seasonComboBox = new ComboBoxFromConstants(showHelp: false); seasonComboBox.SpinButton.Adjustment.Upper = 3; ((Gtk.Box)builder.GetObject("roomSpinButtonHolder")).Add(roomSpinButton); ((Gtk.Box)builder.GetObject("objectGroupEditorHolder")).Add(objectgroupeditor1); ((Gtk.Box)builder.GetObject("tilesetViewerHolder")).Add(tilesetViewer1); ((Gtk.Box)builder.GetObject("roomEditorHolder")).Add(roomeditor1); ((Gtk.Box)builder.GetObject("worldMinimapHolder")).Add(worldMinimap); ((Gtk.Box)builder.GetObject("dungeonMinimapHolder")).Add(dungeonMinimap); ((Gtk.Box)builder.GetObject("warpEditorHolder")).Add(warpEditor); ((Gtk.Box)builder.GetObject("statusbarHolder")).Add(statusbar1); ((Gtk.Box)builder.GetObject("seasonComboBoxHolder")).Add(seasonComboBox); mainWindow.Title = "LynnaLab " + Helper.ReadResourceFile("LynnaLab.version.txt"); roomeditor1.Scale = 2; roomeditor1.TilesetViewer = tilesetViewer1; roomeditor1.ObjectGroupEditor = objectgroupeditor1; roomeditor1.WarpEditor = warpEditor; eventGroup.Lock(); // Event handlers from widgets roomSpinButton.ValueChanged += eventGroup.Add(OnRoomSpinButtonValueChanged); worldSpinButton.ValueChanged += eventGroup.Add(OnWorldSpinButtonValueChanged); dungeonSpinButton.ValueChanged += eventGroup.Add(OnDungeonSpinButtonValueChanged); floorSpinButton.ValueChanged += eventGroup.Add(OnFloorSpinButtonValueChanged); seasonComboBox.Changed += eventGroup.Add(OnSeasonComboBoxChanged); minimapNotebook.SwitchPage += new SwitchPageHandler(eventGroup.Add <SwitchPageArgs>(OnMinimapNotebookSwitchPage)); contextNotebook.SwitchPage += new SwitchPageHandler(eventGroup.Add <SwitchPageArgs>(OnContextNotebookSwitchPage)); roomeditor1.RoomChangedEvent += eventGroup.Add <RoomChangedEventArgs>((sender, args) => { eventGroup.Lock(); OnRoomChanged(); // Only update minimap if the room editor did a "follow warp". Otherwise, we'll decide // whether to update the minimap from whatever code changed the room. if (args.fromFollowWarp) { UpdateMinimapFromRoom(args.fromFollowWarp); } eventGroup.Unlock(); }); dungeonMinimap.AddTileSelectedHandler(eventGroup.Add <int>(delegate(object sender, int index) { OnMinimapTileSelected(sender, dungeonMinimap.SelectedIndex); })); worldMinimap.AddTileSelectedHandler(eventGroup.Add <int>(delegate(object sender, int index) { OnMinimapTileSelected(sender, worldMinimap.SelectedIndex); })); tilesetViewer1.HoverChangedEvent += eventGroup.Add <int>((sender, tile) => { if (tilesetViewer1.HoveringIndex != -1) { statusbar1.Set((uint)StatusbarMessage.TileHovering, "Hovering Tile: 0x" + tilesetViewer1.HoveringIndex.ToString("X2")); } else { statusbar1.RemoveAll((uint)StatusbarMessage.TileHovering); } }); tilesetViewer1.AddTileSelectedHandler(eventGroup.Add <int>(delegate(object sender, int index) { statusbar1.RemoveAll((uint)StatusbarMessage.TileHovering); statusbar1.Set((uint)StatusbarMessage.TileSelected, "Selected Tile: 0x" + index.ToString("X2")); })); roomeditor1.HoverChangedEvent += eventGroup.Add <int>((sender, tile) => { if (roomeditor1.HoveringIndex != -1) { statusbar1.Set((uint)StatusbarMessage.TileHovering, string.Format( "Hovering Pos: {0},{1} (${1:X}{0:X})", roomeditor1.HoveringX, roomeditor1.HoveringY)); } else { statusbar1.RemoveAll((uint)StatusbarMessage.TileHovering); } }); roomeditor1.WarpDestEditModeChangedEvent += eventGroup.Add <bool>((sender, activated) => { if (activated) { statusbar1.Set((uint)StatusbarMessage.WarpDestEditMode, "Entered warp destination editing mode. To exit this mode, right-click on the warp destination and select \"Done\"."); } else { statusbar1.RemoveAll((uint)StatusbarMessage.WarpDestEditMode); } }); statusbar1.Set((uint)StatusbarMessage.TileSelected, "Selected Tile: 0x00"); OnDarkenDungeonRoomsCheckboxToggled(null, null); // Event handlers from underlying data chestEventWrapper.Bind <ValueModifiedEventArgs>("ModifiedEvent", (sender, args) => UpdateChestData()); chestEventWrapper.Bind <EventArgs>("DeletedEvent", (sender, args) => UpdateChestData()); // Load "plugins" pluginCore = new PluginCore(this); LoadPlugins(); mainWindow.ShowAll(); eventGroup.UnlockAndClear(); overallEditingContainer.Sensitive = false; if (directory != "") { OpenProject(directory); } }