Example #1
0
        /// <summary>
        /// Loads the default StyleSheet according to the desired type of dynamic hint.
        /// The StyleSheet will be added as the first StyleSheet of the element.
        /// </summary>
        /// <param name="element">The element to which the StyleSheet will be added to. This is usually the root of your dynamic hint.</param>
        /// <param name="useInstanceTooltipStyleSheet">If true, the StyleSheet commonly used in dynamic hints that represent data of an instance of an Object will be applied.
        /// Otherwise, the style commonly applied to dynamic hints that explain how properties or editor tools work will be applied.</param>
        protected void AddDefaultStyleSheetAsFirstTo(VisualElement element, bool useInstanceTooltipStyleSheet)
        {
            StyleSheet defaultStyleSheet = useInstanceTooltipStyleSheet ? DynamicHintUtility.GetDefaultInstanceDynamicHintStyleSheet()
                : DynamicHintUtility.GetDefaultDynamicHintStyleSheet();

            if (element.styleSheets.count > 0)
            {
                element.styleSheetList.Insert(0, defaultStyleSheet);
            }
            else
            {
                element.styleSheets.Add(defaultStyleSheet);
            }
        }
Example #2
0
 internal string ToTooltipString()
 {
     return(DynamicHintUtility.Serialize(this));
 }