using System; using System.ComponentModel; using System.Drawing; namespace DevComponents.DotNetBar { /// /// Represents colors for the active tab. /// [ToolboxItem(false), TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))] public class TabColors { #region Events /// /// Occurs after color property has changed. /// public event EventHandler ColorChanged; #endregion #region Private Variables private Color m_BackColor=Color.Empty; private Color m_BackColor2=Color.Empty; private int m_BackColorGradientAngle=90; private Color m_LightBorderColor=Color.Empty; private Color m_DarkBorderColor=Color.Empty; private Color m_BorderColor=Color.Empty; private Color m_TextColor=Color.Empty; private BackgroundColorBlendCollection m_BackgroundColorBlend = new BackgroundColorBlendCollection(); #endregion #region Internal Implementation /// /// Creates new instance of the object. /// public TabColors(){} /// /// Gets or sets the background color of the tab when inactive. /// [Browsable(true),Description("Indicates the inactive tab background color."),Category("Style")] public Color BackColor { get {return m_BackColor;} set { m_BackColor=value; this.Refresh(); } } /// /// Returns whether property should be serialized. /// /// true if property should be serialized otherwise false. [Browsable(false),EditorBrowsable(EditorBrowsableState.Never)] public bool ShouldSerializeBackColor() { return !m_BackColor.IsEmpty; } /// /// Resets property to the default value. /// [Browsable(false),EditorBrowsable(EditorBrowsableState.Never)] public void ResetBackColor() { BackColor=Color.Empty; } /// /// Gets or sets the target gradient background color of the tab when inactive. /// [Browsable(true),Description("Indicates the inactive tab target gradient background color."),Category("Style")] public Color BackColor2 { get {return m_BackColor2;} set { m_BackColor2=value; this.Refresh(); } } /// /// Returns whether property should be serialized. /// /// true if property should be serialized otherwise false. [Browsable(false),EditorBrowsable(EditorBrowsableState.Never)] public bool ShouldSerializeBackColor2() { return !m_BackColor2.IsEmpty; } /// /// Resets property to the default value. /// [Browsable(false),EditorBrowsable(EditorBrowsableState.Never)] public void ResetBackColor2() { BackColor2=Color.Empty; } /// /// Gets or sets the gradient angle. /// [Browsable(true),Description("Indicates the gradient angle."),Category("Style"),DefaultValue(90)] public int BackColorGradientAngle { get {return m_BackColorGradientAngle;} set {m_BackColorGradientAngle=value;this.Refresh();} } /// /// Gets the collection that defines the multi-color gradient background for tab item.. /// [Browsable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Description("Collection that defines the multicolor gradient background.")] public BackgroundColorBlendCollection BackgroundColorBlend { get { return m_BackgroundColorBlend; } } /// /// Gets or sets the light border color when tab is inactive. /// [Browsable(true),Description("Indicates the inactive tab light border color."),Category("Style")] public Color LightBorderColor { get {return m_LightBorderColor;} set { m_LightBorderColor=value; this.Refresh(); } } /// /// Returns whether property should be serialized. /// /// true if property should be serialized otherwise false. [Browsable(false),EditorBrowsable(EditorBrowsableState.Never)] public bool ShouldSerializeLightBorderColor() { return !m_LightBorderColor.IsEmpty; } /// /// Resets property to the default value. /// [Browsable(false),EditorBrowsable(EditorBrowsableState.Never)] public void ResetLightBorderColor() { LightBorderColor=Color.Empty; } /// /// Gets or sets the dark border color when tab is inactive. /// [Browsable(true),Description("Indicates the inactive tab dark border color."),Category("Style")] public Color DarkBorderColor { get {return m_DarkBorderColor;} set { m_DarkBorderColor=value; this.Refresh(); } } /// /// Returns whether property should be serialized. /// /// true if property should be serialized otherwise false. [Browsable(false),EditorBrowsable(EditorBrowsableState.Never)] public bool ShouldSerializeDarkBorderColor() { return !m_DarkBorderColor.IsEmpty; } /// /// Resets property to the default value. /// [Browsable(false),EditorBrowsable(EditorBrowsableState.Never)] public void ResetDarkBorderColor() { DarkBorderColor=Color.Empty; } /// /// Gets or sets the border color when tab is inactive. /// [Browsable(true),Description("Indicates the inactive tab border color."),Category("Style")] public Color BorderColor { get {return m_BorderColor;} set { m_BorderColor=value; this.Refresh(); } } /// /// Returns whether property should be serialized. /// /// true if property should be serialized otherwise false. [Browsable(false),EditorBrowsable(EditorBrowsableState.Never)] public bool ShouldSerializeBorderColor() { return !m_BorderColor.IsEmpty; } /// /// Resets property to the default value. /// [Browsable(false),EditorBrowsable(EditorBrowsableState.Never)] public void ResetBorderColor() { BorderColor=Color.Empty; } /// /// Gets or sets the text color when tab is inactive. /// [Browsable(true),Description("Indicates the inactive tab text color."),Category("Style")] public Color TextColor { get {return m_TextColor;} set { m_TextColor=value; this.Refresh(); } } /// /// Returns whether property should be serialized. /// /// true if property should be serialized otherwise false. [Browsable(false),EditorBrowsable(EditorBrowsableState.Never)] public bool ShouldSerializeTextColor() { return !m_TextColor.IsEmpty; } /// /// Resets property to the default value. /// [Browsable(false),EditorBrowsable(EditorBrowsableState.Never)] public void ResetTextColor() { TextColor=Color.Empty; } private void Refresh() { if(ColorChanged!=null) ColorChanged(this,new EventArgs()); } #endregion } }