/// <summary> /// This method creates the gui commands in order to delete the matching menu object. /// </summary> /// <param name = "menuStyle"></param> public void deleteMenuEntryObject(MgFormBase form, MenuStyle menuStyle) { if (this is MenuEntryMenu) { //MenuReference menuItemReference = getInstantiatedMenuItem(form, menuStyle); for (int i = 0; i < ((MenuEntryMenu)this).subMenus.Count; i++) { MenuEntry subMenuEntry = (((MenuEntryMenu)this).subMenus[i]); subMenuEntry.deleteMenuEntryObject(form, menuStyle); } //if (menuItemReference != null && ((form.ShouldShowPullDownMenu && menuStyle == MenuStyle.MENU_STYLE_PULLDOWN) || // (menuStyle == MenuStyle.MENU_STYLE_CONTEXT))) //{ // cmdQueue.add(CommandType.DELETE_MENU, menuItemReference, this, true); // cmdQueue.execute(); //} } deleteMenuEntryObjectItem(form, menuStyle); // deleteMenuEntryObjectItems(parentMenuObject, MenuStyle.MENU_STYLE_CONTEXT); if (menuStyle == MenuStyle.MENU_STYLE_PULLDOWN && form.ShouldCreateToolbar) { deleteMenuEntryTool(form, true, false); } }
public MenuStyle(MenuStyle style) : base(style) { ImageStyle = style.ImageStyle != null ? new PressableImageStyle(style.ImageStyle) : null; LabelStyle = style.LabelStyle != null ? new LabelStyle(style.LabelStyle) : null; ShortcutStyle = style.ShortcutStyle != null ? new LabelStyle(style.ShortcutStyle) : null; SeparatorStyle = style.SeparatorStyle != null ? new SeparatorStyle(style.SeparatorStyle) : null; }
public void ApplyMenuStyle(MenuStyle style) { ApplyWidgetStyle(style); MenuItemStyle = style.MenuItemStyle; SeparatorStyle = style.SeparatorStyle; }
static void Main(string[] args) { string userName = "******"; string password = "******"; string siteUrl = "https://tenant.sharepoint.com/sites/yoursite"; HeaderLayout layout = HeaderLayout.Standard; HeaderBackground background = HeaderBackground.Darker; MenuStyle menuStyle = MenuStyle.Cascading; try { ChangeTheLookOptionsHelper.ChangeHeaderLayout(siteUrl, layout, userName, password); Console.WriteLine($"Header Layout changed to {layout.ToString()} for {siteUrl}."); ChangeTheLookOptionsHelper.ChangeHeaderBackground(siteUrl, background, userName, password); Console.WriteLine($"Header Background changed to {background.ToString()} for {siteUrl}."); ChangeTheLookOptionsHelper.ChangeMenuStyle(siteUrl, menuStyle, userName, password); Console.WriteLine($"Menu Style changed to {menuStyle.ToString()} for {siteUrl}."); } catch (Exception ex) { Console.WriteLine("There was an error " + ex.Message); } Console.WriteLine("Press any key to exit."); Console.ReadLine(); }
/// <summary> /// returns a menu from a ctl /// </summary> /// <param name="contextID">active/target context</param> /// <param name="ctlIdx"></param> /// <param name="menuIndex"></param> /// <param name="menuStyle"></param> /// <param name="form"></param> /// <param name="createIfNotExist">This decides if menu is to be created or not.</param> /// <returns></returns> internal static MgMenu GetMenu(Int64 contextID, int ctlIdx, int menuIndex, MenuStyle menuStyle, MgFormBase form, bool createIfNotExist) { TaskBase mainProg = Events.GetMainProgram(contextID, ctlIdx); return(MenuManager.getMenu(mainProg, menuIndex, menuStyle, form, createIfNotExist)); }
// Token: 0x060002D0 RID: 720 RVA: 0x00019AA8 File Offset: 0x00017CA8 internal override void SetStyle(MenuStyle menuStyle) { base.SetStyle(menuStyle); foreach (MenuItem menuItem in this.MenuItems) { menuItem.SetStyle(menuStyle); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Returns HashCode</returns> public override int GetHashCode() { return(String.Format("{0}|{1}|{2}|", Layout.GetHashCode(), MenuStyle.GetHashCode(), BackgroundEmphasis.GetHashCode() ).GetHashCode()); }
public void ForeColor_DefaultValue() { // Arrange var menuStyle = new MenuStyle(); // Act, Assert menuStyle.ForeColor.ShouldBe(Color.Empty); }
public void ApplyMenuStyle(MenuStyle style) { ApplyWidgetStyle(style); MenuStyle = style; InternalChild.SelectionHoverBackground = style.SelectionHoverBackground; InternalChild.SelectionBackground = style.SelectionBackground; }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Returns HashCode</returns> public override int GetHashCode() { return(String.Format("{0}|{1}|{2}|{3}|{4}|", Layout.GetHashCode(), MenuStyle.GetHashCode(), BackgroundEmphasis.GetHashCode(), ShowSiteTitle.GetHashCode(), ShowSiteNavigation.GetHashCode() ).GetHashCode()); }
internal static void ChangeMenuStyle(string siteUrl, MenuStyle menuStyle, string userName, string password) { bool megaMenuEnabled = menuStyle == MenuStyle.Megamenu ? true : false; using (var client = new SPHttpClient(new Uri(siteUrl), userName, password)) { var itemPayload = new { __metadata = new { type = "SP.Web" }, MegaMenuEnabled = megaMenuEnabled }; var endpointUrl = string.Format("{0}/_api/web", siteUrl); var data = client.ExecuteJson(endpointUrl, HttpMethod.Post, itemPayload); } }
public void ForeColor_SetAndGetValue() { // Arrange var menuStyle = new MenuStyle(); // Act menuStyle.ForeColor = Color.Green; // Assert menuStyle.ForeColor.ShouldBe(Color.Green); }
/// <summary> /// This method creates the gui commands in order to delete the matching menu object. /// </summary> /// <param name = "menuStyle"></param> public void deleteMenuEntryObjectItem(MgFormBase form, MenuStyle menuStyle) { //we call this method for menuEntry and MenuStyle(context\pulldown) //when create toolbar without pulldown the Reference is null MenuReference menuReference = getInstantiatedMenu(form, menuStyle); if (menuReference != null) { Commands.addAsync(CommandType.DELETE_MENU_ITEM, menuReference, menuStyle, this); } }
public void ApplyMenuStyle(MenuStyle style) { var clone = new MenuStyle(style); ApplyWidgetStyle(clone); MenuStyle = clone; InternalChild.SelectionHoverBackground = style.SelectionHoverBackground; InternalChild.SelectionBackground = style.SelectionBackground; }
/// <summary> This method removes an instantiated menu from the list</summary> /// <param name="form">the form for which the menus is instantiated</param> /// <param name="menuStyle">the menu style (pulldown, context)</param> /// <returns> menu reference object</returns> internal void removeInstantiatedMenu(GuiMgForm form, MenuStyle menuStyle) { if (menuStyle == MenuStyle.MENU_STYLE_PULLDOWN) { instantiatedPullDown.Remove(form); } else { instantiatedContext.Remove(form); } }
public CheckBox(Vector2 position, bool current, MenuStyle style, DrawOrder layer = DrawOrder.AUDIO_SLIDER) { _box = new Spritesheet(ResourceManager.GetTexture("checkbox", true), 11, 11); _pos = position; _turnedOn = current; _layer = layer; _style = style; }
private void SetupStyle() { if (MenuStyle != ContextMenuStyle.None) { this.CssClass = "ctxMenu" + " ctxMenu-" + MenuStyle.ToString(); //Load stylesheets into the head block CssManager.AddResource(Page, typeof(ContextMenu), "NCI.Web.UI.WebControls.Menus.Resources.ContextMenu.CTXMenuBase.css"); CssManager.AddResource(Page, typeof(ContextMenu), string.Format("NCI.Web.UI.WebControls.Menus.Resources.ContextMenu.{0}.css", MenuStyle.ToString())); } }
private void SetupStyle() { if (MenuStyle != MenuStyles.None) { if (Page.Header == null) { throw new NullReferenceException("The head html element for the page requires the runat=server property."); } this.CssClass = "MBMenu" + " MBMenu-" + MenuStyle.ToString(); if (!HttpContext.Current.Items.Contains("MBMenuBase")) { HtmlLink link = new HtmlLink(); Page.Header.Controls.Add(link); link.Href = Page.ClientScript.GetWebResourceUrl( typeof(MenuBar), "NCI.Web.UI.WebControls.Menus.Resources.MenuBar.MBMenuBase.css"); link.Attributes.Add("rel", "stylesheet"); //Mark that the stylesheet has been added so no other //context menus will add this... HttpContext.Current.Items.Add("MBMenuBase", true); } //If we have not added the stylesheet for this style to the //Head block for this request then add it if (!HttpContext.Current.Items.Contains(MenuStyle)) { HtmlLink link = new HtmlLink(); Page.Header.Controls.Add(link); link.Href = Page.ClientScript.GetWebResourceUrl( typeof(MenuBar), string.Format("NCI.Web.UI.WebControls.Menus.Resources.MenuBar.{0}.css", MenuStyle.ToString())); link.Attributes.Add("rel", "stylesheet"); //Mark that the stylesheet has been added so no other //context menus will add this... HttpContext.Current.Items.Add(MenuStyle, true); } } }
protected Menu(MenuStyle style) { OpenMenuItem = null; HorizontalAlignment = HorizontalAlignment.Stretch; VerticalAlignment = VerticalAlignment.Stretch; if (style != null) { ApplyMenuStyle(style); } Items = new ObservableCollection <IMenuItem>(); }
/// <summary> This method updates a menu as instantiated for a specific form and style. It returns a reference to a /// menu object - to be used in order to retrieve this menu object, if it is needed. The returned object /// should be placed in the controlsMap, with the created menu for future use /// /// </summary> /// <param name="form">the form for which the menus is instantiated</param> /// <param name="menuStyle">the menu style (pulldown, context)</param> /// <returns> menu reference object</returns> protected MenuReference setMenuIsInstantiated(GuiMgForm form, MenuStyle menuStyle) { var menuReference = new MenuReference(form); if (menuStyle == MenuStyle.MENU_STYLE_PULLDOWN) { instantiatedPullDown[form] = menuReference; } else { instantiatedContext[form] = menuReference; } return(menuReference); }
/// <summary> This method returns a menu object reference for a specific form and menu style (pulldown, context). The /// returned reference should be used in order to retrieve the specific instantiated menu object from the /// controls map.</summary> /// <param name="form">the form for which the menus is instatiated</param> /// <param name="menuStyle">the menu style (pulldown, context)</param> /// <returns> a menu object reference. In case the menu was not yet instantiated for the specfic form and /// style, null is returned. /// </returns> public MenuReference getInstantiatedMenu(GuiMgForm form, MenuStyle menuStyle) { MenuReference menuReference = null; if (menuStyle == MenuStyle.MENU_STYLE_PULLDOWN) { menuReference = (MenuReference)instantiatedPullDown[form]; } else { menuReference = (MenuReference)instantiatedContext[form]; } return(menuReference); }
public void SetMenuStyle() { if (string.IsNullOrEmpty(MenuStyle)) { MenuStyle = "Dark"; } menuStyleCboBox.Text = MenuStyle; if (MenuStyle.Equals("Dark")) { menuPanel.BackColor = Color.FromArgb(64, 64, 64); languageButton.BackColor = Color.DimGray; languageButton.ForeColor = Color.DarkGray; englishButton.ForeColor = Color.DarkGray; portugueseButton.ForeColor = Color.DarkGray; sizeButton.BackColor = Color.DimGray; sizeButton.ForeColor = Color.DarkGray; defaultSizeButton.ForeColor = Color.DarkGray; middleSizeButton.ForeColor = Color.DarkGray; maximizedSizeButton.ForeColor = Color.DarkGray; helpButton.BackColor = Color.DimGray; helpButton.ForeColor = Color.DarkGray; helpButton2.ForeColor = Color.DarkGray; aboutButton.ForeColor = Color.DarkGray; } else if (MenuStyle.Equals("Light")) { menuPanel.BackColor = Color.Transparent; languageButton.BackColor = Color.FromArgb(224, 224, 224); languageButton.ForeColor = Color.DimGray; englishButton.ForeColor = Color.DimGray; portugueseButton.ForeColor = Color.DimGray; sizeButton.BackColor = Color.FromArgb(224, 224, 224); sizeButton.ForeColor = Color.DimGray; defaultSizeButton.ForeColor = Color.DimGray; middleSizeButton.ForeColor = Color.DimGray; maximizedSizeButton.ForeColor = Color.DimGray; helpButton.BackColor = Color.FromArgb(224, 224, 224); helpButton.ForeColor = Color.DimGray; helpButton2.ForeColor = Color.DimGray; aboutButton.ForeColor = Color.DimGray; } }
public MenuLayout(float fs, GUIStyle glay, Color cf, Color cb, MenuStyle type) { fontSize = fs; guistyle = glay; colorBackground = cb; colorForeground = cf; if (type == MenuStyle.SolidColor) { background = Util.createSolidTexture(cb); } if (type == MenuStyle.SolidFrame) { background = Util.createFrameTexture(cf, cb, 128, 4); } }
/// <summary> Remove the menu reference for the menu entry</summary> /// <param name="menuReference"></param> /// <param name="style"></param> internal void removeMenuIsInstantiated(GuiMgForm guiMgForm, MenuStyle style) { if (style == MenuStyle.MENU_STYLE_PULLDOWN) { _instantiatedPullDown.Remove(guiMgForm); } else if (style == MenuStyle.MENU_STYLE_CONTEXT) { _instantiatedContext.Remove(guiMgForm); } else if (style == MenuStyle.MENU_STYLE_TOOLBAR) { _instantiatedToolItem.Remove(guiMgForm); } }
public AudioSlider(Vector2 pos, float current, float min, float max, float stepSize, MenuStyle style, DrawOrder drawOrder = DrawOrder.AUDIO_SLIDER) : base(pos, 68) { this.min = min; this.max = max; this.stepSize = stepSize; this.current = current; layer = drawOrder; start = current; _slider = new Spritesheet(ResourceManager.GetTexture("volume_bar", true), 60, 12); _sliderInside = ResourceManager.GetTexture("volume_bar_inside", true); _sliderBg = ResourceManager.GetTexture("volume_bar_bg", true); _style = style; }
/// <summary> /// creates enable command for a specific action on the menu /// </summary> /// <param name = "actionMenu">action menu to be enabled\ disabled</param> /// <param name = "form">on which form</param> /// <param name = "menuStyle">which style</param> /// <param name = "enable">enable\ disable</param> public void EnableMenuEntry(MenuEntry actionMenu, MgFormBase form, MenuStyle menuStyle, bool enable) { MenuReference menuReference = actionMenu.getInstantiatedMenu(form, menuStyle); if (menuReference != null) { // When we are in GuiThread, we should enable menuentry synchronously. if (Misc.IsGuiThread()) { Commands.EnableMenuEntry(menuReference, enable); } else { Commands.addAsync(CommandType.PROP_SET_ENABLE, menuReference, null, enable); } } }
internal ICollection getInstantiatedMenus(MenuStyle menuStyle) { ICollection list = null; if (menuStyle == MenuStyle.MENU_STYLE_PULLDOWN) { list = _instantiatedPullDown.Values; } else if (menuStyle == MenuStyle.MENU_STYLE_CONTEXT) { list = _instantiatedContext.Values; } else if (menuStyle == MenuStyle.MENU_STYLE_TOOLBAR) { list = _instantiatedToolItem.Values; } return(list); }
/// <summary> /// createMenu This method creates the gui commands in order to create the matching menu object. First we /// create a GUI command which verifies the object will have a menu definition (either he already has one or /// we will create it). Then it calls the CreateSubMenuObject in order to create the actual menu. /// </summary> /// <param name = "form"></param> /// <param name = "menuStyle"></param> public void createMenu(MgFormBase form, MenuStyle menuStyle) { int i; MgFormBase actualForm = form; if (form.isSubForm()) { MgControlBase subformCtrl = form.getSubFormCtrl(); actualForm = subformCtrl.getForm().getTopMostForm(); } // #991912. We will create menus anyway even though showMenu on the foem is false. so that when they are // later accessed with Access key, we can find the menus. The actual SWT menus will be created only // if Showmenu (MGFrom.shouldShowPullDownMenu()) is TRUE. setMenuIsInstantiated(actualForm, menuStyle); Commands.addAsync(CommandType.CREATE_MENU, null, actualForm, menuStyle, this, true, actualForm.ShouldShowPullDownMenu); actualForm.addMgMenuToList(this, menuStyle); //We are initializing window list menu items for context menu if (menuStyle == MenuStyle.MENU_STYLE_CONTEXT) { for (i = 0; i < _menuEntries.Count; i++) { if (((GuiMenuEntry)_menuEntries[i]).menuType() == GuiMenuEntry.MenuType.WINDOW_MENU_ENTRY) { Events.InitWindowListMenuItems(actualForm, _menuEntries[i], menuStyle); break;//We should initialize the Window List only once } } } for (i = 0; i < _menuEntries.Count; i++) { _menuEntries[i].createMenuEntryObject(this, menuStyle, actualForm, false); } refreshMenuAction(form, menuStyle); if (menuStyle == MenuStyle.MENU_STYLE_CONTEXT) { Commands.invoke(); } }
/// <summary> This method updates a menu as instantiated for a specific form and style. It returns a reference to a /// menu object - to be used in order to retrieve this menu object, if it is needed. The returned object /// should be placed in the controlsMap, with the created menu for future use /// </summary> /// <param name="form">the form for which the menus is instatiated</param> /// <param name="menuStyle">the menu style (pulldown, context)</param> /// <returns> menu reference object</returns> protected MenuReference setMenuIsInstantiated(GuiMgForm form, MenuStyle menuStyle) { MenuReference menuReference = new MenuReference(form); if (menuStyle == MenuStyle.MENU_STYLE_PULLDOWN) { _instantiatedPullDown[form] = menuReference; } else if (menuStyle == MenuStyle.MENU_STYLE_CONTEXT) { _instantiatedContext[form] = menuReference; } else if (menuStyle == MenuStyle.MENU_STYLE_TOOLBAR) { _instantiatedToolItem[form] = menuReference; } else { Debug.Assert(false); } return(menuReference); }
/// <summary> This method returns a menu object reference for a specific form and menu style (pulldown, context). The /// returned reference should be used in order to retrieve the specific instantiated menu object from the /// controls map. /// </summary> /// <param name="form">the form for which the menus is instatiated</param> /// <param name="menuStyle">the menu style (pulldown, context)</param> /// <returns> a menu object reference. In case the menu was not yet instantiated for the specfic form and /// style, null is returned.</returns> public MenuReference getInstantiatedMenu(GuiMgForm form, MenuStyle menuStyle) { MenuReference menuReference = null; if (menuStyle == MenuStyle.MENU_STYLE_PULLDOWN) { menuReference = (MenuReference)_instantiatedPullDown[form]; } else if (menuStyle == MenuStyle.MENU_STYLE_CONTEXT) { menuReference = (MenuReference)_instantiatedContext[form]; } else if (menuStyle == MenuStyle.MENU_STYLE_TOOLBAR) { menuReference = (MenuReference)_instantiatedToolItem[form]; } else { Debug.Assert(false); } return(menuReference); }