/// <summary> /// Populates the specified shell with sub-menus. /// </summary> /// <param name="manager"></param> /// <param name="shell">The shell.</param> public void Populate( ActionManager manager, MenuShell shell) { // Get the action associated with this. Action action = manager.GetAction(ActionName); MenuItem menuItem; if (action == null) { // Create a placeholder menu item. menuItem = new MenuItem("<Unknown Action: " + ActionName + ">"); menuItem.Sensitive = false; // Add it to the errors. manager.Messages.Add( new SeverityMessage( Severity.Error, "Could not find action " + ActionName + " to add to menu.")); } else { // Create a menu item from this action. menuItem = new ActionMenuItem(manager, action); } // Add the resulting menu item to the list. shell.Add(menuItem); }
/// <summary> /// Populates the specified shell with sub-menus. /// </summary> /// <param name="manager">The manager.</param> /// <param name="shell">The shell.</param> public void Populate( ActionManager manager, MenuShell shell) { var separator = new MenuItem(); shell.Add(separator); }
public static void BuildMenu(MenuShell menu, ActionModelNode node) { if (node.PathSegment != null) { MenuItem menuItem; if (node.Action != null) { // this is a leaf node (terminal menu item) menuItem = new ActiveMenuItem((IClickAction)node.Action); } else { // this menu item has a sub menu string menuText = node.PathSegment.LocalizedText.Replace('&', '_'); menuItem = new MenuItem(menuText); menuItem.Submenu = new Menu(); } menu.Append(menuItem); menu = (MenuShell)menuItem.Submenu; } foreach (ActionModelNode child in node.ChildNodes) { BuildMenu(menu, child); } }
static void Inserted_cb(IntPtr inst, IntPtr child, int position) { try { MenuShell __obj = GLib.Object.GetObject(inst, false) as MenuShell; __obj.OnInserted(GLib.Object.GetObject(child) as Gtk.Widget, position); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, false); } }
static void SelectItem_cb(IntPtr inst, IntPtr menu_item) { try { MenuShell __obj = GLib.Object.GetObject(inst, false) as MenuShell; __obj.OnSelectItem(GLib.Object.GetObject(menu_item) as Gtk.Widget); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, false); } }
static void Canceled_cb(IntPtr inst) { try { MenuShell __obj = GLib.Object.GetObject(inst, false) as MenuShell; __obj.OnCanceled(); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, false); } }
static void ActivateCurrent_cb(IntPtr inst, bool force_hide) { try { MenuShell __obj = GLib.Object.GetObject(inst, false) as MenuShell; __obj.OnActivateCurrent(force_hide); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, false); } }
static void MoveCurrent_cb(IntPtr inst, int direction) { try { MenuShell __obj = GLib.Object.GetObject(inst, false) as MenuShell; __obj.OnMoveCurrent((Gtk.MenuDirectionType)direction); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, false); } }
static void CycleFocus_cb(IntPtr inst, int p0) { try { MenuShell __obj = GLib.Object.GetObject(inst, false) as MenuShell; __obj.OnCycleFocus((Gtk.DirectionType)p0); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, false); } }
public virtual void StartMainLoop() { Gtk.UIManager uiManager = Tomboy.ActionManager.UI; ActionGroup mainMenuActionGroup = new ActionGroup("Mac"); mainMenuActionGroup.Add(new ActionEntry [] { new ActionEntry("WindowMenuAction", null, // Translators: This is the name of "Window" menu in the Mac menubar Catalog.GetString("_Window"), null, null, null) }); uiManager.AddUiFromString(osxMenuXml); uiManager.InsertActionGroup(mainMenuActionGroup, 1); Gtk.MenuShell mainMenu = uiManager.GetWidget("/MainWindowMenubar") as Gtk.MenuShell; mainMenu.Show(); IgeMacMenu.MenuBar = mainMenu; WindowMenuManager.UpdateWindowMenu(); Gtk.MenuItem about_item = uiManager.GetWidget("/MainWindowMenubar/HelpMenu/ShowAbout") as Gtk.MenuItem; Gtk.MenuItem prefs_item = uiManager.GetWidget("/MainWindowMenubar/EditMenu/ShowPreferences") as Gtk.MenuItem; Gtk.MenuItem quit_item = uiManager.GetWidget("/MainWindowMenubar/FileMenu/QuitTomboy") as Gtk.MenuItem; (about_item.Child as Gtk.Label).Text = Catalog.GetString("About Tomboy"); (prefs_item.Child as Gtk.Label).Text = Catalog.GetString("Preferences..."); IgeMacMenuGroup about_group = IgeMacMenu.AddAppMenuGroup(); IgeMacMenuGroup prefs_group = IgeMacMenu.AddAppMenuGroup(); about_group.AddMenuItem(about_item, null); prefs_group.AddMenuItem(prefs_item, null); IgeMacMenu.QuitMenuItem = quit_item; IgeMacDock dock = new IgeMacDock(); dock.Clicked += delegate(object sender, EventArgs args) { if (Tomboy.Tray.TomboyTrayMenu.Visible) { Tomboy.Tray.TomboyTrayMenu.Hide(); } else { Tomboy.Tray.Tray.ShowMenu(false); } }; dock.QuitActivate += delegate(object sender, EventArgs args) { Exit(0); }; Tomboy.ActionManager ["CloseWindowAction"].Visible = false; Gtk.Application.Run(); }
static bool MoveSelected_cb(IntPtr inst, int distance) { try { MenuShell __obj = GLib.Object.GetObject(inst, false) as MenuShell; bool __result; __result = __obj.OnMoveSelected(distance); return(__result); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, true); // NOTREACHED: above call does not return. throw e; } }
static int GetPopupDelay_cb(IntPtr inst) { try { MenuShell __obj = GLib.Object.GetObject(inst, false) as MenuShell; int __result; __result = __obj.OnGetPopupDelay(); return(__result); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException(e, true); // NOTREACHED: above call does not return. throw e; } }
protected void AppendItems(MenuShell shell, WindowContext context) { if(this.MenuItems != null) foreach(MenuExpression expr in this.MenuItems) shell.Append(expr.Build(context)); }
public virtual void SetMenuStyle(Gtk.MenuShell menu) { }
// Takes the Gtk.MenuShell and sets it as OS X application menu public void SetMenu (MenuShell shell) { gtk_osxapplication_set_menu_bar (theApp, shell.Handle); }
/* Creates the popup menu.*/ private void CreatePopupMenu() { /* * Shapes submenu. */ Menu shapes_menu = new Menu (); MenuShell shell = new MenuShell (shapes_menu.Raw); for (int i = 0; i < shapeArray.Length; i++) { MenuItem menu_item = new MenuItem (shapeArray[i].name); shell.Append (menu_item); menu_item.Activated += new EventHandler (OnChangeShape); shapeArray[i].menu_item = menu_item; menu_item.Show (); } /* * Materials submenu. */ Menu materials_menu = new Menu (); shell = new MenuShell (materials_menu.Raw); for (int i = 0; i < materialList.Count; i++) { MenuItem menu_item = new MenuItem (((MaterialProp)materialList[i]).name); shell.Append (menu_item); menu_item.Activated += new EventHandler (OnChangeMaterial); ((MaterialProp)materialList[i]).menu_item = menu_item; menu_item.Show (); } /* * Root popup menu. */ menu = new Menu (); shell = new MenuShell (menu.Raw); /* Shapes */ MenuItem item = new MenuItem ("Shapes"); item.Submenu = shapes_menu; shell.Append (item); item.Show (); /* Materials */ item = new MenuItem ("Materials"); item.Submenu = materials_menu; shell.Append (item); item.Show (); /* Quit */ item = new MenuItem ("Quit"); shell.Append (item); item.Activated += new EventHandler (MainApp.OnQuit); item.Show (); }