private DropDownMenu GetSliceOptionsMenuDropList() { DropDownMenu sliceOptionsMenuDropList; sliceOptionsMenuDropList = new DropDownMenu("Profile".Localize() + "... ") { HoverColor = new RGBA_Bytes(0, 0, 0, 50), NormalColor = new RGBA_Bytes(0, 0, 0, 0), BorderColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100), BackgroundColor = new RGBA_Bytes(0, 0, 0, 0), BorderWidth = 1, MenuAsWideAsItems = false, AlignToRightEdge = true, }; sliceOptionsMenuDropList.Name = "Slice Settings Options Menu"; sliceOptionsMenuDropList.VAnchor |= VAnchor.ParentCenter; sliceOptionsMenuDropList.AddItem("Import".Localize()).Selected += (s, e) => { ImportSettingsMenu_Click(); }; sliceOptionsMenuDropList.AddItem("Export".Localize()).Selected += (s, e) => { WizardWindow.Show <ExportSettingsPage>("ExportSettingsPage", "Export Settings"); }; MenuItem settingsHistory = sliceOptionsMenuDropList.AddItem("Settings History".Localize()); settingsHistory.Selected += (s, e) => { WizardWindow.Show <PrinterProfileHistoryPage>("PrinterProfileHistory", "Settings History"); }; settingsHistory.Enabled = !string.IsNullOrEmpty(AuthenticationData.Instance.ActiveSessionUsername); sliceOptionsMenuDropList.AddItem("Reset to defaults".Localize()).Selected += (s, e) => { UiThread.RunOnIdle(ResetToDefaults); }; return(sliceOptionsMenuDropList); }
public MenuBase(string menuName) { MenuDropList = new DropDownMenu(menuName.ToUpper(), Direction.Down, pointSize: 10); MenuDropList.MenuItemsPadding = new BorderDouble(0); MenuDropList.Margin = new BorderDouble(0); MenuDropList.Padding = new BorderDouble(0); MenuDropList.DrawDirectionalArrow = false; MenuDropList.MenuAsWideAsItems = false; menuItems = GetMenuItems(); BorderDouble padding = MenuDropList.MenuItemsPadding; //Add the menu items to the menu itself foreach (Tuple <string, Func <bool> > item in menuItems) { MenuDropList.MenuItemsPadding = new BorderDouble(8, 6, 8, 6) * TextWidget.GlobalPointSizeScaleRatio; MenuDropList.AddItem(item.Item1, pointSize: 11); } MenuDropList.Padding = padding; AddChild(MenuDropList); this.Width = GetChildrenBoundsIncludingMargins().Width; this.Height = 22 * TextWidget.GlobalPointSizeScaleRatio; this.Margin = new BorderDouble(0); this.Padding = new BorderDouble(0); this.VAnchor = Agg.UI.VAnchor.ParentCenter; this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); this.MenuDropList.OpenOffset = new Vector2(0, 0); }
private void SetMenuItems(DropDownMenu dropDownMenu) { menuItems = new TupleList <string, Func <bool> >(); if (ActiveTheme.Instance.IsTouchScreen) { menuItems.Add(new Tuple <string, Func <bool> >("Remove All".Localize(), clearAllMenu_Select)); } menuItems.Add(new Tuple <string, Func <bool> >("Send".Localize(), sendMenu_Selected)); menuItems.Add(new Tuple <string, Func <bool> >("Add To Library".Localize(), addToLibraryMenu_Selected)); BorderDouble padding = dropDownMenu.MenuItemsPadding; //Add the menu items to the menu itself foreach (Tuple <string, Func <bool> > item in menuItems) { if (item.Item2 == null) { dropDownMenu.MenuItemsPadding = new BorderDouble(5, 0, padding.Right, 3); } else { dropDownMenu.MenuItemsPadding = new BorderDouble(10, 5, padding.Right, 5); } dropDownMenu.AddItem(item.Item1); } dropDownMenu.Padding = padding; }
private void PlaylistView_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DropDownMenu.Show(PointToScreen(e.Location)); } }
private DropDownMenu GetSliceOptionsMenuDropList() { if (sliceOptionsMenuDropList == null) { sliceOptionsMenuDropList = new DropDownMenu("Options".Localize() + "... ") { HoverColor = new RGBA_Bytes(0, 0, 0, 50), NormalColor = new RGBA_Bytes(0, 0, 0, 0), BorderColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100), BackgroundColor = new RGBA_Bytes(0, 0, 0, 0), BorderWidth = 1, MenuAsWideAsItems = false, AlignToRightEdge = true, }; sliceOptionsMenuDropList.VAnchor |= VAnchor.ParentCenter; sliceOptionsMenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); //Set the name and callback function of the menu items slicerOptionsMenuItems = new TupleList <string, Func <bool> > { { "Import".Localize(), ImportSettingsMenu_Click }, { "Export".Localize(), () => { WizardWindow.Show <ExportSettingsPage>("ExportSettingsPage", "Export Settings"); return(true); } }, { "Settings History".Localize(), () => { WizardWindow.Show <PrinterProfileHistoryPage>("PrinterProfileHistory", "Profile History"); return(true); } }, { "Reset to defaults".Localize(), () => { UiThread.RunOnIdle(ResetToDefaults); return(true); } }, }; //Add the menu items to the menu itself foreach (Tuple <string, Func <bool> > item in slicerOptionsMenuItems) { sliceOptionsMenuDropList.AddItem(item.Item1); } } return(sliceOptionsMenuDropList); }
private void SetMenuItems(DropDownMenu dropDownMenu) { menuItems = new List <PrintItemAction>(); if (ActiveTheme.Instance.IsTouchScreen) { menuItems.Add(new PrintItemAction() { Title = "Remove All".Localize(), Action = (items, queueDataView) => clearAllButton_Click(null, null) }); } menuItems.Add(new PrintItemAction() { Title = "Send".Localize(), Action = (items, queueDataView) => sendButton_Click(null, null) }); menuItems.Add(new PrintItemAction() { Title = "Add To Library".Localize(), Action = (items, queueDataView) => addToLibraryButton_Click(null, null) }); // Extension point for plugins to hook into selected item actions var pluginFinder = new PluginFinder <PrintItemMenuExtension>(); foreach (var menuExtensionPlugin in pluginFinder.Plugins) { foreach (var menuItem in menuExtensionPlugin.GetMenuItems()) { menuItems.Add(menuItem); } } BorderDouble padding = dropDownMenu.MenuItemsPadding; //Add the menu items to the menu itself foreach (PrintItemAction item in menuItems) { if (item.Action == null) { dropDownMenu.MenuItemsPadding = new BorderDouble(5, 0, padding.Right, 3); } else { if (item.SingleItemOnly) { singleSelectionMenuItems.Add(item.Title); } dropDownMenu.MenuItemsPadding = new BorderDouble(10, 5, padding.Right, 5); } dropDownMenu.AddItem(item.Title); } dropDownMenu.Padding = padding; }
public MainWindow(LuaTable p_Object, bool p_SelfCreated) : base(p_Object, p_SelfCreated) { if (p_SelfCreated) { this.SetPoint(AnchorPoint.Center); this.Width = 250; this.Height = 300; this.Title = "Rotation Engine"; this.DropDownMenuCombatRoutines = this.CreateChildFrame <DropDownMenu>(); this.DropDownMenuCombatRoutines.SetPoint(AnchorPoint.Top, this, AnchorPoint.Top, 0, -30); this.DropDownMenuCombatRoutines.Width = this.Width - 50;; this.DropDownMenuCombatRoutines.OnLoad += DropDownMenuCombatRoutines_OnLoad; this.CheckButtonRotator = this.CreateChildFrame <CheckButton>(); this.CheckButtonRotator.SetPoint(AnchorPoint.TopLeft, this.DropDownMenuCombatRoutines, AnchorPoint.TopLeft, 15, -30); this.CheckButtonRotator.Text = "Enable rotation"; this.CheckButtonRotator.OnClick += (object p_Sender, SimpleButton.OnClickEventArgs p_Event) => { if (Rotator.ActiveRoutine != null) { if (Rotator.Enabled) { Rotator.ActiveRoutine.OnStop(); Rotator.Enabled = false; } else { Rotator.ActiveRoutine.OnStart(); Rotator.Enabled = true; } } }; this.CheckButtonAttackOutOfCombatUnits = this.CreateChildFrame <CheckButton>(); this.CheckButtonAttackOutOfCombatUnits.SetPoint(AnchorPoint.TopLeft, this.CheckButtonRotator, AnchorPoint.TopLeft, 0, -30); this.CheckButtonAttackOutOfCombatUnits.Text = "Attack out of combat units"; this.CheckButtonAttackOutOfCombatUnits.OnClick += (object p_Sender, SimpleButton.OnClickEventArgs p_Event) => { UserSettings.Instance.AttackOutOfCombatUnits = !UserSettings.Instance.AttackOutOfCombatUnits; }; this.CheckButtonBigCooldowns = this.CreateChildFrame <CheckButton>(); this.CheckButtonBigCooldowns.SetPoint(AnchorPoint.TopLeft, this.CheckButtonAttackOutOfCombatUnits, AnchorPoint.TopLeft, 0, -30); this.CheckButtonBigCooldowns.Text = "Use cooldows on boss only"; this.CheckButtonBigCooldowns.OnClick += (object p_Sender, SimpleButton.OnClickEventArgs p_Event) => { UserSettings.Instance.BigCooldownsBossOnly = !UserSettings.Instance.BigCooldownsBossOnly; }; this.OnUpdate += MainWindow_OnUpdate; this.OnHide += MainWindow_OnHide; this.OnShow += MainWindow_OnShow; this.Visible = UserSettings.Instance.MainWindowVisibility; SetCombatRoutine(WoWSharp.Plugins.LoadedRoutines.FirstOrDefault(x => x.Name == UserSettings.Instance.LastCombatRotation)); } }
public MainPage() : base() { Open(SingleWebDriver.Configuration.SiteName); DownloadButton = new Button(By.XPath(downloadButtonSelector), "Download button"); CategoriesMenu = new DropDownMenu(By.XPath(dropDownElementsSelector), By.XPath(dropDownSelector), "Categories menu"); Logger.GetInstance().LogLine($"Created main page."); }
private DropDownMenu GetSliceOptionsMenuDropList() { DropDownMenu sliceOptionsMenuDropList; sliceOptionsMenuDropList = new DropDownMenu("Options".Localize() + "... ") { HoverColor = new RGBA_Bytes(0, 0, 0, 50), NormalColor = new RGBA_Bytes(0, 0, 0, 0), BorderColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100), BackgroundColor = new RGBA_Bytes(0, 0, 0, 0), BorderWidth = 1, MenuAsWideAsItems = false, AlignToRightEdge = true, }; sliceOptionsMenuDropList.Name = "Slice Settings Options Menu"; sliceOptionsMenuDropList.VAnchor |= VAnchor.ParentCenter; showHelpBox = new CheckBox("Show Help".Localize()); if (primarySettingsView) { // only turn on the help if in the main view and it is set to on showHelpBox.Checked = UserSettings.Instance.get(SliceSettingsShowHelpEntry) == "true"; } showHelpBox.CheckedStateChanged += (s, e) => { if (primarySettingsView) { // only save the help settings if in the main view UserSettings.Instance.set(SliceSettingsShowHelpEntry, showHelpBox.Checked.ToString().ToLower()); } ShowHelpChanged?.Invoke(this, null); }; MenuItem showHelp = new MenuItem(showHelpBox, "Show Help Checkbox") { Padding = sliceOptionsMenuDropList.MenuItemsPadding, }; sliceOptionsMenuDropList.MenuItems.Add(showHelp); sliceOptionsMenuDropList.AddHorizontalLine(); sliceOptionsMenuDropList.AddItem("Import".Localize()).Selected += (s, e) => { ImportSettingsMenu_Click(); }; sliceOptionsMenuDropList.AddItem("Export".Localize()).Selected += (s, e) => { WizardWindow.Show <ExportSettingsPage>("ExportSettingsPage", "Export Settings"); }; MenuItem settingsHistory = sliceOptionsMenuDropList.AddItem("Restore Settings".Localize()); settingsHistory.Selected += (s, e) => { WizardWindow.Show <PrinterProfileHistoryPage>("PrinterProfileHistory", "Restore Settings"); }; settingsHistory.Enabled = !string.IsNullOrEmpty(AuthenticationData.Instance.ActiveSessionUsername); sliceOptionsMenuDropList.AddItem("Reset to Defaults".Localize()).Selected += (s, e) => { UiThread.RunOnIdle(ResetToDefaults); }; return(sliceOptionsMenuDropList); }
int zFront = 0; //forward #endregion Fields #region Methods // Use this for initialization void Start() { dropDownMenuObject = GameObject.Find("Panel").GetComponent<DropDownMenu>(); missionReader = GameObject.FindGameObjectWithTag("Grid").GetComponent<MissionReader>(); astarPath = GameObject.FindGameObjectWithTag("Grid").GetComponent<AstarPath>(); xLeft = -27; xRight = 27; zFront = -110; zBack = -140; }
private DropDownMenu CreateScaleDropDownMenu() { DropDownMenu presetScaleMenu = new DropDownMenu("", Direction.Down); presetScaleMenu.NormalArrowColor = ActiveTheme.Instance.PrimaryTextColor; presetScaleMenu.HoverArrowColor = ActiveTheme.Instance.PrimaryTextColor; presetScaleMenu.MenuAsWideAsItems = false; presetScaleMenu.AlignToRightEdge = true; //presetScaleMenu.OpenOffset = new Vector2(-50, 0); presetScaleMenu.HAnchor = HAnchor.AbsolutePosition; presetScaleMenu.VAnchor = VAnchor.AbsolutePosition; presetScaleMenu.Width = 25; presetScaleMenu.Height = scaleRatioControl.Height + 2; presetScaleMenu.AddItem("mm to in (.0393)"); presetScaleMenu.AddItem("in to mm (25.4)"); presetScaleMenu.AddItem("mm to cm (.1)"); presetScaleMenu.AddItem("cm to mm (10)"); string resetLable = "reset".Localize(); string resetLableFull = "{0} (1)".FormatWith(resetLable); presetScaleMenu.AddItem(resetLableFull); presetScaleMenu.SelectionChanged += (sender, e) => { double scale = 1; switch (presetScaleMenu.SelectedIndex) { case 0: scale = 1.0 / 25.4; break; case 1: scale = 25.4; break; case 2: scale = .1; break; case 3: scale = 10; break; case 4: scale = 1; break; } scaleRatioControl.ActuallNumberEdit.Value = scale; ApplyScaleFromEditField(); }; return(presetScaleMenu); }
protected BocReferenceValueBase() { _optionsMenu = new DropDownMenu(this); _command = new SingleControlItemCollection(new BocCommand(), new[] { typeof(BocCommand) }); _command.OwnerControl = this; _commonStyle = new Style(); _labelStyle = new Style(); _webServiceFactory = new WebServiceFactory(new BuildManagerWrapper()); EnableIcon = true; }
private void PlaylistView_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (PlaylistView.SelectedIndices.Count == 0) { return; } var Index = GetFocusedItem(); var track = Tracks[Index]; var Items = new Dictionary <string, ToolStripItem>(); foreach (var item in MenuItems) { DropDownMenu.Items.Remove(item); Items.Add(item.Text, item); } if (track.Status == Track.StatusType.Local) { DropDownMenu.Items.Insert(0, Items[Names.Play]); DropDownMenu.Items.Insert(1, Items[Names.Pause]); DropDownMenu.Items.Insert(2, Items[Names.Stop]); DropDownMenu.Items.Insert(3, Items[Names.Numbers]); if (track.IsM4a) { DropDownMenu.Items.Insert(4, Items[Names.ConvertMP3]); } } else if (track.Status == Track.StatusType.Offline) { DropDownMenu.Items.Insert(0, Items[Names.Play]); DropDownMenu.Items.Insert(1, Items[Names.Title]); DropDownMenu.Items.Insert(2, Items[Names.DAgain]); DropDownMenu.Items.Insert(3, Items[Names.Numbers]); DropDownMenu.Items.Insert(4, Items[Names.Dir]); if (track.IsM4a) { DropDownMenu.Items.Insert(2, Items[Names.ConvertMP3]); } } else if (track.Status == Track.StatusType.Online) { DropDownMenu.Items.Insert(0, Items[Names.DP]); DropDownMenu.Items.Insert(1, Items[Names.Title]); DropDownMenu.Items.Insert(2, Items[Names.JDownload]); DropDownMenu.Items.Insert(3, Items[Names.Numbers]); } var font = DropDownMenu.Items[0].Font; DropDownMenu.Items[0].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold); DropDownMenu.Show(PlaylistView.PointToScreen(e.Location)); } }
private void ActivateDropDownMenu(object sender) { DropDownMenu.Left = this.Left; DropDownMenu.Top = this.Top + 1; DropDownMenu.Layout(); if (AnchorRight) { DropDownMenu.Left = this.Right - DropDownMenu.Width; DropDownMenu.Layout(); } DropDownMenu.Activate((Screen)sender, this); }
private void Awake() { fadePlane = GameObject.FindGameObjectWithTag("FadeScreen").GetComponent <Image>(); scorchMark = GameObject.FindGameObjectWithTag("ScorchMark").GetComponent <SpriteRenderer>(); resultsUI = GameObject.FindGameObjectWithTag("Results").GetComponent <DropDownMenu>(); endOfDayUI = GameObject.FindGameObjectWithTag("EndOfDay").GetComponent <DropDownMenu>(); endOfWeekUI = GameObject.FindGameObjectWithTag("EndOfWeek").GetComponent <DropDownMenu>(); rightButton = GameObject.FindGameObjectWithTag("RightArrow").GetComponent <SlideInUI>(); leftButton = GameObject.FindGameObjectWithTag("LeftArrow").GetComponent <SlideInUI>(); day = GameObject.FindGameObjectWithTag("DayManager").GetComponent <Day>(); BarAnimation[] statBars = FindObjectsOfType <BarAnimation>(); burnTimeBar = statBars[0]; turningPowerBar = statBars[1]; jetPack = FindObjectOfType <JetPack>(); jCamera = FindObjectOfType <JetpackCamera>(); fadePlane.gameObject.SetActive(true); selectedCatagories = new bool[3]; shop = GetComponent <Shop>(); fireButton = GameObject.FindGameObjectWithTag("FireButton").GetComponent <SlideInUI>(); flyHUD = GameObject.FindGameObjectWithTag("FlyHUD").GetComponent <SlideInUI>(); destinationUI = GameObject.FindGameObjectWithTag("DestinationUI").GetComponent <SlideInUI>(); destinationText = GameObject.FindGameObjectWithTag("DestinationUI").GetComponentInChildren <Text>(); destinationUIDown = GameObject.FindGameObjectWithTag("DestinationUI").GetComponent <DropDownMenu>(); Transform ComponentSelection = GameObject.FindGameObjectWithTag("ComponentSelection").transform; currentStats = GameObject.FindGameObjectWithTag("CurrentStats").GetComponent <DropDownMenu>(); componentsSelection = ComponentSelection.GetComponent <DropDownMenu>(); componentButtons = new RectTransform[3]; componentButtons[0] = ComponentSelection.GetChild(0).GetComponent <RectTransform>(); componentButtons[1] = ComponentSelection.GetChild(1).GetComponent <RectTransform>(); componentButtons[2] = ComponentSelection.GetChild(2).GetComponent <RectTransform>(); scorchMarkStartAlpha = scorchMark.color.a; }
public override void Initialize() { mDebugColor = Color.DarkGreen; mOneWay = false; mDropDown = new DropDownMenu(Vector2.Zero, new List <String>() { "Change One Way", "Verlasse: Norden", "Verlasse: Westen", "Verlasse: Süden", "Verlasse: Osten" }, new List <Action>() { ChangeOneWay, LeaveNorth, LeaveWest, LeaveSouth, LeaveEast }); mMovementOnEnter = new Vector2(-1f, 0); }
public QueueOptionsMenu() { MenuDropList = new DropDownMenu("Options ".Localize(), Direction.Up); MenuDropList.VAnchor = VAnchor.ParentBottomTop; MenuDropList.BorderWidth = 1; MenuDropList.MenuAsWideAsItems = false; MenuDropList.BorderColor = ActiveTheme.Instance.SecondaryTextColor; MenuDropList.Margin = new BorderDouble(4, 0, 1, 0); MenuDropList.AlignToRightEdge = true; SetMenuItems(); this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (DropDownMenu != null) { DropDownMenu.GetContextMenu().Show(this, new Point(0, Height)); } else { IsPressed = true; } Invalidate(); }
private void DropDownMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e) { if (PlaylistView.SelectedIndices.Count == 0) { DropDownMenu.Hide(); } else { int Index = PlaylistView.SelectedIndices[0]; ToolStripItem Item = DropDownMenu.Items[4]; Item.Enabled = Tracks[Index].Writeable; } }
public QueueOptionsMenu() { MenuDropList = new DropDownMenu(LocalizedString.Get("Queue Options"), Direction.Up); MenuDropList.HAnchor |= HAnchor.ParentLeft; MenuDropList.VAnchor |= VAnchor.ParentTop; SetMenuItems(); AddChild(MenuDropList); this.Width = MenuDropList.Width; this.Height = MenuDropList.Height; this.Margin = new BorderDouble(4, 0); this.Padding = new BorderDouble(0); this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); }
private GuiWidget CreateActionsMenu() { var actionMenu = new DropDownMenu("Action".Localize() + "... "); actionMenu.NormalColor = new RGBA_Bytes(); actionMenu.BorderWidth = 1; actionMenu.BorderColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100); actionMenu.MenuAsWideAsItems = false; actionMenu.VAnchor = VAnchor.ParentBottomTop; actionMenu.Margin = new BorderDouble(3); actionMenu.Padding = new BorderDouble(10); CreateActionMenuItems(actionMenu); return(actionMenu); }
DropDownMenu GetSliceOptionsMenuDropList() { if (sliceOptionsMenuDropList == null) { sliceOptionsMenuDropList = new DropDownMenu(LocalizedString.Get("Options ")); sliceOptionsMenuDropList.HoverColor = new RGBA_Bytes(0, 0, 0, 50); sliceOptionsMenuDropList.NormalColor = new RGBA_Bytes(0, 0, 0, 0); sliceOptionsMenuDropList.BorderColor = new RGBA_Bytes(0, 0, 0, 0); sliceOptionsMenuDropList.BackgroundColor = new RGBA_Bytes(0, 0, 0, 0); sliceOptionsMenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); SetMenuItems(); } return(sliceOptionsMenuDropList); }
public MainWindow(LuaTable p_Object, bool p_SelfCreated) : base(p_Object, p_SelfCreated) { if (p_SelfCreated) { var l_ActivePlayer = WoW.ObjectManager.ActivePlayer; this.Visible = false; this.SetPoint(AnchorPoint.Center); this.Width = 260; this.Height = 300; this.Title = "Morpher"; DropDownMenuLoadSettings = this.CreateChildFrame <DropDownMenu>(); DropDownMenuLoadSettings.SetPoint(AnchorPoint.Top, this, AnchorPoint.Top, 0, -30); DropDownMenuLoadSettings.Width = this.Width - 50;; DropDownMenuLoadSettings.Text = "Load settings ..."; DropDownMenuLoadSettings.OnLoad += DropDownMenuLoadSettings_OnLoad; LabelDisplayId = this.CreateFontString(); LabelDisplayId.SetPoint(AnchorPoint.TopLeft, 12, -85); LabelDisplayId.Text = "Display id :"; TextBoxDisplayId = this.CreateChildFrame <TextBox>(); TextBoxDisplayId.SetPoint(AnchorPoint.TopLeft, 110, -80); TextBoxDisplayId.IsNumeric = true; TextBoxDisplayId.Text = l_ActivePlayer != null?l_ActivePlayer.DisplayId.ToString() : string.Empty; TextBoxDisplayId.Width = 50; TextBoxDisplayId.Height = 26; ButtonMorphDisplayId = this.CreateChildFrame <Button>(); ButtonMorphDisplayId.SetPoint(AnchorPoint.TopLeft, 180, -80); ButtonMorphDisplayId.Width = 60; ButtonMorphDisplayId.Height = 26; ButtonMorphDisplayId.Text = "Morph"; ButtonMorphDisplayId.OnClick += ButtonMorphDisplayId_OnClick; ButtonCopyTarget = this.CreateChildFrame <Button>(); ButtonCopyTarget.SetPoint(AnchorPoint.Bottom, 0, 20); ButtonCopyTarget.Width = this.Width - 40; ButtonCopyTarget.Text = "Copy target data"; ButtonCopyTarget.OnClick += ButtonCopyTarget_OnClick; this.OnUpdate += MainWindow_OnUpdate; } }
protected override void OnClick(EventArgs e) { if (!lockClick) { lockClick = true; if (DropDownMenu != null) { DropDownMenu.GetContextMenu().Show(this, new Point(0, Height)); } if (style == ToolBarButtonStyle.PushButton) { Pushed = !Pushed; } base.OnClick(e); } }
private void DropDownMenu_Opening(object sender, CancelEventArgs e) { if (PlaylistView.SelectedIndices.Count == 0) { DropDownMenu.Hide(); } else { var Index = PlaylistView.SelectedIndices[0]; foreach (ToolStripItem Item in DropDownMenu.Items) { if (Item.Text == "Properties") { Item.Enabled = Tracks[Index].Writeable; } } } }
public MenuOptionHelp() { MenuDropList = new DropDownMenu("Help".Localize().ToUpper(), Direction.Down, pointSize: 10); MenuDropList.MenuItemsPadding = new BorderDouble(0); MenuDropList.Margin = new BorderDouble(0); MenuDropList.Padding = new BorderDouble(0); SetMenuItems(); AddChild(MenuDropList); this.Width = 48 * TextWidget.GlobalPointSizeScaleRatio; this.Height = 22 * TextWidget.GlobalPointSizeScaleRatio; this.Margin = new BorderDouble(0); this.Padding = new BorderDouble(0); this.VAnchor = Agg.UI.VAnchor.ParentCenter; this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); this.MenuDropList.OpenOffset = new Vector2(0, 0); }
private DropDownMenu GetSliceOptionsMenuDropList() { if (sliceOptionsMenuDropList == null) { sliceOptionsMenuDropList = new DropDownMenu("Options".Localize() + "... "); sliceOptionsMenuDropList.HoverColor = new RGBA_Bytes(0, 0, 0, 50); sliceOptionsMenuDropList.NormalColor = new RGBA_Bytes(0, 0, 0, 0); sliceOptionsMenuDropList.BorderColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 100); sliceOptionsMenuDropList.BackgroundColor = new RGBA_Bytes(0, 0, 0, 0); sliceOptionsMenuDropList.BorderWidth = 1; sliceOptionsMenuDropList.VAnchor |= VAnchor.ParentCenter; sliceOptionsMenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged); SetMenuItems(); } return(sliceOptionsMenuDropList); }
/// <summary> /// Draw all UnityEventBase fields /// </summary> /// <param name="component"></param> /// <param name="eventProperty"></param> /// <returns></returns> public static int DrawComponentEvents(SerializedProperty component, SerializedProperty eventProperty) { if (component.objectReferenceValue != null) { FieldInfo[] unityEventFields = GetAllFields(component.objectReferenceValue.GetType()) .Where( field => typeof(UnityEventBase).IsAssignableFrom(field.FieldType) && (field.IsPublic || field.GetCustomAttributes(typeof(SerializeField), false).Length > 0)).ToArray(); var currentSelectedIndex = Array.FindIndex(unityEventFields, p => p.Name == eventProperty.stringValue); var unityEventsDropDown = new DropDownMenu(); for (int i = 0; i < unityEventFields.Length; i++) { FieldInfo unityEventField = unityEventFields[i]; unityEventsDropDown.Add(new DropDownItem { Label = ObjectNames.NicifyVariableName(unityEventField.Name), IsSelected = currentSelectedIndex == i, Command = () => eventProperty.stringValue = unityEventField.Name, }); } if (unityEventFields.Length > 0) { EditorGUI.indentLevel++; unityEventsDropDown.OnGUI("Event"); EditorGUI.indentLevel--; } else { EditorGUI.indentLevel++; EditorGUILayout.LabelField("Event", "No available events"); eventProperty.stringValue = ""; EditorGUI.indentLevel--; } return(unityEventFields.Length); } return(0); }
public MenuBase(string menuName) { MenuDropList = new DropDownMenu(menuName.ToUpper(), Direction.Down, pointSize: 10); MenuDropList.MenuItemsPadding = new BorderDouble(0); MenuDropList.Margin = new BorderDouble(0); MenuDropList.Padding = new BorderDouble(0); MenuDropList.MenuItemsPadding = new BorderDouble(8, 4); // 8, 6, 8, 6); MenuDropList.DrawDirectionalArrow = false; MenuDropList.MenuAsWideAsItems = false; menuActions = new List <MenuItemAction>(GetMenuActions()); BorderDouble padding = MenuDropList.MenuItemsPadding; //Add the menu items to the menu itself foreach (MenuItemAction item in menuActions) { if (item.Title.StartsWith("-----")) { MenuDropList.AddHorizontalLine(); } else { MenuItem newItem = MenuDropList.AddItem(item.Title, pointSize: 11); if (item.Action == null) { newItem.Enabled = false; } } } MenuDropList.Padding = padding; AddChild(MenuDropList); this.Width = GetChildrenBoundsIncludingMargins().Width; this.Height = 22 * GuiWidget.DeviceScale; this.Margin = new BorderDouble(0); this.Padding = new BorderDouble(0); this.VAnchor = Agg.UI.VAnchor.ParentCenter; this.MenuDropList.SelectionChanged += MenuDropList_SelectionChanged; this.MenuDropList.OpenOffset = new Vector2(0, 0); }
public override void SetUp() { Column = new BocDropDownMenuColumnDefinition(); Column.ColumnTitle = "FirstColumn"; Column.MenuTitleText = "Menu Title"; Column.MenuTitleIcon = new IconInfo("~/Images/MenuTitleIcon.gif", 16, 16); base.SetUp(); List.Stub(mock => mock.HasMenuBlock).Return(true); List.Stub(mock => mock.RowMenuDisplay).Return(RowMenuDisplay.Manual); Menu = MockRepository.GenerateMock <DropDownMenu> (List); Menu.Stub(menuMock => menuMock.RenderControl(Html.Writer)).WhenCalled( invocation => ((HtmlTextWriter)invocation.Arguments[0]).Write("mocked dropdown menu")); _bocListQuirksModeCssClassDefinition = new BocListQuirksModeCssClassDefinition(); _renderingContext = new BocColumnRenderingContext <BocDropDownMenuColumnDefinition> (new BocColumnRenderingContext(HttpContext, Html.Writer, List, Column, 0, 0)); }
private void CreateItems(int count, Func <int, int> yearFunction, Func <int, float> amountFunction, Func <int, string> optionFunc, Func <int, string> nameFunction) { MetadataFields[0].Serialize(); MetadataFields[1].Serialize(); MetadataFields[2].Serialize(); MetadataFields[3].Serialize(); FormField[] fields = new FormField[4]; for (int i = 0; i < count; ++i) { fields[0] = new TextField() { Content = MetadataFields[0].Content }; fields[0].SetValues(new string[] { nameFunction(i) }); fields[1] = new NumberField() { Content = MetadataFields[1].Content }; fields[1].SetValues(new string[] { amountFunction(i).ToString() }); fields[2] = new NumberField() { Content = MetadataFields[2].Content }; fields[2].SetValues(new string[] { yearFunction(i).ToString() }); fields[3] = new DropDownMenu() { Content = MetadataFields[3].Content }; fields[3].SetValues(new string[] { optionFunc(i) }); ((DropDownMenu)fields[3]).UpdateValues(fields[3]); CreateItem(EntityTypeName, fields, false); } }
private void initDropDownElement() { GameObject obj = this.gameObject; GameObject savedObj = obj; GameObject savedParent = null; DropDownMenu menu = null; while(obj != null){ menu = obj.GetComponent<DropDownMenu>(); if( menu != null){ break; } if(obj.transform.parent != null) savedParent = obj.transform.parent.gameObject; else savedParent = null; obj = savedParent; } if(menu == null){ EditorDebug.LogWarning("Element: " + savedObj.gameObject.name + " is not a child of a DropDownMenu!"); } containingDropDownElement = menu; }
void Initialize() { // Get the prefabs in the folder Prefabs/NPCs folder prefabsPath = Application.dataPath + "/Resources/NPCs"; #if !UNITY_OSX && !UNITY_IPHONE prefabsPath = prefabsPath.Replace('/', '\\'); #endif if(Directory.Exists(prefabsPath)) { // Make sure directory exists getPrefabs(prefabsPath); } else { Debug.Log ("Cannot open path " + prefabsPath); } #region dropdown instantiation // Set style of dropDown dropDownStyle.normal.textColor = Color.white; dropDownStyle.onHover.background = dropDownStyle.hover.background = new Texture2D(2, 2); dropDownStyle.padding.left = dropDownStyle.padding.right = dropDownStyle.padding.top = dropDownStyle.padding.bottom = 4; // Create DialogueDisplayType dropdown dropDownDialogueDisplayTypeList = new GUIContent[Enum.GetNames(typeof(Dialogue.DialogueDisplayType)).Length]; // Create list for(int i = 0; i < Enum.GetNames(typeof(Dialogue.DialogueDisplayType)).Length; i++) // Populate the list dropDownDialogueDisplayTypeList[i] = new GUIContent(Enum.GetName(typeof(Dialogue.DialogueDisplayType), i)); dropDownDialogueDisplayTypeMenu = new DropDownMenu(new Rect(0, 0, Screen.width / 2 - 25, 25), // Put the list in the menu dropDownDialogueDisplayTypeList[0], dropDownDialogueDisplayTypeList, "button", "box", dropDownStyle); // Create DialogueBubbleType dropdown dropDownDialogueBubbleTypeList = new GUIContent[Enum.GetNames(typeof(Dialogue.DialogueLocation)).Length]; // Create list for(int i = 0; i < Enum.GetNames(typeof(Dialogue.DialogueLocation)).Length; i++) // Populate the list dropDownDialogueBubbleTypeList[i] = new GUIContent(Enum.GetName(typeof(Dialogue.DialogueLocation), i)); dropDownDialogueBubbleTypeMenu = new DropDownMenu(new Rect(0, 30, Screen.width / 2 - 25, 25), // Put the list in the menu dropDownDialogueBubbleTypeList[0], dropDownDialogueBubbleTypeList, "button", "box", dropDownStyle); // Create DialogueSpeaker dropdown dropDownDialogueSpeakerList = new GUIContent[Enum.GetNames(typeof(Dialogue.Speaker)).Length]; // Create list for(int i = 0; i < Enum.GetNames(typeof(Dialogue.Speaker)).Length; i++) // Populate the list dropDownDialogueSpeakerList[i] = new GUIContent(Enum.GetName(typeof(Dialogue.Speaker), i)); dropDownDialogueSpeakerMenu = new DropDownMenu(new Rect(0, 360, Screen.width / 2 - 25, 25), // Put the list in the menu dropDownDialogueSpeakerList[0], dropDownDialogueSpeakerList, "button", "box", dropDownStyle); // Create DialogueSpeaker dropdown dropDownDialogueTypeList = new GUIContent[Enum.GetNames(typeof(Dialogue.DialogueType)).Length]; // Create list for(int i = 0; i < Enum.GetNames(typeof(Dialogue.DialogueType)).Length; i++) // Populate the list dropDownDialogueTypeList[i] = new GUIContent(Enum.GetName(typeof(Dialogue.DialogueType), i)); dropDownDialogueTypeMenu = new DropDownMenu(new Rect(0, 450, Screen.width / 2 - 25, 25), // Put the list in the menu dropDownDialogueTypeList[0], dropDownDialogueTypeList, "button", "box", dropDownStyle); // Create ReplyType dropdown dropDownReplyTypeList = new GUIContent[Enum.GetNames(typeof(Reply.AnswerType)).Length]; // Create list for(int i = 0; i < Enum.GetNames(typeof(Reply.AnswerType)).Length; i++) // Populate the list dropDownReplyTypeList[i] = new GUIContent(Enum.GetName(typeof(Reply.AnswerType), i)); dropDownReplyTypeMenu = new DropDownMenu(new Rect(0, 450, Screen.width / 2 - 25, 25), // Put the list in the menu dropDownReplyTypeList[0], dropDownReplyTypeList, "button", "box", dropDownStyle); #endregion }
void Awake() { if (master == null){ master = this; } else if (master != this){ Destroy(gameObject); } string line = null; System.IO.StreamReader file = new System.IO.StreamReader(@"Assets\Data\General\DropDownOptions.txt"); while((line = file.ReadLine())!=null){ string[] info = line.Split('|'); string[] objectOptions = info[1].Split(','); Dictionary<string, string> currentOptions = new Dictionary<string,string>(); foreach(string objectOption in objectOptions){ string[] properties = objectOption.Split('/'); currentOptions.Add(properties[0], properties[1]); } options.Add(info[0], currentOptions); } file.Close(); }