/// ------------------------------------------------------------------------------------ /// <summary> /// Saves a boolean property value to a props builder that will go to the database. /// </summary> /// <param name="props">props builder</param> /// <param name="boolProp">The boolean property to write</param> /// <param name="propTag">The property tag</param> /// ------------------------------------------------------------------------------------ private void SaveBoolProp(ITsPropsBldr props, InheritableStyleProp <bool> boolProp, int propTag) { if (!boolProp.IsInherited) { props.SetIntPropValues(propTag, 0, boolProp.Value ? 1 : 0); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the check state for the specified boolean inheritable prop. /// </summary> /// <param name="prop">The prop.</param> /// <returns>The check state</returns> /// ------------------------------------------------------------------------------------ private CheckState GetCheckStateFor(InheritableStyleProp <bool> prop) { if (prop.IsInherited && ShowingInheritedProperties) { return(CheckState.Indeterminate); } return(prop.Value ? CheckState.Checked : CheckState.Unchecked); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Sets the inheritable prop. /// </summary> /// <param name="prop">The prop.</param> /// <returns><c>true</c> if this control's state has been set to reflect an inherited /// property. If this returns <c>false</c>, caller should take whatever action necessary /// to select the correct item based on the value of the property (we couldn't come up /// with any clean way to encapsulate this behavior).</returns> /// ------------------------------------------------------------------------------------ public bool SetInheritableProp <T>(InheritableStyleProp <T> prop) { ForeColor = (prop.IsInherited && ShowingInheritedProperties) ? SystemColors.GrayText : SystemColors.WindowText; if (!prop.ValueIsSet) { SelectedIndex = 0; return(true); } return(false); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Copy constructor /// </summary> /// ------------------------------------------------------------------------------------ public FontInfo(FontInfo copyFrom) { m_fontName = new InheritableStyleProp <string>(copyFrom.m_fontName); m_fontSize = new InheritableStyleProp <int>(copyFrom.m_fontSize); m_fontColor = new InheritableStyleProp <Color>(copyFrom.m_fontColor); m_backColor = new InheritableStyleProp <Color>(copyFrom.m_backColor); m_bold = new InheritableStyleProp <bool>(copyFrom.m_bold); m_italic = new InheritableStyleProp <bool>(copyFrom.m_italic); m_superSub = new InheritableStyleProp <FwSuperscriptVal>(copyFrom.m_superSub); m_underline = new InheritableStyleProp <FwUnderlineType>(copyFrom.m_underline); m_underlineColor = new InheritableStyleProp <Color>(copyFrom.m_underlineColor); m_offset = new InheritableStyleProp <int>(copyFrom.m_offset); m_features = new InheritableStyleProp <string>(copyFrom.m_features); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Copy constructor /// </summary> /// ------------------------------------------------------------------------------------ public FontInfo(FontInfo copyFrom) { m_fontName = new InheritableStyleProp<string>(copyFrom.m_fontName); m_fontSize = new InheritableStyleProp<int>(copyFrom.m_fontSize); m_fontColor = new InheritableStyleProp<Color>(copyFrom.m_fontColor); m_backColor = new InheritableStyleProp<Color>(copyFrom.m_backColor); m_bold = new InheritableStyleProp<bool>(copyFrom.m_bold); m_italic = new InheritableStyleProp<bool>(copyFrom.m_italic); m_superSub = new InheritableStyleProp<FwSuperscriptVal>(copyFrom.m_superSub); m_underline = new InheritableStyleProp<FwUnderlineType>(copyFrom.m_underline); m_underlineColor = new InheritableStyleProp<Color>(copyFrom.m_underlineColor); m_offset = new InheritableStyleProp<int>(copyFrom.m_offset); m_features = new InheritableStyleProp<string>(copyFrom.m_features); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the color to display for a given color prop. If the current style is a /// paragraph style, this will always be the ultimate color the user will see for text /// displayed with this style (whether the value is explicit, inherited from a based-on /// style, or ultimately "inherited" from the system default). If the current style is /// a character style, it will be Color.Empty unless this property has an explicit value /// or somewhere in the inheritance chain for this this character style there is a /// style which has an explicit value for this property. /// </summary> /// <param name="colorProp">The color prop.</param> /// <returns></returns> /// ------------------------------------------------------------------------------------ private Color GetColorToDisplay(InheritableStyleProp <Color> colorProp) { return((colorProp.ValueIsSet) ? colorProp.Value : Color.Empty); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the color to use for painting the foreground of a control which displays an /// inheritable property value. /// </summary> /// <param name="prop">The inheritable property.</param> /// <returns>The system gray color if the property is inherited; otherwise the normal /// window text color.</returns> /// ------------------------------------------------------------------------------------ private Color GetCtrlForeColorForProp <T>(InheritableStyleProp <T> prop) { return((prop.IsInherited && ShowingInheritedProperties) ? SystemColors.GrayText : SystemColors.WindowText); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the color to use for painting the foreground of a control which displays an /// inheritable property value. /// </summary> /// <param name="prop">The inheritable property.</param> /// <returns>The system gray color if the property is inherited; otherwise the normal /// window text color.</returns> /// ------------------------------------------------------------------------------------ private Color GetCtrlForeColorForProp <T>(InheritableStyleProp <T> prop) { return((prop.IsInherited && m_currentStyleInfo.Inherits) ? SystemColors.GrayText : SystemColors.WindowText); }
private void SetDictionaryNormalDirection(InheritableStyleProp <TriStateBool> rightToLeft) { ReflectionHelper.SetField(DictionaryNormalStyle, "m_rtl", rightToLeft); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Saves a boolean property value to a props builder that will go to the database. /// </summary> /// <param name="props">props builder</param> /// <param name="boolProp">The boolean property to write</param> /// <param name="propTag">The property tag</param> /// ------------------------------------------------------------------------------------ private void SaveBoolProp(ITsPropsBldr props, InheritableStyleProp<bool> boolProp, int propTag) { if (!boolProp.IsInherited) props.SetIntPropValues(propTag, 0, boolProp.Value ? 1 : 0); }