public void ApplyMenuSeparatorStyle(SeparatorStyle style) { ApplyWidgetStyle(style); Renderable = style.Image; Thickness = style.Thickness; }
public void InfixExpression_Test(string expected, string input, SeparatorStyle separator) { Parser parser = new Parser(); parser.SeparatorStyle = separator; Assert.AreEqual(expected, parser.Parse(input).GetExpression()); }
/// <summary> /// Update the palette styles to the separator style. /// </summary> /// <param name="separatorStyle">New separator style.</param> public void SetStyles(SeparatorStyle separatorStyle) { switch (separatorStyle) { case SeparatorStyle.LowProfile: SetStyles(PaletteBackStyle.SeparatorLowProfile, PaletteBorderStyle.SeparatorLowProfile); break; case SeparatorStyle.HighProfile: SetStyles(PaletteBackStyle.SeparatorHighProfile, PaletteBorderStyle.SeparatorHighProfile); break; case SeparatorStyle.HighInternalProfile: SetStyles(PaletteBackStyle.SeparatorHighInternalProfile, PaletteBorderStyle.SeparatorHighInternalProfile); break; case SeparatorStyle.Custom1: SetStyles(PaletteBackStyle.SeparatorCustom1, PaletteBorderStyle.SeparatorCustom1); break; default: // Should never happen! Debug.Assert(false); break; } }
/// <summary> /// A static method that parses and evaluates a given expression string in one step. /// </summary> /// <param name="input">An expression string to be parsed and evaluated.</param> /// <param name="separator">The separator style to used to parse the expression.</param> /// <returns>The result of the evaluation as double.</returns> public static double Evaluate(string input, SeparatorStyle separator) { var parser = new Parser(); parser.SeparatorStyle = separator; return(parser.Parse(input).Evaluate()); }
/// <summary> /// Initialize a new instance of the KryptonSeparator class. /// </summary> public KryptonSeparator() { // The label cannot take the focus SetStyle(ControlStyles.Selectable, false); // Create the palette storage StateCommon = new PaletteSplitContainerRedirect(Redirector, PaletteBackStyle.PanelClient, PaletteBorderStyle.ControlClient, PaletteBackStyle.SeparatorHighProfile, PaletteBorderStyle.SeparatorHighProfile, NeedPaintDelegate) { BorderRedirect = { OverrideBorderToFalse = true } }; // Never draw the border around the background StateDisabled = new PaletteSplitContainer(StateCommon, StateCommon.Separator, StateCommon.Separator, NeedPaintDelegate); StateNormal = new PaletteSplitContainer(StateCommon, StateCommon.Separator, StateCommon.Separator, NeedPaintDelegate); StateTracking = new PaletteSeparatorPadding(StateCommon.Separator, StateCommon.Separator, NeedPaintDelegate); StatePressed = new PaletteSeparatorPadding(StateCommon.Separator, StateCommon.Separator, NeedPaintDelegate); // Our view contains just a simple canvas that covers entire client area and a separator view _drawSeparator = new ViewDrawSeparator(StateDisabled.Separator, StateNormal.Separator, StateTracking, StatePressed, StateDisabled.Separator, StateNormal.Separator, StateTracking, StatePressed, PaletteMetricPadding.SeparatorPaddingLowProfile, Orientation.Vertical); // Get the separator to fill the entire client area _drawDocker = new ViewDrawDocker(StateNormal.Back, StateNormal.Border) { IgnoreAllBorderAndPadding = true }; _drawDocker.Add(_drawSeparator, ViewDockStyle.Fill); // Create a separator controller to handle separator style behaviour _separatorController = new SeparatorController(this, _drawSeparator, true, true, NeedPaintDelegate); // Assign the controller to the view element to treat as a separator _drawSeparator.MouseController = _separatorController; _drawSeparator.KeyController = _separatorController; _drawSeparator.SourceController = _separatorController; // Create the view manager instance ViewManager = new ViewManager(this, _drawDocker); // Use timer to redraw after windows messages are processed _redrawTimer = new Timer { Interval = 1 }; _redrawTimer.Tick += OnRedrawTick; // Set other internal starting values _style = SeparatorStyle.HighProfile; _orientation = Orientation.Vertical; AllowMove = true; SplitterIncrements = 1; _splitterWidth = 5; }
internal SeparatorWidget(Orientation orientation, SeparatorStyle style) { _orientation = orientation; if (style != null) { ApplyMenuSeparatorStyle(style); } }
public void ApplyMenuSeparatorStyle(SeparatorStyle style) { ApplyWidgetStyle(style); Drawable = style.Image; if (_orientation == Orientation.Horizontal) { HeightHint = style.Thickness; } else { WidthHint = style.Thickness; } }
internal void SetSeparatorStyle(SeparatorStyle style) { switch (style) { case SeparatorStyle.Dot: DecimalSeparator = '.'; ArgumentSeparator = ','; break; default: DecimalSeparator = ','; ArgumentSeparator = ';'; break; } NumberFormat = new NumberFormatInfo(); NumberFormat.NumberDecimalSeparator = DecimalSeparator.ToString(); numberRegex = new Regex(NumberPattern); }
protected override void LoadViewState(object savedState) { object[] state = (object[])savedState; base.LoadViewState(state [0]); if (state [1] != null) { ItemStyle.LoadViewState(state [1]); } if (state [2] != null) { SelectedItemStyle.LoadViewState(state [2]); } if (state [3] != null) { AlternatingItemStyle.LoadViewState(state [3]); } if (state [4] != null) { EditItemStyle.LoadViewState(state [4]); } if (state [5] != null) { SeparatorStyle.LoadViewState(state [5]); } if (state [6] != null) { HeaderStyle.LoadViewState(state [6]); } if (state [7] != null) { FooterStyle.LoadViewState(state [7]); } #if NET_2_0 if (state [8] != null) { ControlStyle.LoadViewState(state [8]); } #endif }
/// <summary> /// Tries to parse and evaluate a given expression string in one step. /// </summary> /// <param name="input">An expression string to be parsed and evaluated.</param> /// <param name="separator">The separator style to used to parse the expression.</param> /// <param name="result">Holds the result of the evaluation if it was successful, otherwiese NaN.</param> /// <returns>true if parsing and evaluating were succesful and the result is valid, otherwise false.</returns> public static bool TryEvaluate(string input, SeparatorStyle separator, out double result) { var parser = new Parser(); parser.SeparatorStyle = separator; try { var parserResult = parser.Parse(input); result = parserResult.Evaluate(); } catch { result = double.NaN; return(false); } if (double.IsNaN(result)) { return(false); } else { return(true); } }
/// <summary> /// Get the correct metric padding for the provided separator style. /// </summary> /// <param name="separatorStyle">Separator style.</param> /// <returns>Matching metric padding.</returns> public static PaletteMetricPadding SeparatorStyleToMetricPadding(SeparatorStyle separatorStyle) { switch (separatorStyle) { case SeparatorStyle.LowProfile: return PaletteMetricPadding.SeparatorPaddingLowProfile; case SeparatorStyle.HighProfile: return PaletteMetricPadding.SeparatorPaddingHighProfile; case SeparatorStyle.HighInternalProfile: return PaletteMetricPadding.SeparatorPaddingHighInternalProfile; case SeparatorStyle.Custom1: return PaletteMetricPadding.SeparatorPaddingCustom1; default: // Should never happen! Debug.Assert(false); return PaletteMetricPadding.SeparatorPaddingLowProfile; } }
public static void SetSeparatorStyle(BindableObject element, SeparatorStyle value) { element.SetValue(SeparatorStyleProperty, value); }
public ListBoxStyle(ListBoxStyle style) : base(style) { ListItemStyle = new ButtonStyle(style.ListItemStyle); SeparatorStyle = new SeparatorStyle(style.SeparatorStyle); }
public HorizontalSeparator(SeparatorStyle style) : base(Orientation.Horizontal, style) { HorizontalAlignment = HorizontalAlignment.Stretch; VerticalAlignment = VerticalAlignment.Center; }
void ToggleSeparatorStyle(object sender, EventArgs e) { _separatorStyle = _separatorStyle == SeparatorStyle.FullWidth ? SeparatorStyle.Default : SeparatorStyle.FullWidth; UpdateButtonAndRefreshList(); }
public SeparatorStyle(SeparatorStyle style) : base(style) { Image = style.Image; Thickness = style.Thickness; }
private static void Preference() { tool = GUILayout.Toolbar(tool, new string[] { "Preferences", "Editors", "About" }); if (tool == 0) { EditorGUI.BeginChangeCheck(); inspectDefaultItems = EditorGUILayout.Toggle(new GUIContent("Inspect Default Items", "Draws all types that do not have a Custom Editor associated. If false, your classes are drawn by Unity unless they have the AdvancedInspector attribute."), inspectDefaultItems); expandableReferences = EditorGUILayout.Toggle(new GUIContent("Expandable References", "All MonoBehaviour/ScriptableObject references are expandable from the displayed field."), expandableReferences); collectionItemNaming = (InspectorCollectionItemNaming)EditorGUILayout.EnumPopup(new GUIContent("Collection Naming", "How items in a collection are named."), collectionItemNaming); valueScroll = (InspectorDragControl)EditorGUILayout.EnumPopup("Number Drag", valueScroll); if (valueScroll == copyPaste) { copyPaste = Next(copyPaste); } copyPaste = (InspectorDragControl)EditorGUILayout.EnumPopup("Copy/Paste Drag", copyPaste); if (valueScroll == copyPaste) { valueScroll = Next(valueScroll); } #if UNITY_2017_1 || UNITY_2017_2 massExpand = (InspectorModifierControl)EditorGUILayout.EnumMaskField("Expand/Collapse Children", massExpand); contextual = (InspectorModifierControl)EditorGUILayout.EnumMaskField("Contextual Menu", contextual); #else massExpand = (InspectorModifierControl)EditorGUILayout.EnumFlagsField("Expand/Collapse Children", massExpand); contextual = (InspectorModifierControl)EditorGUILayout.EnumFlagsField("Contextual Menu", contextual); #endif extraIndentation = Mathf.Clamp(EditorGUILayout.IntField("Indentation", extraIndentation), 0, int.MaxValue); largeCollection = Mathf.Clamp(EditorGUILayout.IntField("Large Collection", largeCollection), 10, 200); separator = (SeparatorStyle)EditorGUILayout.EnumPopup("Separator", separator); separatorDefaultColor = EditorGUILayout.ColorField("Separator Default", separatorDefaultColor); separatorSelectedColor = EditorGUILayout.ColorField("Separator Selected", separatorSelectedColor); boxDefaultColor = EditorGUILayout.ColorField("Box Default", boxDefaultColor); boxPlayColor = EditorGUILayout.ColorField("Box Playmode", boxPlayColor); style = (InspectorStyle)EditorGUILayout.EnumPopup("Style", style); Color previous = GUI.color; GUI.color = EditorApplication.isPlaying ? boxPlayColor : boxDefaultColor; GUILayout.Box("", AdvancedInspectorControl.BoxTitleStyle); GUILayout.Box("", AdvancedInspectorControl.BoxStyle); GUI.color = previous; if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool(InspectDefaultItemsKey, inspectDefaultItems); EditorPrefs.SetInt(StyleKey, (int)style); EditorPrefs.SetInt(SeparatorKey, (int)separator); EditorPrefs.SetString(SeparatorDefaultKey, ColorToString(separatorDefaultColor)); EditorPrefs.SetString(SeparatorSelectedKey, ColorToString(separatorSelectedColor)); EditorPrefs.SetString(BoxDefaultKey, ColorToString(boxDefaultColor)); EditorPrefs.SetString(BoxPlayKey, ColorToString(boxPlayColor)); EditorPrefs.SetInt(IndentationKey, extraIndentation); EditorPrefs.SetInt(LargeCollectionKey, largeCollection); EditorPrefs.SetInt(ValueScrollKey, (int)valueScroll); EditorPrefs.SetInt(CopyPasteKey, (int)copyPaste); EditorPrefs.SetInt(MassExpandKey, (int)massExpand); EditorPrefs.SetBool(ExpandableReferencesKey, expandableReferences); EditorPrefs.SetInt(CollectionItemNamingKey, (int)collectionItemNaming); } } else if (tool == 1) { bool offAll = false; bool onAll = false; GUILayout.BeginHorizontal(); if (GUILayout.Button("Turn Off")) { offAll = true; } if (GUILayout.Button("Turn On")) { onAll = true; } GUILayout.EndHorizontal(); bool changed = false; scrollView = GUILayout.BeginScrollView(scrollView); foreach (KeyValuePair <FileInfo, string[]> pair in editors) { bool active = !pair.Value[0].Contains("///"); bool result = EditorGUILayout.ToggleLeft(pair.Key.Name, active); if (offAll) { result = false; } if (onAll) { result = true; } if (result != active) { if (!result) { for (int i = 0; i < pair.Value.Length; i++) { pair.Value[i] = "///" + pair.Value[i]; } } else { for (int i = 0; i < pair.Value.Length; i++) { pair.Value[i] = pair.Value[i].Substring(3); } } string path = "Assets" + pair.Key.FullName.Substring(Application.dataPath.Length); if (!AssetDatabase.IsOpenForEdit(path, StatusQueryOptions.UseCachedIfPossible)) { Provider.Checkout(path, CheckoutMode.Both); } File.WriteAllLines(pair.Key.FullName, pair.Value); UnityEngine.Object[] selection = Selection.objects; Selection.objects = new UnityEngine.Object[0]; Selection.objects = selection; changed = true; } } GUILayout.EndScrollView(); if (changed) { AssetDatabase.Refresh(); } } else if (tool == 2) { GUIStyle style = new GUIStyle(); style.normal.textColor = Color.blue; GUI.DrawTexture(new Rect(-16, 36, 379, 93), Logo, ScaleMode.ScaleToFit); GUILayout.Space(100); EditorGUILayout.LabelField(version); GUILayout.Space(10); if (GUILayout.Button("Manual", style)) { Application.OpenURL("http://lightstrikersoftware.com/docs/AdvancedInspector_Manual.pdf"); } GUILayout.Space(10); if (GUILayout.Button("Tutorials", style)) { Application.OpenURL("http://lightstrikersoftware.com/docs/AdvancedInspector_Tutorials.pdf"); } GUILayout.Space(10); EditorGUILayout.LabelField("Need Help? Found A Bug?"); if (GUILayout.Button("*****@*****.**", style)) { Application.OpenURL("mailto:[email protected]"); } } }
public Separator(SeparatorStyle style) { this.style = style; }
/// <summary> /// Initialize a new instance of the KryptonSeparator class. /// </summary> public KryptonSeparator() { // The label cannot take the focus SetStyle(ControlStyles.Selectable, false); // Create the palette storage _stateCommon = new PaletteSplitContainerRedirect(Redirector, PaletteBackStyle.PanelClient, PaletteBorderStyle.ControlClient, PaletteBackStyle.SeparatorHighProfile, PaletteBorderStyle.SeparatorHighProfile, NeedPaintDelegate); // Never draw the border around the background _stateCommon.BorderRedirect.OverrideBorderToFalse = true; _stateDisabled = new PaletteSplitContainer(_stateCommon, _stateCommon.Separator, _stateCommon.Separator, NeedPaintDelegate); _stateNormal = new PaletteSplitContainer(_stateCommon, _stateCommon.Separator, _stateCommon.Separator, NeedPaintDelegate); _stateTracking = new PaletteSeparatorPadding(_stateCommon.Separator, _stateCommon.Separator, NeedPaintDelegate); _statePressed = new PaletteSeparatorPadding(_stateCommon.Separator, _stateCommon.Separator, NeedPaintDelegate); // Our view contains just a simple canvas that covers entire client area and a separator view _drawSeparator = new ViewDrawSeparator(_stateDisabled.Separator, _stateNormal.Separator, _stateTracking, _statePressed, _stateDisabled.Separator, _stateNormal.Separator, _stateTracking, _statePressed, PaletteMetricPadding.SeparatorPaddingLowProfile, Orientation.Vertical); // Get the separator to fill the entire client area _drawDocker = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border); _drawDocker.IgnoreAllBorderAndPadding = true; _drawDocker.Add(_drawSeparator, ViewDockStyle.Fill); // Create a separator controller to handle separator style behaviour _separatorController = new SeparatorController(this, _drawSeparator, true, true, NeedPaintDelegate); // Assign the controller to the view element to treat as a separator _drawSeparator.MouseController = _separatorController; _drawSeparator.KeyController = _separatorController; _drawSeparator.SourceController = _separatorController; // Create the view manager instance ViewManager = new ViewManager(this, _drawDocker); // Use timer to redraw after windows messages are processed _redrawTimer = new Timer(); _redrawTimer.Interval = 1; _redrawTimer.Tick += new EventHandler(OnRedrawTick); // Set other internal starting values _style = SeparatorStyle.HighProfile; _orientation = Orientation.Vertical; _allowMove = true; _splitterIncrements = 1; _splitterWidth = 5; }
/// <summary> /// Place separator line (or empty space) after control /// </summary> /// <param name="style"></param> /// <returns></returns> public TBuilder PlaceSeparatorAfter(SeparatorStyle style = SeparatorStyle.Line) { Item.Data.SeparatorAfter = new Separator(style); return((TBuilder)this); }
public ListBoxStyle() { ListItemStyle = new ButtonStyle(); SeparatorStyle = new SeparatorStyle(); }
public MenuStyle() { MenuItemStyle = new MenuItemStyle(); SeparatorStyle = new SeparatorStyle(); }
public ListBoxStyle(ListBoxStyle style) : base(style) { ListItemStyle = style.ListItemStyle != null ? new ImageTextButtonStyle(style.ListItemStyle) : null; SeparatorStyle = style.SeparatorStyle != null ? new SeparatorStyle(style.SeparatorStyle) : null; }
public static IPlatformElementConfiguration <iOS, FormsElement> SetSeparatorStyle(this IPlatformElementConfiguration <iOS, FormsElement> config, SeparatorStyle value) { SetSeparatorStyle(config.Element, value); return(config); }
private void ResetSeparatorStyle() { SeparatorStyle = SeparatorStyle.HighProfile; }
static InspectorPreferences() { if (EditorPrefs.HasKey(InspectDefaultItemsKey)) { inspectDefaultItems = EditorPrefs.GetBool(InspectDefaultItemsKey); } if (EditorPrefs.HasKey(StyleKey)) { style = (InspectorStyle)EditorPrefs.GetInt(StyleKey); } if (EditorPrefs.HasKey(SeparatorKey)) { separator = (SeparatorStyle)EditorPrefs.GetInt(SeparatorKey); } if (EditorPrefs.HasKey(SeparatorDefaultKey)) { separatorDefaultColor = StringToColor(EditorPrefs.GetString(SeparatorDefaultKey)); } if (EditorPrefs.HasKey(SeparatorSelectedKey)) { separatorSelectedColor = StringToColor(EditorPrefs.GetString(SeparatorSelectedKey)); } if (EditorPrefs.HasKey(BoxDefaultKey)) { boxDefaultColor = StringToColor(EditorPrefs.GetString(BoxDefaultKey)); } if (EditorPrefs.HasKey(BoxPlayKey)) { boxPlayColor = StringToColor(EditorPrefs.GetString(BoxPlayKey)); } if (EditorPrefs.HasKey(IndentationKey)) { extraIndentation = EditorPrefs.GetInt(IndentationKey); } if (EditorPrefs.HasKey(LargeCollectionKey)) { largeCollection = EditorPrefs.GetInt(LargeCollectionKey); } if (EditorPrefs.HasKey(ValueScrollKey)) { valueScroll = (InspectorDragControl)EditorPrefs.GetInt(ValueScrollKey); } if (EditorPrefs.HasKey(CopyPasteKey)) { copyPaste = (InspectorDragControl)EditorPrefs.GetInt(CopyPasteKey); } if (EditorPrefs.HasKey(MassExpandKey)) { massExpand = (InspectorModifierControl)EditorPrefs.GetInt(MassExpandKey); } if (EditorPrefs.HasKey(ContextualKey)) { contextual = (InspectorModifierControl)EditorPrefs.GetInt(ContextualKey); } if (EditorPrefs.HasKey(ExpandableReferencesKey)) { expandableReferences = EditorPrefs.GetBool(ExpandableReferencesKey); } if (EditorPrefs.HasKey(CollectionItemNamingKey)) { collectionItemNaming = (InspectorCollectionItemNaming)EditorPrefs.GetInt(CollectionItemNamingKey); } GetAllEditor(); }
private void SetStyles(SeparatorStyle separatorStyle) { _stateCommon.Separator.SetStyles(separatorStyle); }
public MenuStyle(MenuStyle style) : base(style) { MenuItemStyle = new MenuItemStyle(style.MenuItemStyle); SeparatorStyle = new SeparatorStyle(style.SeparatorStyle); }
public MenuStyle(MenuStyle style) : base(style) { MenuItemStyle = style.MenuItemStyle != null ? new MenuItemStyle(style.MenuItemStyle) : null; SeparatorStyle = style.SeparatorStyle != null ? new SeparatorStyle(style.SeparatorStyle) : null; }