DotNet 4.8.1 build of DotNetBar
This commit is contained in:
@@ -0,0 +1,201 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// BackColorBlend
|
||||
///</summary>
|
||||
[TypeConverter(typeof(BackColorBlendConvertor))]
|
||||
public class BackColorBlend : INotifyPropertyChanged
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Color[] _Colors; // Color values
|
||||
private float[] _Positions; // Gradient color positions
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Colors
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ColorBlend Color array
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(null)]
|
||||
[Description("Indicates the ColorBlend Color array")]
|
||||
[TypeConverter(typeof(ArrayConverter))]
|
||||
public Color[] Colors
|
||||
{
|
||||
get { return (_Colors); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != null && value.Length == 0)
|
||||
value = null;
|
||||
|
||||
_Colors = value;
|
||||
|
||||
OnPropertyChangedEx("Colors");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Positions
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ColorBlend Color Positions
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(null)]
|
||||
[Description("Indicates the ColorBlend Color Positions")]
|
||||
[TypeConverter(typeof(ArrayConverter))]
|
||||
public float[] Positions
|
||||
{
|
||||
get { return (_Positions); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != null && value.Length == 0)
|
||||
value = null;
|
||||
|
||||
_Positions = value;
|
||||
|
||||
OnPropertyChangedEx("Positions");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
/// <summary>
|
||||
/// IsEmpty
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsEmpty
|
||||
{
|
||||
get { return (_Colors == null || _Colors.Length == 1 && _Colors[0].IsEmpty); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Creates an exact copy of the BackColorBlend.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the BackColorBlend.</returns>
|
||||
public BackColorBlend Copy()
|
||||
{
|
||||
BackColorBlend copy = new BackColorBlend();
|
||||
|
||||
if (_Colors != null)
|
||||
{
|
||||
copy.Colors = new Color[_Colors.Length];
|
||||
|
||||
_Colors.CopyTo(copy.Colors, 0);
|
||||
}
|
||||
|
||||
if (_Positions != null)
|
||||
{
|
||||
copy.Positions = new float[_Positions.Length];
|
||||
|
||||
_Positions.CopyTo(copy.Positions, 0);
|
||||
}
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="s">Event arguments</param>
|
||||
protected virtual void OnPropertyChangedEx(string s)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
{
|
||||
VisualPropertyChangedEventArgs e =
|
||||
new VisualPropertyChangedEventArgs(s);
|
||||
|
||||
eh(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region BackColorBlendConvertor
|
||||
|
||||
/// <summary>
|
||||
/// BackColorBlendConvertor
|
||||
/// </summary>
|
||||
public class BackColorBlendConvertor : ExpandableObjectConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// ConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
{
|
||||
BackColorBlend cb = value as BackColorBlend;
|
||||
|
||||
if (cb != null)
|
||||
{
|
||||
ColorConverter cvt = new ColorConverter();
|
||||
|
||||
if (cb.Colors != null)
|
||||
{
|
||||
if (cb.Colors[0] != Color.Empty)
|
||||
return (cvt.ConvertToString(cb.Colors[0]));
|
||||
|
||||
if (cb.Colors.Length > 1 && cb.Colors[1] != Color.Empty)
|
||||
return (cvt.ConvertToString(cb.Colors[1]));
|
||||
}
|
||||
}
|
||||
|
||||
return (String.Empty);
|
||||
}
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
@@ -0,0 +1,766 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Globalization;
|
||||
using DevComponents.Instrumentation.Primitives;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents background of visual style.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(BackgroundConvertor))]
|
||||
[Editor(typeof(BackgroundEditor), typeof(UITypeEditor))]
|
||||
public class Background : INotifyPropertyChanged, IDisposable
|
||||
{
|
||||
#region Static data
|
||||
|
||||
///<summary>
|
||||
/// Empty
|
||||
///</summary>
|
||||
/// <summary>
|
||||
/// Returns Empty instance of BorderPattern.
|
||||
/// </summary>
|
||||
public static Background Empty
|
||||
{
|
||||
get { return (new Background()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private Color _Color1 = Color.Empty;
|
||||
private Color _Color2 = Color.Empty;
|
||||
|
||||
private int _GradientAngle = 90;
|
||||
|
||||
private BackFillType _BackFillType = BackFillType.Angle;
|
||||
private BackColorBlend _BackColorBlend;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
public Background() { }
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="color1">Start color.</param>
|
||||
public Background(Color color1)
|
||||
{
|
||||
_Color1 = color1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="color1">Start color.</param>
|
||||
/// <param name="color2">End color.</param>
|
||||
public Background(Color color1, Color color2)
|
||||
{
|
||||
_Color1 = color1;
|
||||
_Color2 = color2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="color1">Start color in hexadecimal representation like FFFFFF.</param>
|
||||
/// <param name="color2">End color in hexadecimal representation like FFFFFF.</param>
|
||||
public Background(string color1, string color2)
|
||||
{
|
||||
_Color1 = ColorFactory.GetColor(color1);
|
||||
_Color2 = ColorFactory.GetColor(color2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="color1">Start color in 32-bit RGB representation.</param>
|
||||
/// <param name="color2">End color in 32-bit RGB representation.</param>
|
||||
public Background(int color1, int color2)
|
||||
{
|
||||
_Color1 = ColorFactory.GetColor(color1);
|
||||
_Color2 = ColorFactory.GetColor(color2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="color1">Start color in 32-bit RGB representation.</param>
|
||||
/// <param name="color2">End color in 32-bit RGB representation.</param>
|
||||
/// <param name="gradientAngle">Gradient angle.</param>
|
||||
public Background(int color1, int color2, int gradientAngle)
|
||||
{
|
||||
_Color1 = ColorFactory.GetColor(color1);
|
||||
_Color2 = ColorFactory.GetColor(color2);
|
||||
|
||||
GradientAngle = gradientAngle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="color1">Start color.</param>
|
||||
/// <param name="color2">End color.</param>
|
||||
/// <param name="gradientAngle">Gradient angle.</param>
|
||||
public Background(Color color1, Color color2, int gradientAngle)
|
||||
{
|
||||
_Color1 = color1;
|
||||
_Color2 = color2;
|
||||
|
||||
GradientAngle = gradientAngle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="color1">Start color.</param>
|
||||
/// <param name="color2">End color.</param>
|
||||
/// <param name="fillType">Gradient angle.</param>
|
||||
public Background(Color color1, Color color2, BackFillType fillType)
|
||||
{
|
||||
_Color1 = color1;
|
||||
_Color2 = color2;
|
||||
|
||||
_BackFillType = fillType;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Color1
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the start color.
|
||||
/// </summary>
|
||||
[Description("Indicates the Starting Gradient Color.")]
|
||||
public Color Color1
|
||||
{
|
||||
get { return (_Color1); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Color1 != value)
|
||||
{
|
||||
_Color1 = value;
|
||||
|
||||
OnPropertyChangedEx("Color1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
internal virtual bool ShouldSerializeColor1()
|
||||
{
|
||||
return (_Color1.IsEmpty == false);
|
||||
}
|
||||
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
internal virtual void ResetColor1()
|
||||
{
|
||||
_Color1 = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Color2
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Ending Gradient Color
|
||||
/// </summary>
|
||||
[Description("Indicates the Ending Gradient Color")]
|
||||
public Color Color2
|
||||
{
|
||||
get { return (_Color2); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Color2 != value)
|
||||
{
|
||||
_Color2 = value;
|
||||
|
||||
OnPropertyChangedEx("Color2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
internal virtual bool ShouldSerializeColor2()
|
||||
{
|
||||
return (_Color2.IsEmpty == false);
|
||||
}
|
||||
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
internal virtual void ResetColor2()
|
||||
{
|
||||
_Color2 = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BackColorBlend
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the BackColorBlend.
|
||||
/// </summary>
|
||||
[Description("Indicates the BackColorBlend.")]
|
||||
public BackColorBlend BackColorBlend
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_BackColorBlend == null)
|
||||
{
|
||||
_BackColorBlend = new BackColorBlend();
|
||||
|
||||
UpgateChangeHandler(null, _BackColorBlend);
|
||||
}
|
||||
|
||||
return (_BackColorBlend);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_BackColorBlend != value)
|
||||
{
|
||||
UpgateChangeHandler(_BackColorBlend, value);
|
||||
|
||||
_BackColorBlend = value;
|
||||
|
||||
OnPropertyChangedEx("BackColorBlend");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
internal virtual bool ShouldSerializeBackColorBlend()
|
||||
{
|
||||
return (_BackColorBlend != null && _BackColorBlend.IsEmpty == false);
|
||||
}
|
||||
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
internal virtual void ResetBackColorBlend()
|
||||
{
|
||||
BackColorBlend = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GradientAngle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the gradient angle (default is 90)
|
||||
/// </summary>
|
||||
[DefaultValue(90)]
|
||||
[Description("Indicates the Gradient Angle default is 90)")]
|
||||
public int GradientAngle
|
||||
{
|
||||
get { return (_GradientAngle); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_GradientAngle != value)
|
||||
{
|
||||
_GradientAngle = value;
|
||||
|
||||
OnPropertyChangedEx("GradientAngle");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BackFillType
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Gradient BackFillType
|
||||
/// </summary>
|
||||
[DefaultValue(BackFillType.Angle)]
|
||||
[Description("Indicates the Gradient BackFillType.")]
|
||||
public BackFillType BackFillType
|
||||
{
|
||||
get { return (_BackFillType); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_BackFillType != value)
|
||||
{
|
||||
_BackFillType = value;
|
||||
|
||||
OnPropertyChangedEx("BackFillType");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether both colors assigned are empty.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Color1.IsEmpty && _Color2.IsEmpty &&
|
||||
(_BackColorBlend == null || _BackColorBlend.IsEmpty));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEqualTo
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the Background is equal to the given one
|
||||
/// </summary>
|
||||
/// <param name="background">Background to compare</param>
|
||||
/// <returns>true if equal</returns>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsEqualTo(Background background)
|
||||
{
|
||||
return (_Color1 == background.Color1 &&
|
||||
_Color2 == background.Color2 &&
|
||||
_BackColorBlend.Equals(background._BackColorBlend) &&
|
||||
_GradientAngle == background.GradientAngle &&
|
||||
_BackFillType == background.BackFillType);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetBrush
|
||||
|
||||
///<summary>
|
||||
/// GetBrush
|
||||
///</summary>
|
||||
///<param name="r"></param>
|
||||
///<returns></returns>
|
||||
public Brush GetBrush(Rectangle r)
|
||||
{
|
||||
if (_BackColorBlend != null && _BackColorBlend.IsEmpty == false)
|
||||
{
|
||||
if (_BackColorBlend.Colors.Length == 1)
|
||||
return (new SolidBrush(_BackColorBlend.Colors[0]));
|
||||
|
||||
Brush br = GetLinearBrush(r);
|
||||
|
||||
if (br is LinearGradientBrush)
|
||||
{
|
||||
ColorBlend cb = GetColorBlend();
|
||||
|
||||
if (cb != null)
|
||||
((LinearGradientBrush) br).InterpolationColors = cb;
|
||||
}
|
||||
|
||||
return (br);
|
||||
}
|
||||
|
||||
if (_Color2.IsEmpty == true)
|
||||
return (new SolidBrush(_Color1));
|
||||
|
||||
return (GetLinearBrush(r));
|
||||
}
|
||||
|
||||
#region GetLinearBrush
|
||||
|
||||
private Brush GetLinearBrush(Rectangle r)
|
||||
{
|
||||
LinearGradientBrush lbr = null;
|
||||
|
||||
if (r.Width > 0 && r.Height > 0)
|
||||
{
|
||||
switch (_BackFillType)
|
||||
{
|
||||
case BackFillType.Angle:
|
||||
lbr = new LinearGradientBrush(r, _Color1, _Color2, _GradientAngle);
|
||||
break;
|
||||
|
||||
case BackFillType.HorizontalCenter:
|
||||
r.Width /= 2;
|
||||
r.Width = Math.Max(1, r.Width);
|
||||
|
||||
lbr = new LinearGradientBrush(r, _Color1, _Color2, 0f);
|
||||
break;
|
||||
|
||||
case BackFillType.VerticalCenter:
|
||||
r.Height /= 2;
|
||||
r.Height = Math.Max(1, r.Height);
|
||||
|
||||
lbr = new LinearGradientBrush(r, _Color1, _Color2, 90f);
|
||||
break;
|
||||
|
||||
case BackFillType.ForwardDiagonal:
|
||||
lbr = new LinearGradientBrush(r, _Color1, _Color2, LinearGradientMode.ForwardDiagonal);
|
||||
break;
|
||||
|
||||
case BackFillType.BackwardDiagonal:
|
||||
lbr = new LinearGradientBrush(r, _Color1, _Color2, LinearGradientMode.BackwardDiagonal);
|
||||
break;
|
||||
|
||||
case BackFillType.ForwardDiagonalCenter:
|
||||
r.Width /= 2;
|
||||
r.Height /= 2;
|
||||
lbr = new LinearGradientBrush(r, _Color1, _Color2, LinearGradientMode.ForwardDiagonal);
|
||||
break;
|
||||
|
||||
case BackFillType.BackwardDiagonalCenter:
|
||||
r.Width /= 2;
|
||||
r.Height /= 2;
|
||||
r.X += r.Width;
|
||||
|
||||
lbr = new LinearGradientBrush(r, _Color1, _Color2, LinearGradientMode.BackwardDiagonal);
|
||||
break;
|
||||
|
||||
case BackFillType.Center:
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddRectangle(r);
|
||||
|
||||
PathGradientBrush pbr = new PathGradientBrush(path);
|
||||
|
||||
pbr.CenterColor = _Color1;
|
||||
pbr.SurroundColors = new Color[] {_Color2};
|
||||
|
||||
ColorBlend cb = GetColorBlend();
|
||||
|
||||
if (cb != null)
|
||||
pbr.InterpolationColors = cb;
|
||||
|
||||
return (pbr);
|
||||
}
|
||||
|
||||
case BackFillType.Radial:
|
||||
int n = (int) Math.Sqrt(r.Width*r.Width + r.Height*r.Height) + 4;
|
||||
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddEllipse(r.X - (n - r.Width)/2, r.Y - (n - r.Height)/2, n, n);
|
||||
|
||||
PathGradientBrush pbr = new PathGradientBrush(path);
|
||||
|
||||
pbr.CenterColor = _Color1;
|
||||
pbr.SurroundColors = new Color[] {_Color2};
|
||||
|
||||
ColorBlend cb = GetColorBlend();
|
||||
|
||||
if (cb != null)
|
||||
pbr.InterpolationColors = cb;
|
||||
|
||||
return (pbr);
|
||||
}
|
||||
}
|
||||
|
||||
if (lbr != null)
|
||||
lbr.WrapMode = WrapMode.TileFlipXY;
|
||||
}
|
||||
|
||||
return (lbr);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetColorBlend
|
||||
|
||||
private ColorBlend GetColorBlend()
|
||||
{
|
||||
if (_BackColorBlend != null &&
|
||||
_BackColorBlend.Colors != null && _BackColorBlend.Colors.Length > 0)
|
||||
{
|
||||
ColorBlend cb = new ColorBlend(_BackColorBlend.Colors.Length);
|
||||
|
||||
cb.Colors = _BackColorBlend.Colors;
|
||||
cb.Positions = GetPositions();
|
||||
|
||||
return (cb);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetPositions
|
||||
|
||||
private float[] GetPositions()
|
||||
{
|
||||
float[] cp = _BackColorBlend.Positions;
|
||||
|
||||
if (cp == null || cp.Length != _BackColorBlend.Colors.Length)
|
||||
{
|
||||
cp = new float[_BackColorBlend.Colors.Length];
|
||||
|
||||
float f = 1f / _BackColorBlend.Colors.Length;
|
||||
|
||||
for (int i = 0; i < cp.Length; i++)
|
||||
cp[i] = i * f;
|
||||
|
||||
cp[_BackColorBlend.Colors.Length - 1] = 1;
|
||||
}
|
||||
|
||||
return (cp);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Creates an exact copy of the background.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the background.</returns>
|
||||
public Background Copy()
|
||||
{
|
||||
Background copy = new Background();
|
||||
|
||||
copy.Color1 = _Color1;
|
||||
copy.Color2 = _Color2;
|
||||
|
||||
copy.GradientAngle = _GradientAngle;
|
||||
copy.BackFillType = _BackFillType;
|
||||
|
||||
if (_BackColorBlend != null)
|
||||
copy.BackColorBlend = _BackColorBlend.Copy();
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnPropertyChanged(VisualPropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="s">Event arguments</param>
|
||||
protected virtual void OnPropertyChangedEx(string s)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
{
|
||||
VisualPropertyChangedEventArgs e =
|
||||
new VisualPropertyChangedEventArgs(s);
|
||||
|
||||
eh(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UpgateChangeHandler
|
||||
|
||||
private void UpgateChangeHandler(
|
||||
INotifyPropertyChanged oldValue, INotifyPropertyChanged newValue)
|
||||
{
|
||||
if (oldValue != null)
|
||||
oldValue.PropertyChanged -= StyleChanged;
|
||||
|
||||
if (newValue != null)
|
||||
newValue.PropertyChanged += StyleChanged;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleChanged
|
||||
|
||||
/// <summary>
|
||||
/// StyleChanged
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected virtual void StyleChanged(
|
||||
object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged((VisualPropertyChangedEventArgs)e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
BackColorBlend = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region enums
|
||||
|
||||
///<summary>
|
||||
/// BackFillType
|
||||
///</summary>
|
||||
public enum BackFillType
|
||||
{
|
||||
///<summary>
|
||||
/// Angle
|
||||
///</summary>
|
||||
Angle,
|
||||
|
||||
///<summary>
|
||||
/// Center
|
||||
///</summary>
|
||||
Center,
|
||||
|
||||
///<summary>
|
||||
/// HorizontalCenter
|
||||
///</summary>
|
||||
HorizontalCenter,
|
||||
|
||||
///<summary>
|
||||
/// VerticalCenter
|
||||
///</summary>
|
||||
VerticalCenter,
|
||||
|
||||
///<summary>
|
||||
/// ForwardDiagonal
|
||||
///</summary>
|
||||
ForwardDiagonal,
|
||||
|
||||
///<summary>
|
||||
/// BackwardDiagonal
|
||||
///</summary>
|
||||
BackwardDiagonal,
|
||||
|
||||
///<summary>
|
||||
/// ForwardDiagonalCenter
|
||||
///</summary>
|
||||
ForwardDiagonalCenter,
|
||||
|
||||
///<summary>
|
||||
/// BackwardDiagonalCenter
|
||||
///</summary>
|
||||
BackwardDiagonalCenter,
|
||||
|
||||
///<summary>
|
||||
/// Radial
|
||||
///</summary>
|
||||
Radial,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BackgroundConvertor
|
||||
|
||||
///<summary>
|
||||
/// BackgroundConvertor
|
||||
///</summary>
|
||||
public class BackgroundConvertor : ExpandableObjectConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// ConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
{
|
||||
Background gc = value as Background;
|
||||
|
||||
if (gc != null)
|
||||
{
|
||||
if (gc.BackColorBlend != null && gc.BackColorBlend.IsEmpty == false)
|
||||
return ("Blended");
|
||||
|
||||
ColorConverter cvt = new ColorConverter();
|
||||
|
||||
string s = gc.Color1.IsEmpty ? "(Empty)" : cvt.ConvertToString(gc.Color1);
|
||||
|
||||
if (gc.Color2 != Color.Empty)
|
||||
s += ", " + cvt.ConvertToString(gc.Color2);
|
||||
|
||||
return (s);
|
||||
}
|
||||
}
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BackgroundEditor
|
||||
|
||||
///<summary>
|
||||
/// BackgroundEditor
|
||||
///</summary>
|
||||
public class BackgroundEditor : UITypeEditor
|
||||
{
|
||||
#region GetPaintValueSupported
|
||||
|
||||
/// <summary>
|
||||
/// GetPaintValueSupported
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public override bool GetPaintValueSupported(ITypeDescriptorContext context)
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PaintValue
|
||||
|
||||
/// <summary>
|
||||
/// PaintValue
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
public override void PaintValue(PaintValueEventArgs e)
|
||||
{
|
||||
Background b = e.Value as Background;
|
||||
|
||||
if (b != null)
|
||||
{
|
||||
using (Brush br = b.GetBrush(e.Bounds))
|
||||
e.Graphics.FillRectangle(br, e.Bounds);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
@@ -0,0 +1,414 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Row.
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(BlankExpandableObjectConverter))]
|
||||
public class BaseRowHeaderVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Static data
|
||||
|
||||
///<summary>
|
||||
/// Empty
|
||||
///</summary>
|
||||
public static BaseRowHeaderVisualStyle Empty
|
||||
{
|
||||
get { return (new BaseRowHeaderVisualStyle()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private Background _Background;
|
||||
private Color _BorderHighlightColor = Color.Empty;
|
||||
|
||||
private Font _Font;
|
||||
private Color _TextColor = Color.Empty;
|
||||
private Tbool _AllowWrap = Tbool.NotSet;
|
||||
private Alignment _TextAlignment = Alignment.NotSet;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region AllowWrap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether text wrapping is permitted
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("Appearance")]
|
||||
[Description("Indicates whether text wrapping is permitted.")]
|
||||
public Tbool AllowWrap
|
||||
{
|
||||
get { return (_AllowWrap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_AllowWrap != value)
|
||||
{
|
||||
_AllowWrap = value;
|
||||
|
||||
OnPropertyChangedEx("AllowWrap", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Background
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style background.
|
||||
/// </summary>
|
||||
[Description("Indicates whether the style background")]
|
||||
public Background Background
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Background == null)
|
||||
{
|
||||
_Background = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _Background);
|
||||
}
|
||||
|
||||
return (_Background);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Background != value)
|
||||
{
|
||||
UpdateChangeHandler(_Background, value);
|
||||
|
||||
_Background = value;
|
||||
|
||||
OnPropertyChangedEx("Background", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBackground()
|
||||
{
|
||||
return (_Background != null && _Background.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBackground()
|
||||
{
|
||||
Background = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BorderHighlightColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the border Highlight color.
|
||||
/// </summary>
|
||||
[Description("Indicates whether the border Highlight color")]
|
||||
public Color BorderHighlightColor
|
||||
{
|
||||
get { return (_BorderHighlightColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_BorderHighlightColor != value)
|
||||
{
|
||||
_BorderHighlightColor = value;
|
||||
|
||||
OnPropertyChangedEx("BorderHighlightColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBorderHighlightColor()
|
||||
{
|
||||
return (_BorderHighlightColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBorderHighlightColor()
|
||||
{
|
||||
_BorderHighlightColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Font
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style Font.
|
||||
/// </summary>
|
||||
[DefaultValue(null)]
|
||||
[Description("Indicates the RowHeader Font")]
|
||||
public Font Font
|
||||
{
|
||||
get { return (_Font); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Font != value)
|
||||
{
|
||||
_Font = value;
|
||||
|
||||
OnPropertyChangedEx("Font", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
///<summary>
|
||||
/// IsEmpty
|
||||
///</summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public override bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((_Background == null || _Background.IsEmpty) &&
|
||||
_BorderHighlightColor == Color.Empty &&
|
||||
_Font == null && TextColor == Color.Empty && base.IsEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextAlignment
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alignment of the header text
|
||||
/// </summary>
|
||||
[DefaultValue(Alignment.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the alignment of the header text.")]
|
||||
public Alignment TextAlignment
|
||||
{
|
||||
get { return (_TextAlignment); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_TextAlignment != value)
|
||||
{
|
||||
_TextAlignment = value;
|
||||
|
||||
OnPropertyChangedEx("TextAlignment", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Text color
|
||||
/// </summary>
|
||||
[Description("Indicates the Text color")]
|
||||
public Color TextColor
|
||||
{
|
||||
get { return (_TextColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_TextColor != value)
|
||||
{
|
||||
_TextColor = value;
|
||||
|
||||
OnPropertyChangedEx("TextColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeTextColor()
|
||||
{
|
||||
return (_TextColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetTextColor()
|
||||
{
|
||||
_TextColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetTextFormatFlags
|
||||
|
||||
internal eTextFormat GetTextFormatFlags()
|
||||
{
|
||||
eTextFormat tf = eTextFormat.WordEllipsis |
|
||||
eTextFormat.NoPadding | eTextFormat.NoPrefix;
|
||||
|
||||
if (AllowWrap == Tbool.True)
|
||||
tf |= eTextFormat.WordBreak;
|
||||
|
||||
switch (TextAlignment)
|
||||
{
|
||||
case Alignment.TopCenter:
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
tf |= eTextFormat.Right;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleLeft:
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.NotSet:
|
||||
case Alignment.MiddleCenter:
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleRight:
|
||||
tf |= eTextFormat.Right;
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.BottomLeft:
|
||||
tf |= eTextFormat.Bottom;
|
||||
break;
|
||||
|
||||
case Alignment.BottomCenter:
|
||||
tf |= eTextFormat.Bottom;
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.BottomRight:
|
||||
tf |= eTextFormat.Bottom;
|
||||
tf |= eTextFormat.Right;
|
||||
break;
|
||||
}
|
||||
|
||||
return (tf);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(BaseRowHeaderVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.Font != null)
|
||||
_Font = style.Font;
|
||||
|
||||
if (style.TextColor.IsEmpty == false)
|
||||
_TextColor = style._TextColor;
|
||||
|
||||
if (style.Background != null && style.Background.IsEmpty == false)
|
||||
Background = style.Background.Copy();
|
||||
|
||||
if (style.BorderHighlightColor.IsEmpty == false)
|
||||
BorderHighlightColor = style.BorderHighlightColor;
|
||||
|
||||
if (style.AllowWrap != Tbool.NotSet)
|
||||
_AllowWrap = style.AllowWrap;
|
||||
|
||||
if (style.TextAlignment != Alignment.NotSet)
|
||||
_TextAlignment = style.TextAlignment;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new BaseRowHeaderVisualStyle Copy()
|
||||
{
|
||||
BaseRowHeaderVisualStyle style = new BaseRowHeaderVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(BaseRowHeaderVisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
if (_Font != null)
|
||||
copy.Font = (Font)_Font.Clone();
|
||||
|
||||
if (_TextColor.IsEmpty == false)
|
||||
copy.TextColor = _TextColor;
|
||||
|
||||
copy.BorderHighlightColor = BorderHighlightColor;
|
||||
|
||||
if (_Background != null)
|
||||
copy.Background = _Background.Copy();
|
||||
|
||||
copy.TextAlignment = _TextAlignment;
|
||||
copy.AllowWrap = _AllowWrap;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
Background = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,451 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the base visual style.
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
public class BaseVisualStyle : INotifyPropertyChanged, IDisposable
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private string _Class = "";
|
||||
private object _Tag;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Class
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the class style belongs to.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Class
|
||||
{
|
||||
get { return (_Class); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Class != value)
|
||||
{
|
||||
_Class = value;
|
||||
|
||||
OnPropertyChangedEx("Class", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the style is logically Empty.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("Gets whether the style is logically Empty.")]
|
||||
public virtual bool IsEmpty
|
||||
{
|
||||
get { return (_Tag == null); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Tag
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user defined reference Tag.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("User defined reference Tag.")]
|
||||
public object Tag
|
||||
{
|
||||
get { return (_Tag); }
|
||||
set { _Tag = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(BaseVisualStyle style)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetApplyStyleTypes
|
||||
|
||||
internal StyleType[] GetApplyStyleTypes(StyleType e)
|
||||
{
|
||||
StyleType[] css = null;
|
||||
|
||||
switch (e)
|
||||
{
|
||||
case StyleType.Default:
|
||||
css = new StyleType[] { StyleType.Default};
|
||||
break;
|
||||
|
||||
case StyleType.Empty:
|
||||
case StyleType.MouseOver:
|
||||
case StyleType.ReadOnly:
|
||||
case StyleType.Selected:
|
||||
case StyleType.NotSelectable:
|
||||
css = new StyleType[] { StyleType.Default, e };
|
||||
break;
|
||||
|
||||
case StyleType.SelectedMouseOver:
|
||||
css = new StyleType[] { StyleType.Default, StyleType.Selected, e };
|
||||
break;
|
||||
|
||||
case StyleType.ReadOnlyMouseOver:
|
||||
css = new StyleType[] { StyleType.Default, StyleType.ReadOnly, e };
|
||||
break;
|
||||
|
||||
case StyleType.ReadOnlySelected:
|
||||
css = new StyleType[] { StyleType.Default, StyleType.Selected, StyleType.ReadOnly, e };
|
||||
break;
|
||||
|
||||
case StyleType.ReadOnlySelectedMouseOver:
|
||||
css = new StyleType[] { StyleType.Default, StyleType.Selected, StyleType.ReadOnly, StyleType.ReadOnlySelected, e };
|
||||
break;
|
||||
}
|
||||
|
||||
return (css);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public BaseVisualStyle Copy()
|
||||
{
|
||||
BaseVisualStyle style = new BaseVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(BaseVisualStyle copy)
|
||||
{
|
||||
copy.Class = _Class;
|
||||
copy.Tag = _Tag;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default PropertyChanged processing
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
protected void OnPropertyChanged(string s)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs(s));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default PropertyChanged processing
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <param name="changeType">invalidate</param>
|
||||
protected void OnPropertyChangedEx(string s, VisualChangeType changeType)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs(s, changeType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UpdateChangeHandler
|
||||
|
||||
/// <summary>
|
||||
/// UpdateChangeHandler
|
||||
/// </summary>
|
||||
/// <param name="oldValue"></param>
|
||||
/// <param name="newValue"></param>
|
||||
protected void UpdateChangeHandler(
|
||||
INotifyPropertyChanged oldValue, INotifyPropertyChanged newValue)
|
||||
{
|
||||
if (oldValue != null)
|
||||
oldValue.PropertyChanged -= ValuePropertyChanged;
|
||||
|
||||
if (newValue != null)
|
||||
newValue.PropertyChanged += ValuePropertyChanged;
|
||||
}
|
||||
|
||||
void ValuePropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public virtual void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region enums
|
||||
|
||||
#region Alignment
|
||||
|
||||
///<summary>
|
||||
/// Alignment of the content
|
||||
///</summary>
|
||||
public enum Alignment
|
||||
{
|
||||
///<summary>
|
||||
///</summary>
|
||||
NotSet = -1,
|
||||
|
||||
///<summary>
|
||||
/// TopLeft
|
||||
///</summary>
|
||||
TopLeft,
|
||||
|
||||
///<summary>
|
||||
/// TopCenter
|
||||
///</summary>
|
||||
TopCenter,
|
||||
|
||||
///<summary>
|
||||
/// TopRight
|
||||
///</summary>
|
||||
TopRight,
|
||||
|
||||
///<summary>
|
||||
/// MiddleLeft
|
||||
///</summary>
|
||||
MiddleLeft,
|
||||
|
||||
///<summary>
|
||||
/// MiddleCenter
|
||||
///</summary>
|
||||
MiddleCenter,
|
||||
|
||||
/// <summary>
|
||||
/// MiddleRight
|
||||
/// </summary>
|
||||
MiddleRight,
|
||||
|
||||
/// <summary>
|
||||
/// BottomLeft
|
||||
/// </summary>
|
||||
BottomLeft,
|
||||
|
||||
/// <summary>
|
||||
/// BottomCenter
|
||||
/// </summary>
|
||||
BottomCenter,
|
||||
|
||||
/// <summary>
|
||||
/// BottomRight
|
||||
/// </summary>
|
||||
BottomRight,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BorderSide
|
||||
|
||||
internal enum BorderSide
|
||||
{
|
||||
Top,
|
||||
Left,
|
||||
Bottom,
|
||||
Right
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellHighlightMode
|
||||
|
||||
///<summary>
|
||||
/// Specifies the mode of cell highlighting
|
||||
/// to employ when a grid cell is selected
|
||||
///</summary>
|
||||
public enum CellHighlightMode
|
||||
{
|
||||
///<summary>
|
||||
/// No highlighting
|
||||
///</summary>
|
||||
None,
|
||||
|
||||
///<summary>
|
||||
/// Entire cell will be Highlighted
|
||||
///</summary>
|
||||
Full,
|
||||
|
||||
///<summary>
|
||||
/// Partial cell will be Highlighted
|
||||
///</summary>
|
||||
Partial,
|
||||
|
||||
///<summary>
|
||||
/// Cell content only will be Highlighted
|
||||
///</summary>
|
||||
Content,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageHighlightMode
|
||||
|
||||
///<summary>
|
||||
/// ImageHighlightMode
|
||||
///</summary>
|
||||
public enum ImageHighlightMode
|
||||
{
|
||||
///<summary>
|
||||
/// NotSet
|
||||
///</summary>
|
||||
NotSet = -1,
|
||||
|
||||
///<summary>
|
||||
/// Default
|
||||
///</summary>
|
||||
Default,
|
||||
|
||||
///<summary>
|
||||
/// Always
|
||||
///</summary>
|
||||
Always,
|
||||
|
||||
///<summary>
|
||||
/// Never
|
||||
///</summary>
|
||||
Never,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageOverlay
|
||||
|
||||
///<summary>
|
||||
/// How to Overlay the Image with
|
||||
/// respect to the content
|
||||
///</summary>
|
||||
public enum ImageOverlay
|
||||
{
|
||||
///<summary>
|
||||
///</summary>
|
||||
NotSet = -1,
|
||||
|
||||
///<summary>
|
||||
/// None
|
||||
///</summary>
|
||||
None,
|
||||
|
||||
///<summary>
|
||||
/// Top
|
||||
///</summary>
|
||||
Top,
|
||||
|
||||
///<summary>
|
||||
/// Bottom
|
||||
///</summary>
|
||||
Bottom,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Tbool
|
||||
|
||||
///<summary>
|
||||
/// TBool - Three state boolean
|
||||
///</summary>
|
||||
public enum Tbool
|
||||
{
|
||||
///<summary>
|
||||
/// NotSet
|
||||
///</summary>
|
||||
NotSet,
|
||||
|
||||
///<summary>
|
||||
/// True
|
||||
///</summary>
|
||||
True,
|
||||
|
||||
///<summary>
|
||||
/// False
|
||||
///</summary>
|
||||
False
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region VisualChangeType
|
||||
|
||||
/// <summary>
|
||||
/// Defines visual property change type.
|
||||
/// </summary>
|
||||
public enum VisualChangeType
|
||||
{
|
||||
/// <summary>
|
||||
/// Visual style has changed so layout is impacted
|
||||
/// </summary>
|
||||
Layout,
|
||||
|
||||
/// <summary>
|
||||
/// Visual style has changed so visuals are impacted, but not layout
|
||||
/// </summary>
|
||||
Render
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
@@ -0,0 +1,460 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents style border color.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(BorderColorConverter))]
|
||||
public class BorderColor : INotifyPropertyChanged
|
||||
{
|
||||
#region Static data
|
||||
|
||||
///<summary>
|
||||
/// Empty
|
||||
///</summary>
|
||||
/// <summary>
|
||||
/// Returns Empty instance of BorderColor.
|
||||
/// </summary>
|
||||
public static BorderColor Empty
|
||||
{
|
||||
get { return (new BorderColor()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private Color _Top = Color.Empty;
|
||||
private Color _Left = Color.Empty;
|
||||
private Color _Bottom = Color.Empty;
|
||||
private Color _Right = Color.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BorderColor object.
|
||||
/// </summary>
|
||||
/// <param name="left"></param>
|
||||
/// <param name="top"></param>
|
||||
/// <param name="right"></param>
|
||||
/// <param name="bottom"></param>
|
||||
public BorderColor(Color left, Color top, Color right, Color bottom)
|
||||
{
|
||||
_Top = top;
|
||||
_Bottom = bottom;
|
||||
_Left = left;
|
||||
_Right = right;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BorderColor object.
|
||||
/// </summary>
|
||||
public BorderColor(Color all)
|
||||
: this(all, all, all, all)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BorderColor object.
|
||||
/// </summary>
|
||||
public BorderColor()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region All
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of all borders.
|
||||
/// </summary>
|
||||
//[Browsable(false)]
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public Color All
|
||||
{
|
||||
set { _Top = _Left = _Bottom = _Right = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Bottom
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the bottom border
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the color of the bottom border")]
|
||||
public Color Bottom
|
||||
{
|
||||
get { return (_Bottom); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Bottom != value)
|
||||
{
|
||||
_Bottom = value;
|
||||
|
||||
OnVisualPropertyChanged("Bottom");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeBottom()
|
||||
{
|
||||
return (_Bottom.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void ResetBottom()
|
||||
{
|
||||
_Bottom = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Left
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the left border
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the color of the left border")]
|
||||
public Color Left
|
||||
{
|
||||
get { return (_Left); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Left != value)
|
||||
{
|
||||
_Left = value;
|
||||
|
||||
OnVisualPropertyChanged("Left");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeLeft()
|
||||
{
|
||||
return (_Left.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void ResetLeft()
|
||||
{
|
||||
_Left = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Right
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the right border
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the color of the right border")]
|
||||
public Color Right
|
||||
{
|
||||
get { return (_Right); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Right != value)
|
||||
{
|
||||
_Right = value;
|
||||
|
||||
OnVisualPropertyChanged("Right");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeRight()
|
||||
{
|
||||
return (_Right.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void ResetRight()
|
||||
{
|
||||
_Right = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Top
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the top border
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the color of the top border")]
|
||||
public Color Top
|
||||
{
|
||||
get { return (_Top); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Top != value)
|
||||
{
|
||||
_Top = value;
|
||||
|
||||
OnVisualPropertyChanged("Top");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeTop()
|
||||
{
|
||||
return (_Top.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void ResetTop()
|
||||
{
|
||||
_Top = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
internal bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left.IsEmpty && _Top.IsEmpty &&
|
||||
_Right.IsEmpty && _Bottom.IsEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsUniform
|
||||
|
||||
internal bool IsUniform
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left == _Top &&
|
||||
_Left == _Right && _Left == _Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
|
||||
#region '==' operator
|
||||
|
||||
/// <summary>
|
||||
/// Compares two instances.
|
||||
/// </summary>
|
||||
/// <param name="t1">Instance 1</param>
|
||||
/// <param name="t2">Instance 2</param>
|
||||
/// <returns>true if same</returns>
|
||||
public static bool operator ==(BorderColor t1, BorderColor t2)
|
||||
{
|
||||
// If both are null, or both are same instance, return true.
|
||||
|
||||
if (ReferenceEquals(t1, t2))
|
||||
return (true);
|
||||
|
||||
// If one is null, but not both, return false.
|
||||
|
||||
if (((object)t1 == null) || ((object)t2 == null))
|
||||
return (false);
|
||||
|
||||
return (t1._Left == t2._Left && t1._Right == t2._Right &&
|
||||
t1._Top == t2._Top && t1._Bottom == t2._Bottom);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "!=" operator
|
||||
|
||||
/// <summary>
|
||||
/// Compares two instances.
|
||||
/// </summary>
|
||||
/// <param name="t1">Instance 1</param>
|
||||
/// <param name="t2">Instance 2</param>
|
||||
/// <returns>true if different.</returns>
|
||||
public static bool operator !=(BorderColor t1, BorderColor t2)
|
||||
{
|
||||
return ((t1 == t2) == false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
|
||||
/// <summary>
|
||||
/// Returns hash-code for object.
|
||||
/// </summary>
|
||||
/// <returns>Hash-code value.</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (((_Left.GetHashCode() ^ _Top.GetHashCode()) ^
|
||||
_Right.GetHashCode()) ^ _Bottom.GetHashCode());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Equals
|
||||
|
||||
/// <summary>
|
||||
/// Compares object to this instance.
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to compare.</param>
|
||||
/// <returns>true if same.</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is BorderColor)
|
||||
return ((BorderColor) obj == this);
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares object to this instance.
|
||||
/// </summary>
|
||||
/// <param name="borderColor">Border color</param>
|
||||
/// <returns>true if same</returns>
|
||||
public bool Equals(BorderColor borderColor)
|
||||
{
|
||||
return (this == borderColor);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Creates an exact copy of the BorderColor.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the BorderColor.</returns>
|
||||
public BorderColor Copy()
|
||||
{
|
||||
BorderColor copy = new BorderColor(_Left, _Top, _Right, _Bottom);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default PropertyChanged processing
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
protected void OnPropertyChanged(string s)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(s));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Default PropertyChanged processing
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
protected void OnVisualPropertyChanged(string s)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs(s));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region BorderColorConverter
|
||||
|
||||
/// <summary>
|
||||
/// BorderColorConverter
|
||||
/// </summary>
|
||||
public class BorderColorConverter : ExpandableObjectConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// ConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
return (String.Empty);
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
@@ -0,0 +1,418 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines Thickness class.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(BlankExpandableObjectConverter))]
|
||||
public class BorderPattern : IEquatable<BorderPattern>, INotifyPropertyChanged
|
||||
{
|
||||
#region Static data
|
||||
|
||||
/// <summary>
|
||||
/// Returns Empty instance of BorderPattern.
|
||||
/// </summary>
|
||||
public static BorderPattern Empty
|
||||
{
|
||||
get { return (new BorderPattern()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private LinePattern _Bottom = LinePattern.NotSet;
|
||||
private LinePattern _Left = LinePattern.NotSet;
|
||||
private LinePattern _Right = LinePattern.NotSet;
|
||||
private LinePattern _Top = LinePattern.NotSet;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="left">Left BorderPatternStyle.</param>
|
||||
/// <param name="top">Top BorderPatternStyle.</param>
|
||||
/// <param name="right">Right BorderPatternStyle.</param>
|
||||
/// <param name="bottom">Bottom BorderPatternStyle.</param>
|
||||
public BorderPattern(LinePattern left,
|
||||
LinePattern top, LinePattern right, LinePattern bottom)
|
||||
{
|
||||
_Left = left;
|
||||
_Top = top;
|
||||
_Right = right;
|
||||
_Bottom = bottom;
|
||||
|
||||
PropertyChanged = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="all">Specifies uniform Thickness.</param>
|
||||
public BorderPattern(LinePattern all)
|
||||
: this(all, all, all, all)
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Creates new instance of the object.
|
||||
///</summary>
|
||||
public BorderPattern()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region All
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the thickness of all sides.
|
||||
/// </summary>
|
||||
//[Browsable(false)]
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public LinePattern All
|
||||
{
|
||||
set { _Top = _Left = _Bottom = _Right = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Bottom
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the bottom Border Pattern
|
||||
/// </summary>
|
||||
[DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the bottom Border Pattern")]
|
||||
public LinePattern Bottom
|
||||
{
|
||||
get { return (_Bottom); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Bottom != value)
|
||||
{
|
||||
_Bottom = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Bottom"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Left
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the left Border Pattern
|
||||
/// </summary>
|
||||
[DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the left Border Pattern")]
|
||||
public LinePattern Left
|
||||
{
|
||||
get { return (_Left); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Left != value)
|
||||
{
|
||||
_Left = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Left"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Right
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Right Border Pattern
|
||||
/// </summary>
|
||||
[DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the Right Border Pattern")]
|
||||
public LinePattern Right
|
||||
{
|
||||
get { return (_Right); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Right != value)
|
||||
{
|
||||
_Right = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Right"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Top
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Top Border Pattern
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the Top Border Pattern")]
|
||||
public LinePattern Top
|
||||
{
|
||||
get { return (_Top); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Top != value)
|
||||
{
|
||||
_Top = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Top"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the item is empty
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left == LinePattern.NotSet &&
|
||||
_Right == LinePattern.NotSet &&
|
||||
_Top == LinePattern.NotSet &&
|
||||
_Bottom == LinePattern.NotSet);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region IsUniform
|
||||
|
||||
internal bool IsUniform
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left == _Top &&
|
||||
_Left == _Right && _Left == _Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Equals
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether two instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="obj">Instance to compare to.</param>
|
||||
/// <returns>true if equal otherwise false.</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is BorderPattern)
|
||||
return (this == (BorderPattern)obj);
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether two instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="borderPattern">Instance to compare to</param>
|
||||
/// <returns>true if equal otherwise false</returns>
|
||||
public bool Equals(BorderPattern borderPattern)
|
||||
{
|
||||
return (this == borderPattern);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
|
||||
/// <summary>
|
||||
/// Returns hash-code.
|
||||
/// </summary>
|
||||
/// <returns>hash-code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (((_Left.GetHashCode() ^ _Top.GetHashCode()) ^
|
||||
_Right.GetHashCode()) ^ _Bottom.GetHashCode());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
|
||||
#region "==" operator
|
||||
|
||||
/// <summary>
|
||||
/// Implements == operator.
|
||||
/// </summary>
|
||||
/// <param name="t1">Object 1</param>
|
||||
/// <param name="t2">Object 2</param>
|
||||
/// <returns>true if equals</returns>
|
||||
public static bool operator ==(BorderPattern t1, BorderPattern t2)
|
||||
{
|
||||
if (ReferenceEquals(t1, t2))
|
||||
return (true);
|
||||
|
||||
if (((object)t1 == null) || ((object)t2 == null))
|
||||
return (false);
|
||||
|
||||
return (t1._Left == t2._Left && t1._Right == t2._Right &&
|
||||
t1._Top == t2._Top && t1._Bottom == t2._Bottom);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "!=" operator
|
||||
|
||||
/// <summary>
|
||||
/// Implements != operator
|
||||
/// </summary>
|
||||
/// <param name="t1">Object 1</param>
|
||||
/// <param name="t2">Object 2</param>
|
||||
/// <returns>true if different</returns>
|
||||
public static bool operator !=(BorderPattern t1, BorderPattern t2)
|
||||
{
|
||||
return ((t1 == t2) == false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyPattern
|
||||
|
||||
/// <summary>
|
||||
/// Applies the pattern to instance of this pattern.
|
||||
/// </summary>
|
||||
/// <param name="pattern">Pattern to apply.</param>
|
||||
public void ApplyPattern(BorderPattern pattern)
|
||||
{
|
||||
if (pattern != null)
|
||||
{
|
||||
if (pattern.Top != LinePattern.NotSet)
|
||||
_Top = pattern.Top;
|
||||
|
||||
if (pattern.Left != LinePattern.NotSet)
|
||||
_Left = pattern.Left;
|
||||
|
||||
if (pattern.Bottom != LinePattern.NotSet)
|
||||
_Bottom = pattern.Bottom;
|
||||
|
||||
if (pattern.Right != LinePattern.NotSet)
|
||||
_Right = pattern.Right;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Creates an exact copy of the BorderPattern.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the BorderPattern.</returns>
|
||||
public BorderPattern Copy()
|
||||
{
|
||||
BorderPattern copy = new BorderPattern(_Left, _Top, _Right, _Bottom);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
void OnPropertyChanged(VisualPropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region enums
|
||||
|
||||
#region LinePattern
|
||||
|
||||
///<summary>
|
||||
/// LinePattern
|
||||
///</summary>
|
||||
public enum LinePattern
|
||||
{
|
||||
///<summary>
|
||||
/// None
|
||||
///</summary>
|
||||
None = -2,
|
||||
|
||||
///<summary>
|
||||
/// NotSet
|
||||
///</summary>
|
||||
NotSet = -1,
|
||||
|
||||
///<summary>
|
||||
/// Solid
|
||||
///</summary>
|
||||
Solid = DashStyle.Solid,
|
||||
|
||||
///<summary>
|
||||
/// Dash
|
||||
///</summary>
|
||||
Dash = DashStyle.Dash,
|
||||
|
||||
///<summary>
|
||||
/// Dot
|
||||
///</summary>
|
||||
Dot = DashStyle.Dot,
|
||||
|
||||
///<summary>
|
||||
/// DashDot
|
||||
///</summary>
|
||||
DashDot = DashStyle.DashDot,
|
||||
|
||||
///<summary>
|
||||
/// DashDotDot
|
||||
///</summary>
|
||||
DashDotDot = DashStyle.DashDotDot,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
@@ -0,0 +1,898 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Primitives;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// CellVisualStyles
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class CellVisualStyles : VisualStyles<CellVisualStyle>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the visual style of an element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class CellVisualStyle : VisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Tbool _AllowWrap = Tbool.NotSet;
|
||||
private Tbool _AllowMultiLine = Tbool.NotSet;
|
||||
private Alignment _Alignment = Alignment.NotSet;
|
||||
|
||||
private Image _Image;
|
||||
private int _ImageIndex = -1;
|
||||
private Padding _ImagePadding;
|
||||
private Alignment _ImageAlignment = Alignment.NotSet;
|
||||
private ImageHighlightMode _ImageHighlightMode = ImageHighlightMode.NotSet;
|
||||
private ImageOverlay _ImageOverlay = ImageOverlay.NotSet;
|
||||
|
||||
private SymbolDef _SymbolDef;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Alignment
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alignment of the content within the cell
|
||||
/// </summary>
|
||||
[DefaultValue(Alignment.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the alignment of the content within the cell.")]
|
||||
public Alignment Alignment
|
||||
{
|
||||
get { return (_Alignment); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Alignment != value)
|
||||
{
|
||||
_Alignment = value;
|
||||
|
||||
OnPropertyChangedEx("Alignment", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AllowMultiLine
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether multiple text lines (via "\r\n" inclusion)
|
||||
/// are displayed when text wrapping (AllowWrap) is disabled.
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("Appearance")]
|
||||
[Description("Indicates whether multiple text lines (via '\r\n' inclusion) are displayed when text wrapping (AllowWrap) is disabled.")]
|
||||
public Tbool AllowMultiLine
|
||||
{
|
||||
get { return (_AllowMultiLine); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_AllowMultiLine != value)
|
||||
{
|
||||
_AllowMultiLine = value;
|
||||
|
||||
OnPropertyChangedEx("AllowMultiLine", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AllowWrap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether text wrapping is permitted
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("Appearance")]
|
||||
[Description("Indicates whether text wrapping is permitted.")]
|
||||
public Tbool AllowWrap
|
||||
{
|
||||
get { return (_AllowWrap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_AllowWrap != value)
|
||||
{
|
||||
_AllowWrap = value;
|
||||
|
||||
OnPropertyChangedEx("AllowWrap", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Image
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the element Image
|
||||
/// </summary>
|
||||
[DefaultValue(null), Category("Appearance")]
|
||||
[Description("Indicates the element image")]
|
||||
public Image Image
|
||||
{
|
||||
get { return (_Image); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Image != value)
|
||||
{
|
||||
_Image = value;
|
||||
|
||||
OnPropertyChangedEx("Image", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageAlignment
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alignment of the Image within the cell
|
||||
/// </summary>
|
||||
[DefaultValue(Alignment.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the alignment of the Image within the cell.")]
|
||||
public Alignment ImageAlignment
|
||||
{
|
||||
get { return (_ImageAlignment); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ImageAlignment != value)
|
||||
{
|
||||
_ImageAlignment = value;
|
||||
|
||||
OnPropertyChangedEx("ImageAlignment", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageHighlightMode
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets how cell images are
|
||||
/// highlighted when the cell is selected
|
||||
/// </summary>
|
||||
[DefaultValue(ImageHighlightMode.NotSet), Category("Style")]
|
||||
[Description("Indicates how cell images are highlighted when the cell is selected")]
|
||||
public ImageHighlightMode ImageHighlightMode
|
||||
{
|
||||
get { return (_ImageHighlightMode); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ImageHighlightMode)
|
||||
{
|
||||
_ImageHighlightMode = value;
|
||||
|
||||
OnPropertyChangedEx("ImageHighlightMode", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageIndex
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the image index
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(-1)]
|
||||
[Category("Appearance"), Description("Indicates the image index")]
|
||||
[Editor("DevComponents.SuperGrid.Design.ImageIndexEditor, DevComponents.SuperGrid.Design, Version=14.1.0.37, Culture=neutral, PublicKeyToken=26d81176cfa2b486", typeof(UITypeEditor))]
|
||||
[TypeConverter(typeof(ImageIndexConverter))]
|
||||
public int ImageIndex
|
||||
{
|
||||
get { return (_ImageIndex); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ImageIndex != value)
|
||||
{
|
||||
_ImageIndex = value;
|
||||
|
||||
OnPropertyChangedEx("ImageIndex", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetImageIndex()
|
||||
{
|
||||
ImageIndex = -1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageOverlay
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets how to overlay the cell image with respect to cell content
|
||||
/// </summary>
|
||||
[DefaultValue(ImageOverlay.NotSet), Category("Appearance")]
|
||||
[Description("Indicates how to overlay the cell image with respect to cell content.")]
|
||||
public ImageOverlay ImageOverlay
|
||||
{
|
||||
get { return (_ImageOverlay); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ImageOverlay != value)
|
||||
{
|
||||
_ImageOverlay = value;
|
||||
|
||||
OnPropertyChangedEx("ImageOverlay", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImagePadding
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the spacing between content and edges of the Image
|
||||
/// </summary>
|
||||
[Description("Indicates the spacing between content and edges of the Image")]
|
||||
public Padding ImagePadding
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ImagePadding == null)
|
||||
{
|
||||
_ImagePadding = Padding.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _ImagePadding);
|
||||
}
|
||||
|
||||
return (_ImagePadding);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_ImagePadding != value)
|
||||
{
|
||||
UpdateChangeHandler(_ImagePadding, value);
|
||||
|
||||
_ImagePadding = value;
|
||||
|
||||
OnPropertyChangedEx("ImagePadding", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeImagePadding()
|
||||
{
|
||||
return (_ImagePadding != null && _ImagePadding.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetImagePadding()
|
||||
{
|
||||
ImagePadding = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SymbolDef
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the element Symbol Definition. Note that
|
||||
/// Symbol definition takes precedence over Image definition.
|
||||
/// </summary>
|
||||
[DefaultValue(null), Category("Appearance")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
[Description("Indicates the element Symbol Definition. Note that Symbol definition takes precedence over Image definition.")]
|
||||
public SymbolDef SymbolDef
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_SymbolDef == null)
|
||||
{
|
||||
_SymbolDef = new SymbolDef();
|
||||
|
||||
UpdateChangeHandler(null, _SymbolDef);
|
||||
}
|
||||
|
||||
return (_SymbolDef);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_SymbolDef != value)
|
||||
{
|
||||
UpdateChangeHandler(_SymbolDef, value);
|
||||
|
||||
_SymbolDef = value;
|
||||
|
||||
OnPropertyChangedEx("SymbolDef", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeSymbolDef()
|
||||
{
|
||||
return (_SymbolDef != null && _SymbolDef.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetSymbolDef()
|
||||
{
|
||||
SymbolDef = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the style is logically Empty.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("Gets whether the style is logically Empty.")]
|
||||
public override bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((_Alignment == Alignment.NotSet) &&
|
||||
(_AllowWrap == Tbool.NotSet) &&
|
||||
(_Image == null) &&
|
||||
(_ImageAlignment == Alignment.NotSet) &&
|
||||
(_ImageHighlightMode == ImageHighlightMode.NotSet) &&
|
||||
(_ImageIndex == -1) &&
|
||||
(_ImageOverlay == ImageOverlay.NotSet) &&
|
||||
(_ImagePadding == null || _ImagePadding.IsEmpty == true) &&
|
||||
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region IsOverlayImage
|
||||
|
||||
internal bool IsOverlayImage
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_ImageOverlay == ImageOverlay.Top ||
|
||||
_ImageOverlay == ImageOverlay.Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsSymbolFigure
|
||||
|
||||
internal bool IsSymbolFigure
|
||||
{
|
||||
get { return (_SymbolDef != null && _SymbolDef.IsValidSymbol == true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(CellVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.Alignment != Alignment.NotSet)
|
||||
_Alignment = style.Alignment;
|
||||
|
||||
if (style.AllowWrap != Tbool.NotSet)
|
||||
_AllowWrap = style.AllowWrap;
|
||||
|
||||
if (style.AllowMultiLine != Tbool.NotSet)
|
||||
_AllowMultiLine = style.AllowMultiLine;
|
||||
|
||||
if (style.ImageIndex >= 0)
|
||||
{
|
||||
_Image = null;
|
||||
_ImageIndex = style.ImageIndex;
|
||||
}
|
||||
|
||||
if (style.Image != null)
|
||||
{
|
||||
_Image = style.Image;
|
||||
_ImageIndex = -1;
|
||||
}
|
||||
|
||||
if (style.ImageAlignment != Alignment.NotSet)
|
||||
_ImageAlignment = style.ImageAlignment;
|
||||
|
||||
if (style.ImageHighlightMode != ImageHighlightMode.NotSet)
|
||||
_ImageHighlightMode = style.ImageHighlightMode;
|
||||
|
||||
if (style._ImagePadding != null && style._ImagePadding.IsEmpty == false)
|
||||
_ImagePadding = style._ImagePadding.Copy();
|
||||
|
||||
if (style.ImageOverlay != ImageOverlay.NotSet)
|
||||
_ImageOverlay = style.ImageOverlay;
|
||||
|
||||
if (style._SymbolDef != null && style._SymbolDef.IsEmpty == false)
|
||||
_SymbolDef = style._SymbolDef.Copy();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
internal void ApplyDefaults()
|
||||
{
|
||||
if (_SymbolDef != null && _SymbolDef.IsValidSymbol == true)
|
||||
{
|
||||
if (_SymbolDef.SymbolSize == 0)
|
||||
{
|
||||
if (Font != null)
|
||||
_SymbolDef.SymbolSize = Font.SizeInPoints;
|
||||
}
|
||||
|
||||
if (_SymbolDef.SymbolColor.IsEmpty == true)
|
||||
{
|
||||
_SymbolDef.SymbolColor =
|
||||
(TextColor.IsEmpty == false) ? TextColor : Color.Black;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetTextFormatFlags
|
||||
|
||||
internal virtual eTextFormat GetTextFormatFlags()
|
||||
{
|
||||
eTextFormat tf = eTextFormat.WordEllipsis |
|
||||
eTextFormat.NoPadding | eTextFormat.NoPrefix;
|
||||
|
||||
if (AllowWrap == Tbool.True)
|
||||
{
|
||||
tf |= eTextFormat.WordBreak;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AllowMultiLine != Tbool.True)
|
||||
tf |= eTextFormat.SingleLine;
|
||||
}
|
||||
|
||||
switch (Alignment)
|
||||
{
|
||||
case Alignment.TopCenter:
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
tf |= eTextFormat.Right;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleLeft:
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleCenter:
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleRight:
|
||||
tf |= eTextFormat.Right;
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.BottomLeft:
|
||||
tf |= eTextFormat.Bottom;
|
||||
break;
|
||||
|
||||
case Alignment.BottomCenter:
|
||||
tf |= eTextFormat.Bottom;
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.BottomRight:
|
||||
tf |= eTextFormat.Bottom;
|
||||
tf |= eTextFormat.Right;
|
||||
break;
|
||||
}
|
||||
|
||||
return (tf);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsValidFigure
|
||||
|
||||
internal bool IsValidFigure(GridPanel panel)
|
||||
{
|
||||
if (IsSymbolFigure == true)
|
||||
return (true);
|
||||
|
||||
return (GetImage(panel) != null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetFigure
|
||||
|
||||
internal object GetFigure(GridPanel panel)
|
||||
{
|
||||
if (_SymbolDef != null && _SymbolDef.IsEmpty == false)
|
||||
return (_SymbolDef);
|
||||
|
||||
return (GetImage(panel));
|
||||
}
|
||||
|
||||
#region GetImage
|
||||
|
||||
private Image GetImage(GridPanel panel)
|
||||
{
|
||||
if (_Image != null)
|
||||
return (_Image);
|
||||
|
||||
if (_ImageIndex >= 0 && panel != null)
|
||||
{
|
||||
ImageList imageList = panel.ImageList;
|
||||
|
||||
if (imageList != null && _ImageIndex < imageList.Images.Count)
|
||||
return (imageList.Images[_ImageIndex]);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSymbol
|
||||
|
||||
private string GetSymbol()
|
||||
{
|
||||
if (_SymbolDef != null && _SymbolDef.IsEmpty == false)
|
||||
return (_SymbolDef.SymbolRealized);
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetFigureSize
|
||||
|
||||
internal Size GetFigureSize(GridPanel panel)
|
||||
{
|
||||
Size size = GetFigureSizeEx(panel);
|
||||
|
||||
if (size.IsEmpty == false)
|
||||
{
|
||||
size.Width += Dpi.Width(ImagePadding.Horizontal);
|
||||
size.Height += Dpi.Height(ImagePadding.Vertical);
|
||||
}
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
internal Size GetFigureSizeEx(GridPanel panel)
|
||||
{
|
||||
Size size = Size.Empty;
|
||||
|
||||
if (IsSymbolFigure == true)
|
||||
{
|
||||
size = _SymbolDef.GetSymbolSize(panel.SuperGrid);
|
||||
}
|
||||
else
|
||||
{
|
||||
Image image = GetImage(panel);
|
||||
|
||||
if (image != null)
|
||||
size = Dpi.Size(image.Size);
|
||||
}
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetFigureBounds
|
||||
|
||||
internal Rectangle GetFigureBounds(GridPanel panel, Rectangle r)
|
||||
{
|
||||
Size size = GetFigureSize(panel);
|
||||
|
||||
return (GetSizeBounds(panel, r, size));
|
||||
}
|
||||
|
||||
#region GetSizeBounds
|
||||
|
||||
private Rectangle GetSizeBounds(GridPanel panel, Rectangle r, Size size)
|
||||
{
|
||||
bool overlay = IsOverlayImage;
|
||||
|
||||
switch (ImageAlignment)
|
||||
{
|
||||
case Alignment.TopLeft:
|
||||
if (overlay == false)
|
||||
r.X -= size.Width;
|
||||
break;
|
||||
|
||||
case Alignment.NotSet:
|
||||
case Alignment.MiddleLeft:
|
||||
if (overlay == false)
|
||||
r.X -= size.Width;
|
||||
|
||||
r.Y += (r.Height - size.Height) / 2;
|
||||
break;
|
||||
|
||||
case Alignment.BottomLeft:
|
||||
if (overlay == false)
|
||||
r.X -= size.Width;
|
||||
|
||||
r.Y = r.Bottom - size.Height;
|
||||
break;
|
||||
|
||||
case Alignment.TopCenter:
|
||||
r.X += (r.Width - size.Width) / 2;
|
||||
|
||||
if (overlay == false)
|
||||
r.Y -= size.Height;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleCenter:
|
||||
r.X += (r.Width - size.Width) / 2;
|
||||
r.Y += (r.Height - size.Height) / 2;
|
||||
break;
|
||||
|
||||
case Alignment.BottomCenter:
|
||||
r.X += (r.Width - size.Width) / 2;
|
||||
r.Y = r.Bottom;
|
||||
|
||||
if (overlay == true)
|
||||
r.Y -= size.Height;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
r.X = r.Right;
|
||||
|
||||
if (overlay == true)
|
||||
r.X -= size.Width;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleRight:
|
||||
r.X = r.Right;
|
||||
|
||||
if (overlay == true)
|
||||
r.X -= size.Width;
|
||||
|
||||
r.Y += (r.Height - size.Height) / 2;
|
||||
|
||||
break;
|
||||
|
||||
case Alignment.BottomRight:
|
||||
r.X = r.Right;
|
||||
r.Y = r.Bottom - size.Height;
|
||||
|
||||
if (overlay == true)
|
||||
r.X -= size.Width;
|
||||
break;
|
||||
}
|
||||
|
||||
r.Size = GetFigureSizeEx(panel);
|
||||
|
||||
r.X += ImagePadding.Left;
|
||||
r.Y += ImagePadding.Top;
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetNonFigureBounds
|
||||
|
||||
internal Rectangle GetNonFigureBounds(GridPanel panel, Rectangle r)
|
||||
{
|
||||
object figure = GetFigure(panel);
|
||||
|
||||
if (figure != null)
|
||||
{
|
||||
if (IsOverlayImage == false)
|
||||
{
|
||||
Size size = GetFigureSize(panel);
|
||||
|
||||
switch (ImageAlignment)
|
||||
{
|
||||
case Alignment.TopCenter:
|
||||
r.Y += size.Height;
|
||||
r.Height -= size.Height;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleCenter:
|
||||
break;
|
||||
|
||||
case Alignment.BottomCenter:
|
||||
r.Height -= size.Height;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
case Alignment.MiddleRight:
|
||||
case Alignment.BottomRight:
|
||||
r.Width -= size.Width;
|
||||
break;
|
||||
|
||||
default:
|
||||
r.X += size.Width;
|
||||
r.Width -= size.Width;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RenderFigure
|
||||
|
||||
internal void RenderFigure(Graphics g, GridPanel panel, Rectangle r)
|
||||
{
|
||||
RenderFigure(g, GetFigure(panel), r);
|
||||
}
|
||||
|
||||
internal void RenderFigure(Graphics g, object figure, Rectangle r)
|
||||
{
|
||||
if (r.Width > 0 && r.Height > 0)
|
||||
{
|
||||
if (figure is Image)
|
||||
{
|
||||
g.DrawImageUnscaledAndClipped((Image)figure, r);
|
||||
}
|
||||
else if (figure is SymbolDef)
|
||||
{
|
||||
SymbolDef sd = (SymbolDef)figure;
|
||||
|
||||
using (Brush br = new SolidBrush(sd.SymbolColor))
|
||||
g.DrawString(sd.SymbolRealized, sd.SymbolFont, br, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new CellVisualStyle Copy()
|
||||
{
|
||||
CellVisualStyle style = new CellVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(CellVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.Alignment = _Alignment;
|
||||
style.AllowWrap = _AllowWrap;
|
||||
style.AllowMultiLine = _AllowMultiLine;
|
||||
|
||||
style.Image = _Image;
|
||||
style.ImageAlignment = _ImageAlignment;
|
||||
style.ImageHighlightMode = _ImageHighlightMode;
|
||||
style.ImageIndex = _ImageIndex;
|
||||
style.ImageOverlay = _ImageOverlay;
|
||||
style.ImagePadding = (_ImagePadding != null) ? _ImagePadding.Copy() : null;
|
||||
|
||||
style.SymbolDef = (_SymbolDef != null) ? _SymbolDef.Copy() : null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
ImagePadding = null;
|
||||
SymbolDef = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region VisualPropertyChangedEventArgs
|
||||
|
||||
/// <summary>
|
||||
/// Represents visual property changed event arguments.
|
||||
/// </summary>
|
||||
public class VisualPropertyChangedEventArgs : PropertyChangedEventArgs
|
||||
{
|
||||
#region Public data
|
||||
|
||||
/// <summary>
|
||||
/// Gets the change type.
|
||||
/// </summary>
|
||||
public readonly VisualChangeType ChangeType;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the VisualPropertyChangedEventArgs class.
|
||||
/// </summary>
|
||||
public VisualPropertyChangedEventArgs(string propertyName)
|
||||
: base(propertyName)
|
||||
{
|
||||
ChangeType = VisualChangeType.Layout;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the VisualPropertyChangedEventArgs class.
|
||||
/// </summary>
|
||||
public VisualPropertyChangedEventArgs(string propertyName, VisualChangeType changeType)
|
||||
: base(propertyName)
|
||||
{
|
||||
ChangeType = changeType;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
@@ -0,0 +1,457 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// ColumnHeaderRowVisualStyles
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ColumnHeaderRowVisualStyles : VisualStyles<ColumnHeaderRowVisualStyle>
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// ColumnHeaderRowVisualStyle
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ColumnHeaderRowVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Color _FilterBorderColor = Color.Empty;
|
||||
private Color _IndicatorBorderColor = Color.Empty;
|
||||
private Color _SortIndicatorColor = Color.Empty;
|
||||
|
||||
private Background _FilterBackground;
|
||||
private Background _IndicatorBackground;
|
||||
private Background _WhiteSpaceBackground;
|
||||
|
||||
private BaseRowHeaderVisualStyle _RowHeaderStyle;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region FilterBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the filter indicator background
|
||||
/// </summary>
|
||||
[Description("Indicates the RowHeader indicator background.")]
|
||||
public Background FilterBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_FilterBackground == null)
|
||||
{
|
||||
_FilterBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _FilterBackground);
|
||||
}
|
||||
|
||||
return (_FilterBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_FilterBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_FilterBackground, value);
|
||||
|
||||
_FilterBackground = value;
|
||||
|
||||
OnPropertyChangedEx("FilterBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeFilterBackground()
|
||||
{
|
||||
return (_FilterBackground != null &&
|
||||
_FilterBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetFilterBackground()
|
||||
{
|
||||
FilterBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FilterBorderColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Filter border color
|
||||
/// </summary>
|
||||
[Description("Indicates the Filter border color")]
|
||||
public Color FilterBorderColor
|
||||
{
|
||||
get { return (_FilterBorderColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_FilterBorderColor != value)
|
||||
{
|
||||
_FilterBorderColor = value;
|
||||
|
||||
OnPropertyChangedEx("FilterBorderColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeFilterBorderColor()
|
||||
{
|
||||
return (_FilterBorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetFilterBorderColor()
|
||||
{
|
||||
_FilterBorderColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IndicatorBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the RowHeader indicator background
|
||||
/// </summary>
|
||||
[Description("Indicates the RowHeader indicator background.")]
|
||||
public Background IndicatorBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_IndicatorBackground == null)
|
||||
{
|
||||
_IndicatorBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _IndicatorBackground);
|
||||
}
|
||||
|
||||
return (_IndicatorBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_IndicatorBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_IndicatorBackground, value);
|
||||
|
||||
_IndicatorBackground = value;
|
||||
|
||||
OnPropertyChangedEx("IndicatorBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeIndicatorBackground()
|
||||
{
|
||||
return (_IndicatorBackground != null &&
|
||||
_IndicatorBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetIndicatorBackground()
|
||||
{
|
||||
IndicatorBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IndicatorBorderColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the RowHeader indicator border color
|
||||
/// </summary>
|
||||
[Description("Indicates the RowHeader indicator border color")]
|
||||
public Color IndicatorBorderColor
|
||||
{
|
||||
get { return (_IndicatorBorderColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_IndicatorBorderColor != value)
|
||||
{
|
||||
_IndicatorBorderColor = value;
|
||||
|
||||
OnPropertyChangedEx("IndicatorBorderColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeIndicatorBorderColor()
|
||||
{
|
||||
return (_IndicatorBorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetIndicatorBorderColor()
|
||||
{
|
||||
_IndicatorBorderColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RowHeader
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style of the ColumnHeader RowHeader
|
||||
/// </summary>
|
||||
[Description("Indicates the visual style of the ColumnHeader RowHeader.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public BaseRowHeaderVisualStyle RowHeader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_RowHeaderStyle == null)
|
||||
{
|
||||
_RowHeaderStyle = BaseRowHeaderVisualStyle.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _RowHeaderStyle);
|
||||
}
|
||||
|
||||
return (_RowHeaderStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_RowHeaderStyle != value)
|
||||
{
|
||||
UpdateChangeHandler(_RowHeaderStyle, value);
|
||||
|
||||
_RowHeaderStyle = value;
|
||||
|
||||
OnPropertyChangedEx("RowHeader", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SortIndicatorColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Sort indicator color
|
||||
/// </summary>
|
||||
[Description("Indicates the Sort indicator color")]
|
||||
public Color SortIndicatorColor
|
||||
{
|
||||
get { return (_SortIndicatorColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_SortIndicatorColor != value)
|
||||
{
|
||||
_SortIndicatorColor = value;
|
||||
|
||||
OnPropertyChangedEx("SortIndicatorColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeSortIndicatorColor()
|
||||
{
|
||||
return (_SortIndicatorColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetSortIndicatorColor()
|
||||
{
|
||||
_SortIndicatorColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WhiteSpaceBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WhiteSpace Background
|
||||
/// </summary>
|
||||
[Description("Indicates the WhiteSpace Background")]
|
||||
public Background WhiteSpaceBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_WhiteSpaceBackground == null)
|
||||
{
|
||||
_WhiteSpaceBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _WhiteSpaceBackground);
|
||||
}
|
||||
|
||||
return (_WhiteSpaceBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_WhiteSpaceBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_WhiteSpaceBackground, value);
|
||||
|
||||
_WhiteSpaceBackground = value;
|
||||
|
||||
OnPropertyChangedEx("WhiteSpaceBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeWhiteSpaceBackground()
|
||||
{
|
||||
return (_WhiteSpaceBackground != null &&
|
||||
_WhiteSpaceBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetWhiteSpaceBackground()
|
||||
{
|
||||
WhiteSpaceBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ColumnHeaderRowVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
RowHeader.ApplyStyle(style.RowHeader);
|
||||
|
||||
if (style._FilterBackground != null && style._FilterBackground.IsEmpty == false)
|
||||
FilterBackground = style._FilterBackground.Copy();
|
||||
|
||||
if (style._FilterBorderColor.IsEmpty == false)
|
||||
FilterBorderColor = style._FilterBorderColor;
|
||||
|
||||
if (style._IndicatorBackground != null && style.IndicatorBackground.IsEmpty == false)
|
||||
IndicatorBackground = style._IndicatorBackground.Copy();
|
||||
|
||||
if (style._IndicatorBorderColor.IsEmpty == false)
|
||||
IndicatorBorderColor = style._IndicatorBorderColor;
|
||||
|
||||
if (style._SortIndicatorColor.IsEmpty == false)
|
||||
SortIndicatorColor = style._SortIndicatorColor;
|
||||
|
||||
if (style._WhiteSpaceBackground != null && style._WhiteSpaceBackground.IsEmpty == false)
|
||||
WhiteSpaceBackground = style._WhiteSpaceBackground.Copy();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ColumnHeaderRowVisualStyle Copy()
|
||||
{
|
||||
ColumnHeaderRowVisualStyle copy = new ColumnHeaderRowVisualStyle();
|
||||
|
||||
CopyTo(copy);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ColumnHeaderRowVisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
if (_RowHeaderStyle != null)
|
||||
copy.RowHeader = _RowHeaderStyle.Copy();
|
||||
|
||||
if (_FilterBackground != null)
|
||||
copy.FilterBackground = _FilterBackground.Copy();
|
||||
|
||||
if (_IndicatorBackground != null)
|
||||
copy.IndicatorBackground = _IndicatorBackground.Copy();
|
||||
|
||||
copy.FilterBorderColor = _FilterBorderColor;
|
||||
copy.IndicatorBorderColor = _IndicatorBorderColor;
|
||||
copy.SortIndicatorColor = _SortIndicatorColor;
|
||||
|
||||
if (_WhiteSpaceBackground != null)
|
||||
copy.WhiteSpaceBackground = _WhiteSpaceBackground.Copy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
IndicatorBackground = null;
|
||||
RowHeader = null;
|
||||
WhiteSpaceBackground = null;
|
||||
FilterBackground = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,81 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// ColumnHeaderVisualStyles
|
||||
///</summary>
|
||||
public class ColumnHeaderVisualStyles : VisualStyles<ColumnHeaderVisualStyle>
|
||||
{
|
||||
#region Hidden properties
|
||||
|
||||
#region Empty
|
||||
|
||||
/// <summary>
|
||||
/// Empty
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new ColumnHeaderVisualStyle Empty
|
||||
{
|
||||
get { return (base.Empty); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region NotSelectable
|
||||
|
||||
/// <summary>
|
||||
/// NotSelectable
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new ColumnHeaderVisualStyle NotSelectable
|
||||
{
|
||||
get { return (base.NotSelectable); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// ColumnHeaderVisualStyle
|
||||
///</summary>
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class ColumnHeaderVisualStyle : CellVisualStyle
|
||||
{
|
||||
#region GetTextFormatFlags
|
||||
|
||||
internal override eTextFormat GetTextFormatFlags()
|
||||
{
|
||||
eTextFormat tf = base.GetTextFormatFlags();
|
||||
|
||||
tf &= ~eTextFormat.SingleLine;
|
||||
|
||||
return (tf);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ColumnHeaderVisualStyle Copy()
|
||||
{
|
||||
ColumnHeaderVisualStyle style = new ColumnHeaderVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,696 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines set of default visual styles that are defined on the container control.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class DefaultVisualStyles : INotifyPropertyChanged, IDisposable
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private CellVisualStyles _CellStyles;
|
||||
private CellVisualStyles _MergedCellStyles;
|
||||
private CellVisualStyles _AlternateRowCellStyles;
|
||||
private CellVisualStyles _AlternateColumnCellStyles;
|
||||
|
||||
private ColumnHeaderVisualStyles _ColumnHeaderStyles;
|
||||
private ColumnHeaderRowVisualStyles _ColumnHeaderRowStyles;
|
||||
|
||||
private RowVisualStyles _RowStyles;
|
||||
private GroupHeaderVisualStyles _GroupHeaderStyles;
|
||||
|
||||
private TextRowVisualStyles _CaptionStyles;
|
||||
private TextRowVisualStyles _TitleStyles;
|
||||
private TextRowVisualStyles _HeaderStyles;
|
||||
private TextRowVisualStyles _FooterStyles;
|
||||
private GroupByVisualStyles _GroupByStyles;
|
||||
private GridPanelVisualStyle _GridPanelStyle;
|
||||
|
||||
private FilterRowVisualStyles _FilterRowStyles;
|
||||
private FilterColumnHeaderVisualStyles _FilterColumnHeaderStyles;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region AlternateColumnCellStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used on
|
||||
/// alternating columns (UseAlternateColumnStyle must be enabled)
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual styles to be used on alternating columns (UseAlternateColumnStyle must be enabled)")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public CellVisualStyles AlternateColumnCellStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_AlternateColumnCellStyles == null)
|
||||
{
|
||||
_AlternateColumnCellStyles = new CellVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _AlternateColumnCellStyles);
|
||||
}
|
||||
|
||||
return (_AlternateColumnCellStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_AlternateColumnCellStyles != value)
|
||||
{
|
||||
CellVisualStyles oldValue = _AlternateColumnCellStyles;
|
||||
_AlternateColumnCellStyles = value;
|
||||
|
||||
OnStyleChanged("AlternateColumnCellStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AlternateRowCellStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used on
|
||||
/// alternating rows (UseAlternateRowStyle must be enabled)
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates Gets or sets the visual styles to be used on alternating rows (UseAlternateRowStyle must be enabled)")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public CellVisualStyles AlternateRowCellStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_AlternateRowCellStyles == null)
|
||||
{
|
||||
_AlternateRowCellStyles = new CellVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _AlternateRowCellStyles);
|
||||
}
|
||||
|
||||
return (_AlternateRowCellStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_AlternateRowCellStyles != value)
|
||||
{
|
||||
CellVisualStyles oldValue = _AlternateRowCellStyles;
|
||||
_AlternateRowCellStyles = value;
|
||||
|
||||
OnStyleChanged("AltRowVisualStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CaptionStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for the grid Caption
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the grid Caption")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public TextRowVisualStyles CaptionStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_CaptionStyles == null)
|
||||
{
|
||||
_CaptionStyles = new TextRowVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _CaptionStyles);
|
||||
}
|
||||
|
||||
return (_CaptionStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_CaptionStyles != value)
|
||||
{
|
||||
TextRowVisualStyles oldValue = _CaptionStyles;
|
||||
_CaptionStyles = value;
|
||||
|
||||
OnStyleChanged("CaptionStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets visual styles to be used for the grid Cells
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the grid Cells")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public CellVisualStyles CellStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_CellStyles == null)
|
||||
{
|
||||
_CellStyles = new CellVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _CellStyles);
|
||||
}
|
||||
|
||||
return (_CellStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_CellStyles != value)
|
||||
{
|
||||
CellVisualStyles oldValue = _CellStyles;
|
||||
_CellStyles = value;
|
||||
|
||||
OnStyleChanged("CellStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ColumnHeaderStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets visual styles to be used for the grid ColumnHeader
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the grid ColumnHeader")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ColumnHeaderVisualStyles ColumnHeaderStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ColumnHeaderStyles == null)
|
||||
{
|
||||
_ColumnHeaderStyles = new ColumnHeaderVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _ColumnHeaderStyles);
|
||||
}
|
||||
|
||||
return (_ColumnHeaderStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_ColumnHeaderStyles != value)
|
||||
{
|
||||
ColumnHeaderVisualStyles oldValue = _ColumnHeaderStyles;
|
||||
_ColumnHeaderStyles = value;
|
||||
|
||||
OnStyleChanged("ColumnHeaderStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ColumnHeaderRowStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets visual styles
|
||||
/// to be used for the grid ColumnHeader Row
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the grid ColumnHeader Row")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ColumnHeaderRowVisualStyles ColumnHeaderRowStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ColumnHeaderRowStyles == null)
|
||||
{
|
||||
_ColumnHeaderRowStyles = new ColumnHeaderRowVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _ColumnHeaderRowStyles);
|
||||
}
|
||||
|
||||
return (_ColumnHeaderRowStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_ColumnHeaderRowStyles != value)
|
||||
{
|
||||
ColumnHeaderRowVisualStyles oldValue = _ColumnHeaderRowStyles;
|
||||
_ColumnHeaderRowStyles = value;
|
||||
|
||||
OnStyleChanged("ColumnHeaderRowStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FilterRowStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets visual styles to
|
||||
/// be used for the grid Filter column headers
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the grid Filter column headers.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public FilterColumnHeaderVisualStyles FilterColumnHeaderStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_FilterColumnHeaderStyles == null)
|
||||
{
|
||||
_FilterColumnHeaderStyles = new FilterColumnHeaderVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _FilterColumnHeaderStyles);
|
||||
}
|
||||
|
||||
return (_FilterColumnHeaderStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_FilterColumnHeaderStyles != value)
|
||||
{
|
||||
FilterColumnHeaderVisualStyles oldValue = _FilterColumnHeaderStyles;
|
||||
_FilterColumnHeaderStyles = value;
|
||||
|
||||
OnStyleChanged("FilterColumnHeaderStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FilterRowStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets visual styles to be used for the grid Filter Row
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the grid Filter Row")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public FilterRowVisualStyles FilterRowStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_FilterRowStyles == null)
|
||||
{
|
||||
_FilterRowStyles = new FilterRowVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _FilterRowStyles);
|
||||
}
|
||||
|
||||
return (_FilterRowStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_FilterRowStyles != value)
|
||||
{
|
||||
FilterRowVisualStyles oldValue = _FilterRowStyles;
|
||||
_FilterRowStyles = value;
|
||||
|
||||
OnStyleChanged("FilterRowStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FooterStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for the grid Footer
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the grid Footer")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public TextRowVisualStyles FooterStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_FooterStyles == null)
|
||||
{
|
||||
_FooterStyles = new TextRowVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _FooterStyles);
|
||||
}
|
||||
|
||||
return (_FooterStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_FooterStyles != value)
|
||||
{
|
||||
TextRowVisualStyles oldValue = _FooterStyles;
|
||||
_FooterStyles = value;
|
||||
|
||||
OnStyleChanged("FooterStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GridPanelStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for the main grid panel
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the main grid panel")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public GridPanelVisualStyle GridPanelStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_GridPanelStyle == null)
|
||||
{
|
||||
_GridPanelStyle = new GridPanelVisualStyle();
|
||||
|
||||
StyleChangeHandler(null, _GridPanelStyle);
|
||||
}
|
||||
|
||||
return (_GridPanelStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_GridPanelStyle != value)
|
||||
{
|
||||
GridPanelVisualStyle oldValue = _GridPanelStyle;
|
||||
_GridPanelStyle = value;
|
||||
|
||||
OnStyleChanged("GridPanelStyle", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GroupByStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for the grid GroupBy Row
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the grid GroupBy Row")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public GroupByVisualStyles GroupByStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_GroupByStyles == null)
|
||||
{
|
||||
_GroupByStyles = new GroupByVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _GroupByStyles);
|
||||
}
|
||||
|
||||
return (_GroupByStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_GroupByStyles != value)
|
||||
{
|
||||
GroupByVisualStyles oldValue = _GroupByStyles;
|
||||
_GroupByStyles = value;
|
||||
|
||||
OnStyleChanged("GroupByStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GroupHeaderStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for the Group Header
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the Group Header")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public GroupHeaderVisualStyles GroupHeaderStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_GroupHeaderStyles == null)
|
||||
{
|
||||
_GroupHeaderStyles = new GroupHeaderVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _GroupHeaderStyles);
|
||||
}
|
||||
|
||||
return (_GroupHeaderStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_GroupHeaderStyles != value)
|
||||
{
|
||||
GroupHeaderVisualStyles oldValue = _GroupHeaderStyles;
|
||||
_GroupHeaderStyles = value;
|
||||
|
||||
OnStyleChanged("GroupHeaderStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HeaderStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for the grid Header
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the grid Header")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public TextRowVisualStyles HeaderStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_HeaderStyles == null)
|
||||
{
|
||||
_HeaderStyles = new TextRowVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _HeaderStyles);
|
||||
}
|
||||
|
||||
return (_HeaderStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_HeaderStyles != value)
|
||||
{
|
||||
TextRowVisualStyles oldValue = _HeaderStyles;
|
||||
_HeaderStyles = value;
|
||||
|
||||
OnStyleChanged("HeaderStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MergedCellStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets visual styles to be used for merged grid Cells
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for merged grid Cells")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public CellVisualStyles MergedCellStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_MergedCellStyles == null)
|
||||
{
|
||||
_MergedCellStyles = new CellVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _MergedCellStyles);
|
||||
}
|
||||
|
||||
return (_MergedCellStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_MergedCellStyles != value)
|
||||
{
|
||||
CellVisualStyles oldValue = _MergedCellStyles;
|
||||
_MergedCellStyles = value;
|
||||
|
||||
OnStyleChanged("MergedCellStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RowStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for the grid rows
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the grid rows")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public RowVisualStyles RowStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_RowStyles == null)
|
||||
{
|
||||
_RowStyles = new RowVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _RowStyles);
|
||||
}
|
||||
|
||||
return (_RowStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_RowStyles != value)
|
||||
{
|
||||
RowVisualStyles oldValue = _RowStyles;
|
||||
_RowStyles = value;
|
||||
|
||||
OnStyleChanged("RowStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TitleStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for the grid Title
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for the grid Title")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public TextRowVisualStyles TitleStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_TitleStyles == null)
|
||||
{
|
||||
_TitleStyles = new TextRowVisualStyles();
|
||||
|
||||
StyleChangeHandler(null, _TitleStyles);
|
||||
}
|
||||
|
||||
return (_TitleStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_TitleStyles != value)
|
||||
{
|
||||
TextRowVisualStyles oldValue = _TitleStyles;
|
||||
_TitleStyles = value;
|
||||
|
||||
OnStyleChanged("TitleStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnStyleChanged
|
||||
|
||||
private void OnStyleChanged(string property,
|
||||
INotifyPropertyChanged oldValue, INotifyPropertyChanged newValue)
|
||||
{
|
||||
StyleChangeHandler(oldValue, newValue);
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs(property));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleChangeHandler
|
||||
|
||||
private void StyleChangeHandler(
|
||||
INotifyPropertyChanged oldValue, INotifyPropertyChanged newValue)
|
||||
{
|
||||
if (oldValue != null)
|
||||
oldValue.PropertyChanged -= StyleChanged;
|
||||
|
||||
if (newValue != null)
|
||||
newValue.PropertyChanged += StyleChanged;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleChanged
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when one of element visual styles has property changes.
|
||||
/// Default implementation invalidates visual appearance of element.
|
||||
/// </summary>
|
||||
/// <param name="sender">VisualStyle that changed.</param>
|
||||
/// <param name="e">Event arguments.</param>
|
||||
protected virtual void StyleChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
AlternateColumnCellStyles = null;
|
||||
AlternateRowCellStyles = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,572 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// FilterColumnHeaderVisualStyle
|
||||
///</summary>
|
||||
public class FilterColumnHeaderVisualStyles : VisualStyles<FilterColumnHeaderVisualStyle>
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// FilterRowVisualStyle
|
||||
///</summary>
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class FilterColumnHeaderVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Tbool _AllowWrap = Tbool.NotSet;
|
||||
private Alignment _Alignment = Alignment.NotSet;
|
||||
|
||||
private Background _Background;
|
||||
private Background _ErrorBackground;
|
||||
private Background _GripBarBackground;
|
||||
|
||||
private Color _TextColor = Color.Empty;
|
||||
private Color _ErrorTextColor = Color.Empty;
|
||||
|
||||
private Font _Font;
|
||||
|
||||
private Padding _Margin;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Alignment
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the content alignment
|
||||
/// </summary>
|
||||
[DefaultValue(Alignment.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the content alignment.")]
|
||||
public Alignment Alignment
|
||||
{
|
||||
get { return (_Alignment); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Alignment != value)
|
||||
{
|
||||
_Alignment = value;
|
||||
|
||||
OnPropertyChangedEx("Alignment", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AllowWrap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether text wrapping is permitted
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("Appearance")]
|
||||
[Description("Indicates whether text wrapping is permitted.")]
|
||||
public Tbool AllowWrap
|
||||
{
|
||||
get { return (_AllowWrap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_AllowWrap != value)
|
||||
{
|
||||
_AllowWrap = value;
|
||||
|
||||
OnPropertyChangedEx("AllowWrap", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Background
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style background.
|
||||
/// </summary>
|
||||
[Description("Indicates the style background")]
|
||||
public Background Background
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Background == null)
|
||||
{
|
||||
_Background = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _Background);
|
||||
}
|
||||
|
||||
return (_Background);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Background != value)
|
||||
{
|
||||
UpdateChangeHandler(_Background, value);
|
||||
|
||||
_Background = value;
|
||||
|
||||
OnPropertyChangedEx("Background", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBackground()
|
||||
{
|
||||
return (_Background != null && _Background.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBackground()
|
||||
{
|
||||
Background = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ErrorBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style error background.
|
||||
/// </summary>
|
||||
[Description("Indicates the style error background")]
|
||||
public Background ErrorBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Background == null)
|
||||
{
|
||||
_ErrorBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _ErrorBackground);
|
||||
}
|
||||
|
||||
return (_ErrorBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_ErrorBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_ErrorBackground, value);
|
||||
|
||||
_ErrorBackground = value;
|
||||
|
||||
OnPropertyChangedEx("ErrorBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeErrorBackground()
|
||||
{
|
||||
return (_ErrorBackground != null && _ErrorBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetErrorBackground()
|
||||
{
|
||||
ErrorBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ErrorTextColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the error Text color
|
||||
/// </summary>
|
||||
[Description("Indicates the error Text color")]
|
||||
public Color ErrorTextColor
|
||||
{
|
||||
get { return (_ErrorTextColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ErrorTextColor != value)
|
||||
{
|
||||
_ErrorTextColor = value;
|
||||
|
||||
OnPropertyChangedEx("ErrorTextColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeErrorTextColor()
|
||||
{
|
||||
return (_ErrorTextColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetErrorTextColor()
|
||||
{
|
||||
_ErrorTextColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Font
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style Font
|
||||
/// </summary>
|
||||
[DefaultValue(null)]
|
||||
[Description("Indicates the style Font")]
|
||||
public Font Font
|
||||
{
|
||||
get { return (_Font); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Font != value)
|
||||
{
|
||||
_Font = value;
|
||||
|
||||
OnPropertyChangedEx("Font", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GripBarBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GripBar style background.
|
||||
/// </summary>
|
||||
[Description("Indicates the GripBar style background")]
|
||||
public Background GripBarBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_GripBarBackground == null)
|
||||
{
|
||||
_GripBarBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _GripBarBackground);
|
||||
}
|
||||
|
||||
return (_GripBarBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_GripBarBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_GripBarBackground, value);
|
||||
|
||||
_GripBarBackground = value;
|
||||
|
||||
OnPropertyChangedEx("GripBarBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeGripBarBackground()
|
||||
{
|
||||
return (_GripBarBackground != null && _GripBarBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetGripBarBackground()
|
||||
{
|
||||
GripBarBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Margin
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the spacing between the border and outside content.
|
||||
/// </summary>
|
||||
[Description("Indicates the spacing between the border and outside content")]
|
||||
public Padding Margin
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Margin == null)
|
||||
{
|
||||
_Margin = Padding.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _Margin);
|
||||
}
|
||||
|
||||
return (_Margin);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Margin != value)
|
||||
{
|
||||
UpdateChangeHandler(_Margin, value);
|
||||
|
||||
_Margin = value;
|
||||
|
||||
OnPropertyChangedEx("Margin", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeMargin()
|
||||
{
|
||||
return (_Margin != null && _Margin.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetMargin()
|
||||
{
|
||||
Margin = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Text color
|
||||
/// </summary>
|
||||
[Description("Indicates the Text color")]
|
||||
public Color TextColor
|
||||
{
|
||||
get { return (_TextColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_TextColor != value)
|
||||
{
|
||||
_TextColor = value;
|
||||
|
||||
OnPropertyChangedEx("TextColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeTextColor()
|
||||
{
|
||||
return (_TextColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetTextColor()
|
||||
{
|
||||
_TextColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetTextFormatFlags
|
||||
|
||||
internal eTextFormat GetTextFormatFlags()
|
||||
{
|
||||
eTextFormat tf = eTextFormat.WordEllipsis |
|
||||
eTextFormat.NoPadding | eTextFormat.NoPrefix;
|
||||
|
||||
if (AllowWrap == Tbool.True)
|
||||
tf |= eTextFormat.WordBreak;
|
||||
|
||||
switch (Alignment)
|
||||
{
|
||||
case Alignment.TopCenter:
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
tf |= eTextFormat.Right;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleLeft:
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleCenter:
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleRight:
|
||||
tf |= eTextFormat.Right;
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.BottomLeft:
|
||||
tf |= eTextFormat.Bottom;
|
||||
break;
|
||||
|
||||
case Alignment.BottomCenter:
|
||||
tf |= eTextFormat.Bottom;
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.BottomRight:
|
||||
tf |= eTextFormat.Bottom;
|
||||
tf |= eTextFormat.Right;
|
||||
break;
|
||||
}
|
||||
|
||||
return (tf);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to the instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(FilterColumnHeaderVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.Alignment != Alignment.NotSet)
|
||||
Alignment = style.Alignment;
|
||||
|
||||
if (style.AllowWrap != Tbool.NotSet)
|
||||
AllowWrap = style.AllowWrap;
|
||||
|
||||
if (style.Background != null && style.Background.IsEmpty == false)
|
||||
Background = style.Background.Copy();
|
||||
|
||||
if (style.GripBarBackground != null && style.GripBarBackground.IsEmpty == false)
|
||||
GripBarBackground = style.GripBarBackground.Copy();
|
||||
|
||||
if (style.ErrorBackground != null && style.ErrorBackground.IsEmpty == false)
|
||||
ErrorBackground = style.ErrorBackground.Copy();
|
||||
|
||||
if (style.Font != null)
|
||||
Font = style.Font;
|
||||
|
||||
if (style.ErrorTextColor.IsEmpty == false)
|
||||
ErrorTextColor = style.ErrorTextColor;
|
||||
|
||||
if (style.TextColor.IsEmpty == false)
|
||||
TextColor = style.TextColor;
|
||||
|
||||
if (style.Margin != null && style.Margin.IsEmpty == false)
|
||||
Margin = style.Margin.Copy();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new FilterColumnHeaderVisualStyle Copy()
|
||||
{
|
||||
FilterColumnHeaderVisualStyle style = new FilterColumnHeaderVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(FilterColumnHeaderVisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
copy.Alignment = _Alignment;
|
||||
copy.AllowWrap = _AllowWrap;
|
||||
copy.ErrorTextColor = _ErrorTextColor;
|
||||
copy.TextColor = _TextColor;
|
||||
|
||||
if (_Background != null)
|
||||
copy.Background = _Background.Copy();
|
||||
|
||||
if (_ErrorBackground != null)
|
||||
copy.ErrorBackground = _ErrorBackground.Copy();
|
||||
|
||||
if (_GripBarBackground != null)
|
||||
copy.GripBarBackground = _GripBarBackground.Copy();
|
||||
|
||||
if (_Font != null)
|
||||
copy.Font = _Font;
|
||||
|
||||
if (_Margin != null)
|
||||
copy.Margin = _Margin.Copy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
Background = null;
|
||||
ErrorBackground = null;
|
||||
GripBarBackground = null;
|
||||
Margin = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,305 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// FilterRowVisualStyles
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class FilterRowVisualStyles : VisualStyles<FilterRowVisualStyle>
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// FilterRowVisualStyle
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class FilterRowVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Color _FilterBorderColor = Color.Empty;
|
||||
|
||||
private Background _FilterBackground;
|
||||
private Background _WhiteSpaceBackground;
|
||||
|
||||
private BaseRowHeaderVisualStyle _RowHeaderStyle;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region FilterBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the filter indicator background
|
||||
/// </summary>
|
||||
[Description("Indicates the RowHeader indicator background.")]
|
||||
public Background FilterBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_FilterBackground == null)
|
||||
{
|
||||
_FilterBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _FilterBackground);
|
||||
}
|
||||
|
||||
return (_FilterBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_FilterBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_FilterBackground, value);
|
||||
|
||||
_FilterBackground = value;
|
||||
|
||||
OnPropertyChangedEx("FilterBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeFilterBackground()
|
||||
{
|
||||
return (_FilterBackground != null &&
|
||||
_FilterBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetFilterBackground()
|
||||
{
|
||||
FilterBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FilterBorderColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Filter border color
|
||||
/// </summary>
|
||||
[Description("Indicates the Filter border color")]
|
||||
public Color FilterBorderColor
|
||||
{
|
||||
get { return (_FilterBorderColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_FilterBorderColor != value)
|
||||
{
|
||||
_FilterBorderColor = value;
|
||||
|
||||
OnPropertyChangedEx("FilterBorderColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeFilterBorderColor()
|
||||
{
|
||||
return (_FilterBorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetFilterBorderColor()
|
||||
{
|
||||
_FilterBorderColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RowHeader
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style of the RowHeader
|
||||
/// </summary>
|
||||
[Description("Indicates the visual style of the RowHeader.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public BaseRowHeaderVisualStyle RowHeader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_RowHeaderStyle == null)
|
||||
{
|
||||
_RowHeaderStyle = BaseRowHeaderVisualStyle.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _RowHeaderStyle);
|
||||
}
|
||||
|
||||
return (_RowHeaderStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_RowHeaderStyle != value)
|
||||
{
|
||||
UpdateChangeHandler(_RowHeaderStyle, value);
|
||||
|
||||
_RowHeaderStyle = value;
|
||||
|
||||
OnPropertyChangedEx("RowHeader", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WhiteSpaceBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the WhiteSpace Background
|
||||
/// </summary>
|
||||
[Description("Indicates the WhiteSpace Background")]
|
||||
public Background WhiteSpaceBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_WhiteSpaceBackground == null)
|
||||
{
|
||||
_WhiteSpaceBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _WhiteSpaceBackground);
|
||||
}
|
||||
|
||||
return (_WhiteSpaceBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_WhiteSpaceBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_WhiteSpaceBackground, value);
|
||||
|
||||
_WhiteSpaceBackground = value;
|
||||
|
||||
OnPropertyChangedEx("WhiteSpaceBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeWhiteSpaceBackground()
|
||||
{
|
||||
return (_WhiteSpaceBackground != null &&
|
||||
_WhiteSpaceBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetWhiteSpaceBackground()
|
||||
{
|
||||
WhiteSpaceBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(FilterRowVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
RowHeader.ApplyStyle(style.RowHeader);
|
||||
|
||||
if (style.FilterBackground != null && style.FilterBackground.IsEmpty == false)
|
||||
FilterBackground = style.FilterBackground.Copy();
|
||||
|
||||
if (style.FilterBorderColor.IsEmpty == false)
|
||||
FilterBorderColor = style.FilterBorderColor;
|
||||
|
||||
if (style.WhiteSpaceBackground != null && style.WhiteSpaceBackground.IsEmpty == false)
|
||||
WhiteSpaceBackground = style.WhiteSpaceBackground.Copy();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new FilterRowVisualStyle Copy()
|
||||
{
|
||||
FilterRowVisualStyle copy = new FilterRowVisualStyle();
|
||||
|
||||
CopyTo(copy);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(FilterRowVisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
if (_RowHeaderStyle != null)
|
||||
copy.RowHeader = _RowHeaderStyle.Copy();
|
||||
|
||||
copy.FilterBorderColor = _FilterBorderColor;
|
||||
|
||||
if (_FilterBackground != null)
|
||||
copy.FilterBackground = _FilterBackground.Copy();
|
||||
|
||||
if (_WhiteSpaceBackground != null)
|
||||
copy.WhiteSpaceBackground = _WhiteSpaceBackground.Copy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
RowHeader = null;
|
||||
WhiteSpaceBackground = null;
|
||||
FilterBackground = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,717 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// GridPanelVisualStyle
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class GridPanelVisualStyle : VisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Tbool _AllowWrap = Tbool.NotSet;
|
||||
private Alignment _Alignment = Alignment.NotSet;
|
||||
|
||||
private Color _HeaderLineColor = Color.Empty;
|
||||
private Color _HorizontalLineColor = Color.Empty;
|
||||
private Color _VerticalLineColor = Color.Empty;
|
||||
private Color _TreeLineColor = Color.Empty;
|
||||
|
||||
private TreeButtonVisualStyle _CircleTreeButtonStyle;
|
||||
private TreeButtonVisualStyle _SquareTreeButtonStyle;
|
||||
private TreeButtonVisualStyle _TriangleTreeButtonStyle;
|
||||
|
||||
private LinePattern _HeaderHLinePattern = LinePattern.NotSet;
|
||||
private LinePattern _HeaderVLinePattern = LinePattern.NotSet;
|
||||
private LinePattern _HorizontalLinePattern = LinePattern.NotSet;
|
||||
private LinePattern _VerticalLinePattern = LinePattern.NotSet;
|
||||
private LinePattern _TreeLinePattern = LinePattern.NotSet;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Hidden properties
|
||||
|
||||
#region BorderThickness
|
||||
|
||||
///<summary>
|
||||
/// Margin
|
||||
///</summary>
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Thickness BorderThickness
|
||||
{
|
||||
get { return (base.BorderThickness); }
|
||||
set { base.BorderThickness = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Margin
|
||||
|
||||
///<summary>
|
||||
/// Margin
|
||||
///</summary>
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Padding Margin
|
||||
{
|
||||
get { return (base.Margin); }
|
||||
set { base.Margin = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Padding
|
||||
|
||||
///<summary>
|
||||
/// Padding
|
||||
///</summary>
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Padding Padding
|
||||
{
|
||||
get { return (base.Padding); }
|
||||
set { base.Padding = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Alignment
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alignment of the NoRowText within the panel
|
||||
/// </summary>
|
||||
[DefaultValue(Alignment.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the alignment of the NoRowText within the panel.")]
|
||||
public Alignment Alignment
|
||||
{
|
||||
get { return (_Alignment); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Alignment != value)
|
||||
{
|
||||
_Alignment = value;
|
||||
|
||||
OnPropertyChangedEx("Alignment", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AllowWrap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether text wrapping is permitted
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("Appearance")]
|
||||
[Description("Indicates whether text wrapping is permitted.")]
|
||||
public Tbool AllowWrap
|
||||
{
|
||||
get { return (_AllowWrap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_AllowWrap != value)
|
||||
{
|
||||
_AllowWrap = value;
|
||||
|
||||
OnPropertyChangedEx("AllowWrap", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CircleTreeButtonStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Circle TreeButton Style
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Circle TreeButton Style.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public TreeButtonVisualStyle CircleTreeButtonStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_CircleTreeButtonStyle == null)
|
||||
{
|
||||
_CircleTreeButtonStyle = TreeButtonVisualStyle.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _CircleTreeButtonStyle);
|
||||
}
|
||||
|
||||
return (_CircleTreeButtonStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_CircleTreeButtonStyle != value)
|
||||
{
|
||||
UpdateChangeHandler(_CircleTreeButtonStyle, value);
|
||||
|
||||
_CircleTreeButtonStyle = value;
|
||||
|
||||
OnPropertyChangedEx("CircleTreeButtonStyle", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HeaderLineColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Header Line Color
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Header Line Color.")]
|
||||
public Color HeaderLineColor
|
||||
{
|
||||
get { return (_HeaderLineColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_HeaderLineColor != value)
|
||||
{
|
||||
_HeaderLineColor = value;
|
||||
|
||||
OnPropertyChangedEx("HeaderLineColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeHeaderLineColor()
|
||||
{
|
||||
return (_HeaderLineColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetHeaderLineColor()
|
||||
{
|
||||
_HeaderLineColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HeaderHLinePattern
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Header Horizontal Line pattern
|
||||
/// </summary>
|
||||
[Category("Appearance"), DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the Header Line pattern.")]
|
||||
public LinePattern HeaderHLinePattern
|
||||
{
|
||||
get { return (_HeaderHLinePattern); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_HeaderHLinePattern != value)
|
||||
{
|
||||
_HeaderHLinePattern = value;
|
||||
|
||||
OnPropertyChangedEx("HeaderHLinePattern", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HeaderVLinePattern
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Header Vertical Line pattern
|
||||
/// </summary>
|
||||
[Category("Appearance"), DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the Header Line pattern.")]
|
||||
public LinePattern HeaderVLinePattern
|
||||
{
|
||||
get { return (_HeaderVLinePattern); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_HeaderVLinePattern != value)
|
||||
{
|
||||
_HeaderVLinePattern = value;
|
||||
|
||||
OnPropertyChangedEx("HeaderVLinePattern", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HorizontalLineColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Horizontal Line Color
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Horizontal Line Color.")]
|
||||
public Color HorizontalLineColor
|
||||
{
|
||||
get { return (_HorizontalLineColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_HorizontalLineColor != value)
|
||||
{
|
||||
_HorizontalLineColor = value;
|
||||
|
||||
OnPropertyChangedEx("HorizontalLineColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeHorizontalLineColor()
|
||||
{
|
||||
return (_HorizontalLineColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetHorizontalLineColor()
|
||||
{
|
||||
_HorizontalLineColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HorizontalLinePattern
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Horizontal Line pattern
|
||||
/// </summary>
|
||||
[Category("Appearance"), DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the Horizontal Line pattern.")]
|
||||
public LinePattern HorizontalLinePattern
|
||||
{
|
||||
get { return (_HorizontalLinePattern); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_HorizontalLinePattern != value)
|
||||
{
|
||||
_HorizontalLinePattern = value;
|
||||
|
||||
OnPropertyChangedEx("HorizontalLinePattern", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SquareTreeButtonStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Square TreeButton Style
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Square TreeButton Style.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public TreeButtonVisualStyle SquareTreeButtonStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_SquareTreeButtonStyle == null)
|
||||
{
|
||||
_SquareTreeButtonStyle = TreeButtonVisualStyle.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _SquareTreeButtonStyle);
|
||||
}
|
||||
|
||||
return (_SquareTreeButtonStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_SquareTreeButtonStyle != value)
|
||||
{
|
||||
UpdateChangeHandler(_SquareTreeButtonStyle, value);
|
||||
|
||||
_SquareTreeButtonStyle = value;
|
||||
|
||||
OnPropertyChangedEx("SquareTreeButtonStyle", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TreeLineColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Tree Line Color
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Tree Line Color.")]
|
||||
public Color TreeLineColor
|
||||
{
|
||||
get { return (_TreeLineColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_TreeLineColor != value)
|
||||
{
|
||||
_TreeLineColor = value;
|
||||
|
||||
OnPropertyChangedEx("TreeLineColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeTreeLineColor()
|
||||
{
|
||||
return (_TreeLineColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetTreeLineColor()
|
||||
{
|
||||
_TreeLineColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TreeLinePattern
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Tree Line pattern
|
||||
/// </summary>
|
||||
[Category("Appearance"), DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the Tree Line pattern.")]
|
||||
public LinePattern TreeLinePattern
|
||||
{
|
||||
get { return (_TreeLinePattern); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_TreeLinePattern != value)
|
||||
{
|
||||
_TreeLinePattern = value;
|
||||
|
||||
OnPropertyChangedEx("TreeLinePattern", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TriangleTreeButtonStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Triangle TreeButton Style
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Triangle TreeButton Style.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public TreeButtonVisualStyle TriangleTreeButtonStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_TriangleTreeButtonStyle == null)
|
||||
{
|
||||
_TriangleTreeButtonStyle = TreeButtonVisualStyle.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _TriangleTreeButtonStyle);
|
||||
}
|
||||
|
||||
return (_TriangleTreeButtonStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_TriangleTreeButtonStyle != value)
|
||||
{
|
||||
UpdateChangeHandler(_TriangleTreeButtonStyle, value);
|
||||
|
||||
_TriangleTreeButtonStyle = value;
|
||||
|
||||
OnPropertyChangedEx("TriangleTreeButtonStyle", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region VerticalLineColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Vertical Line color
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Vertical Line Color.")]
|
||||
public Color VerticalLineColor
|
||||
{
|
||||
get { return (_VerticalLineColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_VerticalLineColor != value)
|
||||
{
|
||||
_VerticalLineColor = value;
|
||||
|
||||
OnPropertyChangedEx("VerticalLineColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeVerticalLineColor()
|
||||
{
|
||||
return (_VerticalLineColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetVerticalLineColor()
|
||||
{
|
||||
_VerticalLineColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region VerticalLinePattern
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Vertical Line pattern
|
||||
/// </summary>
|
||||
[Category("Appearance"), DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the Vertical Line pattern.")]
|
||||
public LinePattern VerticalLinePattern
|
||||
{
|
||||
get { return (_VerticalLinePattern); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_VerticalLinePattern != value)
|
||||
{
|
||||
_VerticalLinePattern = value;
|
||||
|
||||
OnPropertyChangedEx("VerticalLinePattern", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(GridPanelVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.Alignment != Alignment.NotSet)
|
||||
_Alignment = style.Alignment;
|
||||
|
||||
if (style.AllowWrap != Tbool.NotSet)
|
||||
_AllowWrap = style.AllowWrap;
|
||||
|
||||
if (style._CircleTreeButtonStyle != null)
|
||||
CircleTreeButtonStyle.ApplyStyle(style._CircleTreeButtonStyle);
|
||||
|
||||
if (style.HeaderLineColor.IsEmpty == false)
|
||||
_HeaderLineColor = style.HeaderLineColor;
|
||||
|
||||
if (style.TreeLineColor.IsEmpty == false)
|
||||
_TreeLineColor = style.TreeLineColor;
|
||||
|
||||
if (style.HorizontalLineColor.IsEmpty == false)
|
||||
_HorizontalLineColor = style.HorizontalLineColor;
|
||||
|
||||
if (style.VerticalLineColor.IsEmpty == false)
|
||||
_VerticalLineColor = style.VerticalLineColor;
|
||||
|
||||
if (style.TreeLinePattern != LinePattern.NotSet)
|
||||
TreeLinePattern = style.TreeLinePattern;
|
||||
|
||||
if (style.HorizontalLinePattern != LinePattern.NotSet)
|
||||
HorizontalLinePattern = style.HorizontalLinePattern;
|
||||
|
||||
if (style._SquareTreeButtonStyle != null)
|
||||
SquareTreeButtonStyle.ApplyStyle(style._SquareTreeButtonStyle);
|
||||
|
||||
if (style._TriangleTreeButtonStyle != null)
|
||||
TriangleTreeButtonStyle.ApplyStyle(style._TriangleTreeButtonStyle);
|
||||
|
||||
if (style.VerticalLinePattern != LinePattern.NotSet)
|
||||
VerticalLinePattern = style.VerticalLinePattern;
|
||||
|
||||
if (style.HeaderHLinePattern != LinePattern.NotSet)
|
||||
HeaderHLinePattern = style.HeaderHLinePattern;
|
||||
|
||||
if (style.HeaderVLinePattern != LinePattern.NotSet)
|
||||
HeaderVLinePattern = style.HeaderVLinePattern;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetTextFormatFlags
|
||||
|
||||
internal eTextFormat GetTextFormatFlags()
|
||||
{
|
||||
eTextFormat tf = eTextFormat.WordEllipsis |
|
||||
eTextFormat.NoPadding | eTextFormat.NoPrefix;
|
||||
|
||||
if (AllowWrap == Tbool.True)
|
||||
tf |= eTextFormat.WordBreak;
|
||||
|
||||
switch (Alignment)
|
||||
{
|
||||
case Alignment.TopCenter:
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
tf |= eTextFormat.Right;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleLeft:
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.NotSet:
|
||||
case Alignment.MiddleCenter:
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleRight:
|
||||
tf |= eTextFormat.Right;
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.BottomLeft:
|
||||
tf |= eTextFormat.Bottom;
|
||||
break;
|
||||
|
||||
case Alignment.BottomCenter:
|
||||
tf |= eTextFormat.Bottom;
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.BottomRight:
|
||||
tf |= eTextFormat.Bottom;
|
||||
tf |= eTextFormat.Right;
|
||||
break;
|
||||
}
|
||||
|
||||
return (tf);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new GridPanelVisualStyle Copy()
|
||||
{
|
||||
GridPanelVisualStyle style = new GridPanelVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(GridPanelVisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
copy.Alignment = _Alignment;
|
||||
copy.AllowWrap = _AllowWrap;
|
||||
|
||||
copy.HeaderLineColor = _HeaderLineColor;
|
||||
copy.TreeLineColor = _TreeLineColor;
|
||||
copy.HorizontalLineColor = _HorizontalLineColor;
|
||||
copy.VerticalLineColor = _VerticalLineColor;
|
||||
|
||||
copy.TreeLinePattern = _TreeLinePattern;
|
||||
copy.HorizontalLinePattern = _HorizontalLinePattern;
|
||||
copy.VerticalLinePattern = _VerticalLinePattern;
|
||||
copy.HeaderHLinePattern = _HeaderHLinePattern;
|
||||
copy.HeaderVLinePattern = _HeaderVLinePattern;
|
||||
|
||||
if (_CircleTreeButtonStyle != null)
|
||||
copy.CircleTreeButtonStyle = _CircleTreeButtonStyle.Copy();
|
||||
|
||||
if (_SquareTreeButtonStyle != null)
|
||||
copy.SquareTreeButtonStyle = _SquareTreeButtonStyle.Copy();
|
||||
|
||||
if (_TriangleTreeButtonStyle != null)
|
||||
copy.TriangleTreeButtonStyle = _TriangleTreeButtonStyle.Copy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
CircleTreeButtonStyle = null;
|
||||
SquareTreeButtonStyle = null;
|
||||
TriangleTreeButtonStyle = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,478 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// FilterRowVisualStyles
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class GroupByVisualStyles : VisualStyles<GroupByVisualStyle>
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// FilterRowVisualStyle
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class GroupByVisualStyle : TextRowVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Color _GroupBoxBorderColor = Color.Empty;
|
||||
private Color _GroupBoxConnectorColor = Color.Empty;
|
||||
private Color _GroupBoxTextColor = Color.Empty;
|
||||
private Background _GroupBoxBackground;
|
||||
|
||||
private Color _WatermarkTextColor = Color.Empty;
|
||||
private Font _WatermarkFont;
|
||||
|
||||
private Background _InsertMarkerBackground;
|
||||
private Color _InsertMarkerBorderColor = Color.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region GroupBoxBorderColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GroupBox border color
|
||||
/// </summary>
|
||||
[Description("Indicates the GroupBox border color")]
|
||||
public Color GroupBoxBorderColor
|
||||
{
|
||||
get { return (_GroupBoxBorderColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_GroupBoxBorderColor != value)
|
||||
{
|
||||
_GroupBoxBorderColor = value;
|
||||
|
||||
OnPropertyChangedEx("GroupBoxBorderColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeGroupBoxBorderColor()
|
||||
{
|
||||
return (_GroupBoxBorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetGroupBoxBorderColor()
|
||||
{
|
||||
_GroupBoxBorderColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GroupBoxConnectorColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GroupBox connector color
|
||||
/// </summary>
|
||||
[Description("Indicates the GroupBox connector color")]
|
||||
public Color GroupBoxConnectorColor
|
||||
{
|
||||
get { return (_GroupBoxConnectorColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_GroupBoxConnectorColor != value)
|
||||
{
|
||||
_GroupBoxConnectorColor = value;
|
||||
|
||||
OnPropertyChangedEx("GroupBoxConnectorColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeGroupBoxConnectorColor()
|
||||
{
|
||||
return (_GroupBoxBorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetGroupBoxConnectorColor()
|
||||
{
|
||||
_GroupBoxBorderColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GroupBoxBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GroupBox indicator background
|
||||
/// </summary>
|
||||
[Description("Indicates the RowHeader indicator background.")]
|
||||
public Background GroupBoxBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_GroupBoxBackground == null)
|
||||
{
|
||||
_GroupBoxBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _GroupBoxBackground);
|
||||
}
|
||||
|
||||
return (_GroupBoxBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_GroupBoxBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_GroupBoxBackground, value);
|
||||
|
||||
_GroupBoxBackground = value;
|
||||
|
||||
OnPropertyChangedEx("GroupBoxBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeGroupBoxBackground()
|
||||
{
|
||||
return (_GroupBoxBackground != null &&
|
||||
_GroupBoxBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetGroupBoxBackground()
|
||||
{
|
||||
GroupBoxBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GroupBoxTextColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GroupBox Text color
|
||||
/// </summary>
|
||||
[Description("Indicates the GroupBox Text color")]
|
||||
public Color GroupBoxTextColor
|
||||
{
|
||||
get { return (_GroupBoxTextColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_GroupBoxTextColor != value)
|
||||
{
|
||||
_GroupBoxTextColor = value;
|
||||
|
||||
OnPropertyChangedEx("GroupBoxTextColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeGroupBoxTextColor()
|
||||
{
|
||||
return (_GroupBoxTextColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetGroupBoxTextColor()
|
||||
{
|
||||
_GroupBoxTextColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InsertMarkerBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Insert Marker background color
|
||||
/// </summary>
|
||||
[Description("Indicates the Insert Marker background color")]
|
||||
public Background InsertMarkerBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_InsertMarkerBackground == null)
|
||||
{
|
||||
_InsertMarkerBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _InsertMarkerBackground);
|
||||
}
|
||||
|
||||
return (_InsertMarkerBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_InsertMarkerBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_InsertMarkerBackground, value);
|
||||
|
||||
_InsertMarkerBackground = value;
|
||||
|
||||
OnPropertyChangedEx("InsertMarkerBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeInsertMarkerBackground()
|
||||
{
|
||||
return (_InsertMarkerBackground != null &&
|
||||
_InsertMarkerBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetInsertMarkerBackground()
|
||||
{
|
||||
InsertMarkerBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InsertMarkerBorderColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Insert Marker border color
|
||||
/// </summary>
|
||||
[Description("Indicates the Insert Marker border color")]
|
||||
public Color InsertMarkerBorderColor
|
||||
{
|
||||
get { return (_InsertMarkerBorderColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_InsertMarkerBorderColor != value)
|
||||
{
|
||||
_InsertMarkerBorderColor = value;
|
||||
|
||||
OnPropertyChangedEx("InsertMarkerBorderColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeInsertMarkerBorderColor()
|
||||
{
|
||||
return (_InsertMarkerBorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetInsertMarkerBorderColor()
|
||||
{
|
||||
_InsertMarkerBorderColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WatermarkFont
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style Watermark Font
|
||||
/// </summary>
|
||||
[DefaultValue(null)]
|
||||
[Description("Indicates the style Watermark Font")]
|
||||
public Font WatermarkFont
|
||||
{
|
||||
get { return (_WatermarkFont); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_WatermarkFont != value)
|
||||
{
|
||||
_WatermarkFont = value;
|
||||
|
||||
OnPropertyChangedEx("WatermarkFont", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WatermarkTextColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Watermark Text color
|
||||
/// </summary>
|
||||
[Description("Indicates the Watermark Text color")]
|
||||
public Color WatermarkTextColor
|
||||
{
|
||||
get { return (_WatermarkTextColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_WatermarkTextColor != value)
|
||||
{
|
||||
_WatermarkTextColor = value;
|
||||
|
||||
OnPropertyChangedEx("WatermarkTextColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeWatermarkTextColor()
|
||||
{
|
||||
return (_WatermarkTextColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetWatermarkTextColor()
|
||||
{
|
||||
_WatermarkTextColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(GroupByVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.GroupBoxBorderColor.IsEmpty == false)
|
||||
GroupBoxBorderColor = style.GroupBoxBorderColor;
|
||||
|
||||
if (style.GroupBoxConnectorColor.IsEmpty == false)
|
||||
GroupBoxConnectorColor = style.GroupBoxConnectorColor;
|
||||
|
||||
if (style.GroupBoxTextColor.IsEmpty == false)
|
||||
GroupBoxTextColor = style.GroupBoxTextColor;
|
||||
|
||||
if (style.GroupBoxBackground != null && style.GroupBoxBackground.IsEmpty == false)
|
||||
GroupBoxBackground = style.GroupBoxBackground.Copy();
|
||||
|
||||
if (style.InsertMarkerBorderColor.IsEmpty == false)
|
||||
InsertMarkerBorderColor = style.InsertMarkerBorderColor;
|
||||
|
||||
if (style.InsertMarkerBackground != null && style.InsertMarkerBackground.IsEmpty == false)
|
||||
InsertMarkerBackground = style.InsertMarkerBackground.Copy();
|
||||
|
||||
if (style.WatermarkTextColor.IsEmpty == false)
|
||||
WatermarkTextColor = style.WatermarkTextColor;
|
||||
|
||||
if (style.WatermarkFont != null)
|
||||
WatermarkFont = style.WatermarkFont;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new FilterRowVisualStyle Copy()
|
||||
{
|
||||
FilterRowVisualStyle copy = new FilterRowVisualStyle();
|
||||
|
||||
CopyTo(copy);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(GroupByVisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
copy.GroupBoxBorderColor = _GroupBoxBorderColor;
|
||||
copy.GroupBoxTextColor = _GroupBoxTextColor;
|
||||
copy.GroupBoxConnectorColor = _GroupBoxConnectorColor;
|
||||
|
||||
if (_GroupBoxBackground != null)
|
||||
copy.GroupBoxBackground = _GroupBoxBackground.Copy();
|
||||
|
||||
copy.InsertMarkerBorderColor = _InsertMarkerBorderColor;
|
||||
|
||||
if (_InsertMarkerBackground != null)
|
||||
copy.InsertMarkerBackground = _InsertMarkerBackground.Copy();
|
||||
|
||||
copy.WatermarkTextColor = _WatermarkTextColor;
|
||||
|
||||
if (_WatermarkFont != null)
|
||||
copy.Font = (Font)_WatermarkFont.Clone();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
GroupBoxBackground = null;
|
||||
InsertMarkerBackground = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,500 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// GroupHeaderVisualStyles
|
||||
///</summary>
|
||||
public class GroupHeaderVisualStyles : VisualStyles<GroupHeaderVisualStyle>
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// RowHeaderVisualStyle
|
||||
///</summary>
|
||||
public class GroupHeaderVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Static data
|
||||
|
||||
///<summary>
|
||||
/// Empty
|
||||
///</summary>
|
||||
public static GroupHeaderVisualStyle Empty
|
||||
{
|
||||
get { return (new GroupHeaderVisualStyle()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private Font _Font;
|
||||
private Alignment _Alignment = Alignment.NotSet;
|
||||
private Tbool _AllowWrap = Tbool.NotSet;
|
||||
private Color _TextColor = Color.Empty;
|
||||
private Color _UnderlineColor = Color.Empty;
|
||||
private Background _Background;
|
||||
private Padding _Padding;
|
||||
|
||||
private RowHeaderVisualStyle _RowHeaderStyle;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Alignment
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alignment of the content within the cell
|
||||
/// </summary>
|
||||
[DefaultValue(Alignment.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the alignment of the content.")]
|
||||
public Alignment Alignment
|
||||
{
|
||||
get { return (_Alignment); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Alignment != value)
|
||||
{
|
||||
_Alignment = value;
|
||||
|
||||
OnPropertyChangedEx("Alignment", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AllowWrap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether text wrapping is permitted
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("Appearance")]
|
||||
[Description("Indicates whether text wrapping is permitted")]
|
||||
public Tbool AllowWrap
|
||||
{
|
||||
get { return (_AllowWrap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_AllowWrap != value)
|
||||
{
|
||||
_AllowWrap = value;
|
||||
|
||||
OnPropertyChangedEx("AllowWrap", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Background
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style background.
|
||||
/// </summary>
|
||||
[Description("Indicates the style background")]
|
||||
public Background Background
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Background == null)
|
||||
{
|
||||
_Background = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _Background);
|
||||
}
|
||||
|
||||
return (_Background);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Background != value)
|
||||
{
|
||||
UpdateChangeHandler(_Background, value);
|
||||
|
||||
_Background = value;
|
||||
|
||||
OnPropertyChangedEx("Background", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBackground()
|
||||
{
|
||||
return (_Background != null && _Background.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBackground()
|
||||
{
|
||||
Background = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Font
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style Font.
|
||||
/// </summary>
|
||||
[DefaultValue(null)]
|
||||
[Description("Indicates the style Font")]
|
||||
public Font Font
|
||||
{
|
||||
get { return (_Font); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Font != value)
|
||||
{
|
||||
_Font = value;
|
||||
|
||||
OnPropertyChangedEx("Font", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Padding
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the spacing between the content and edges of the element
|
||||
/// </summary>
|
||||
[Description("Indicates the spacing between the content and edges of the element")]
|
||||
public Padding Padding
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Padding == null)
|
||||
{
|
||||
_Padding = Padding.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _Padding);
|
||||
}
|
||||
|
||||
return (_Padding);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Padding != value)
|
||||
{
|
||||
UpdateChangeHandler(_Padding, value);
|
||||
|
||||
_Padding = value;
|
||||
|
||||
OnPropertyChangedEx("Padding", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializePadding()
|
||||
{
|
||||
return (_Padding != null && _Padding.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetPadding()
|
||||
{
|
||||
Padding = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region RowHeaderStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GroupHeader RowHeader Style
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the GroupHeader RowHeader Style")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public RowHeaderVisualStyle RowHeaderStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_RowHeaderStyle == null)
|
||||
{
|
||||
_RowHeaderStyle = RowHeaderVisualStyle.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _RowHeaderStyle);
|
||||
}
|
||||
|
||||
return (_RowHeaderStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_RowHeaderStyle != value)
|
||||
{
|
||||
UpdateChangeHandler(_RowHeaderStyle, value);
|
||||
|
||||
_RowHeaderStyle = value;
|
||||
|
||||
OnPropertyChangedEx("RowHeaderStyle", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Text color
|
||||
/// </summary>
|
||||
[Category("Appearance"), Description("Indicates the Text color")]
|
||||
public Color TextColor
|
||||
{
|
||||
get { return (_TextColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_TextColor != value)
|
||||
{
|
||||
_TextColor = value;
|
||||
|
||||
OnPropertyChangedEx("TextColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeTextColor()
|
||||
{
|
||||
return (_TextColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetTextColor()
|
||||
{
|
||||
_TextColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UnderlineColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the text Underline Color
|
||||
/// </summary>
|
||||
[Description("Indicates the text Underline Color")]
|
||||
public Color UnderlineColor
|
||||
{
|
||||
get { return (_UnderlineColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_UnderlineColor != value)
|
||||
{
|
||||
_UnderlineColor = value;
|
||||
|
||||
OnPropertyChangedEx("UnderlineColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeUnderlineColor()
|
||||
{
|
||||
return (_UnderlineColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetUnderlineColor()
|
||||
{
|
||||
_UnderlineColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(GroupHeaderVisualStyle style)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.Alignment != Alignment.NotSet)
|
||||
Alignment = style.Alignment;
|
||||
|
||||
if (style.AllowWrap != Tbool.NotSet)
|
||||
AllowWrap = style.AllowWrap;
|
||||
|
||||
if (style._Background != null && style._Background.IsEmpty == false)
|
||||
Background = style._Background.Copy();
|
||||
|
||||
if (style.Font != null)
|
||||
Font = style.Font;
|
||||
|
||||
if (style._Padding != null && style._Padding.IsEmpty == false)
|
||||
Padding = style._Padding.Copy();
|
||||
|
||||
if (style.TextColor.IsEmpty == false)
|
||||
TextColor = style.TextColor;
|
||||
|
||||
if (style.UnderlineColor.IsEmpty == false)
|
||||
UnderlineColor = style.UnderlineColor;
|
||||
|
||||
if (style._RowHeaderStyle != null)
|
||||
RowHeaderStyle.ApplyStyle(style._RowHeaderStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetTextFormatFlags
|
||||
|
||||
internal eTextFormat GetTextFormatFlags()
|
||||
{
|
||||
eTextFormat tf = eTextFormat.WordEllipsis |
|
||||
eTextFormat.NoPadding | eTextFormat.NoPrefix;
|
||||
|
||||
if (AllowWrap == Tbool.True)
|
||||
tf |= eTextFormat.WordBreak;
|
||||
|
||||
switch (Alignment)
|
||||
{
|
||||
case Alignment.TopCenter:
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
tf |= eTextFormat.Right;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleLeft:
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleCenter:
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleRight:
|
||||
tf |= eTextFormat.Right;
|
||||
tf |= eTextFormat.VerticalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.BottomLeft:
|
||||
tf |= eTextFormat.Bottom;
|
||||
break;
|
||||
|
||||
case Alignment.BottomCenter:
|
||||
tf |= eTextFormat.Bottom;
|
||||
tf |= eTextFormat.HorizontalCenter;
|
||||
break;
|
||||
|
||||
case Alignment.BottomRight:
|
||||
tf |= eTextFormat.Bottom;
|
||||
tf |= eTextFormat.Right;
|
||||
break;
|
||||
}
|
||||
|
||||
return (tf);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new GroupHeaderVisualStyle Copy()
|
||||
{
|
||||
GroupHeaderVisualStyle copy = new GroupHeaderVisualStyle();
|
||||
|
||||
CopyTo(copy);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(GroupHeaderVisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
copy.Alignment = _Alignment;
|
||||
copy.AllowWrap = _AllowWrap;
|
||||
|
||||
if (_Background != null)
|
||||
copy.Background = _Background.Copy();
|
||||
|
||||
if (_Font != null)
|
||||
copy.Font = (Font)_Font.Clone();
|
||||
|
||||
if (_Padding != null)
|
||||
copy.Padding = _Padding.Copy();
|
||||
|
||||
copy.TextColor = _TextColor;
|
||||
copy.UnderlineColor = _UnderlineColor;
|
||||
|
||||
if (_RowHeaderStyle != null)
|
||||
copy.RowHeaderStyle = _RowHeaderStyle.Copy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
Background = null;
|
||||
Padding = null;
|
||||
RowHeaderStyle = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,227 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// Padding
|
||||
///</summary>
|
||||
[TypeConverter(typeof(PaddingTypeConverter))]
|
||||
public class Padding : Thickness
|
||||
{
|
||||
#region Static data
|
||||
|
||||
/// <summary>
|
||||
/// Returns Empty instance of Thickness.
|
||||
/// </summary>
|
||||
public new static Padding Empty
|
||||
{
|
||||
get { return (new Padding()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the class and initializes it.
|
||||
/// </summary>
|
||||
/// <param name="left">Left padding</param>
|
||||
/// <param name="right">Right padding</param>
|
||||
/// <param name="top">Top padding</param>
|
||||
/// <param name="bottom">Bottom padding</param>
|
||||
public Padding(int left, int top, int right, int bottom)
|
||||
: base(left, top, right, bottom)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Padding class.
|
||||
/// </summary>
|
||||
/// <param name="all">Uniform padding.</param>
|
||||
public Padding(int all)
|
||||
: base(all)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Padding class.
|
||||
/// </summary>
|
||||
public Padding()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Creates an exact copy of the Padding.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the Padding.</returns>
|
||||
public new Padding Copy()
|
||||
{
|
||||
Padding copy = new Padding(Left, Top, Right, Bottom);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region PaddingTypeConverter
|
||||
|
||||
///<summary>
|
||||
/// PaddingTypeConverter
|
||||
///</summary>
|
||||
public class PaddingTypeConverter : ExpandableObjectConverter
|
||||
{
|
||||
#region CanConvertTo
|
||||
|
||||
/// <summary>
|
||||
/// CanConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvertTo(
|
||||
ITypeDescriptorContext context, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
return (true);
|
||||
|
||||
return (base.CanConvertTo(context, destinationType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConvertTo
|
||||
|
||||
/// <summary>
|
||||
/// ConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
{
|
||||
Padding p = value as Padding;
|
||||
|
||||
if (p != null)
|
||||
{
|
||||
if (p.IsUniform == true)
|
||||
return (p.Left.ToString());
|
||||
|
||||
return (String.Format("{0:d}, {1:d}, {2:d}, {3:d}",
|
||||
p.Bottom, p.Left, p.Right, p.Top));
|
||||
}
|
||||
}
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CanConvertFrom
|
||||
|
||||
/// <summary>
|
||||
/// CanConvertFrom
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="sourceType"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvertFrom(
|
||||
ITypeDescriptorContext context, Type sourceType)
|
||||
{
|
||||
if (sourceType == typeof(string))
|
||||
return (true);
|
||||
|
||||
return (base.CanConvertFrom(context, sourceType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConvertFrom
|
||||
|
||||
/// <summary>
|
||||
/// ConvertFrom
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertFrom(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
if (value is string)
|
||||
{
|
||||
string[] values = ((string)value).Split(',');
|
||||
|
||||
if (values.Length != 1 && values.Length != 4)
|
||||
throw new ArgumentException("Invalid value to convert.");
|
||||
|
||||
try
|
||||
{
|
||||
int[] v = new int[values.Length];
|
||||
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
v[i] = int.Parse(values[i]);
|
||||
|
||||
Padding p = (values.Length == 1)
|
||||
? new Padding(v[0])
|
||||
: new Padding(v[1], v[3], v[2], v[0]);
|
||||
|
||||
return (p);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new ArgumentException("Invalid value to convert.");
|
||||
}
|
||||
}
|
||||
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetCreateInstanceSupported
|
||||
|
||||
/// <summary>
|
||||
/// GetCreateInstanceSupported
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public override bool GetCreateInstanceSupported(ITypeDescriptorContext context)
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateInstance
|
||||
|
||||
/// <summary>
|
||||
/// CreateInstance
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="propertyValues"></param>
|
||||
/// <returns></returns>
|
||||
public override object CreateInstance(
|
||||
ITypeDescriptorContext context, IDictionary propertyValues)
|
||||
{
|
||||
return (new Padding((int)propertyValues["Left"], (int)propertyValues["Top"],
|
||||
(int)propertyValues["Right"], (int)propertyValues["Bottom"]));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
@@ -0,0 +1,609 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// RowHeaderVisualStyle
|
||||
///</summary>
|
||||
public class RowHeaderVisualStyle : BaseRowHeaderVisualStyle
|
||||
{
|
||||
#region Static data
|
||||
|
||||
static Image _ActiveRowImageCache;
|
||||
static Image _EditingRowImageCache;
|
||||
static Image _InfoRowImageCache;
|
||||
|
||||
///<summary>
|
||||
/// Empty
|
||||
///</summary>
|
||||
public new static RowHeaderVisualStyle Empty
|
||||
{
|
||||
get { return (new RowHeaderVisualStyle()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private Background _ActiveRowBackground;
|
||||
private Background _DirtyMarkerBackground;
|
||||
|
||||
private Color _ActiveRowIndicatorColor = Color.Empty;
|
||||
|
||||
private Image _ActiveRowImage;
|
||||
private int _ActiveRowImageIndex = -1;
|
||||
|
||||
private Image _EditingRowImage;
|
||||
private int _EditingRowImageIndex = -1;
|
||||
|
||||
private Image _InfoRowImage;
|
||||
private int _InfoRowImageIndex = -1;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region ActiveRowBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ActiveRow background
|
||||
/// </summary>
|
||||
[Description("Indicates the ActiveRow background")]
|
||||
public Background ActiveRowBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ActiveRowBackground == null)
|
||||
{
|
||||
_ActiveRowBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _ActiveRowBackground);
|
||||
}
|
||||
|
||||
return (_ActiveRowBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_ActiveRowBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_ActiveRowBackground, value);
|
||||
|
||||
_ActiveRowBackground = value;
|
||||
|
||||
OnPropertyChangedEx("ActiveRowBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeActiveRowBackground()
|
||||
{
|
||||
return (_ActiveRowBackground != null && _ActiveRowBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetActiveRowBackground()
|
||||
{
|
||||
ActiveRowBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ActiveRowImage
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Active Row Image
|
||||
/// </summary>
|
||||
[DefaultValue(null), Category("Appearance")]
|
||||
[Description("Indicates the Active Row image")]
|
||||
public Image ActiveRowImage
|
||||
{
|
||||
get { return (_ActiveRowImage); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ActiveRowImage != value)
|
||||
{
|
||||
_ActiveRowImage = value;
|
||||
|
||||
OnPropertyChangedEx("ActiveRowImage", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ActiveRowImageIndex
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Active Row image index
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(-1)]
|
||||
[Category("Appearance"), Description("Indicates the Active Row image index")]
|
||||
[Editor("DevComponents.SuperGrid.Design.ImageIndexEditor, DevComponents.SuperGrid.Design, Version=14.1.0.37, Culture=neutral, PublicKeyToken=26d81176cfa2b486", typeof(UITypeEditor))]
|
||||
[TypeConverter(typeof(ImageIndexConverter))]
|
||||
public int ActiveRowImageIndex
|
||||
{
|
||||
get { return (_ActiveRowImageIndex); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ActiveRowImageIndex != value)
|
||||
{
|
||||
_ActiveRowImageIndex = value;
|
||||
|
||||
OnPropertyChangedEx("ActiveRowImageIndex", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetActiveRowImageIndex()
|
||||
{
|
||||
_ActiveRowImageIndex = -1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ActiveRowIndicatorColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Active Row Indicator color
|
||||
/// </summary>
|
||||
[Description("Indicates the Active Row Indicator color")]
|
||||
public Color ActiveRowIndicatorColor
|
||||
{
|
||||
get { return (_ActiveRowIndicatorColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ActiveRowIndicatorColor != value)
|
||||
{
|
||||
_ActiveRowIndicatorColor = value;
|
||||
|
||||
OnPropertyChangedEx("ActiveRowIndicatorColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeActiveRowIndicatorColor()
|
||||
{
|
||||
return (_ActiveRowIndicatorColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetActiveRowIndicatorColor()
|
||||
{
|
||||
_ActiveRowIndicatorColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DirtyMarkerBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DirtyRow marker background
|
||||
/// </summary>
|
||||
[Description("Indicates the DirtyRow marker background")]
|
||||
public Background DirtyMarkerBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DirtyMarkerBackground == null)
|
||||
{
|
||||
_DirtyMarkerBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _DirtyMarkerBackground);
|
||||
}
|
||||
|
||||
return (_DirtyMarkerBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_DirtyMarkerBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_DirtyMarkerBackground, value);
|
||||
|
||||
_DirtyMarkerBackground = value;
|
||||
|
||||
OnPropertyChangedEx("DirtyMarkerBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeDirtyMarkerBackground()
|
||||
{
|
||||
return (_DirtyMarkerBackground != null && _DirtyMarkerBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetDirtyMarkerBackground()
|
||||
{
|
||||
DirtyMarkerBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditingRowImage
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Editing Row Image
|
||||
/// </summary>
|
||||
[DefaultValue(null), Category("Appearance")]
|
||||
[Description("Indicates the Editing Row image")]
|
||||
public Image EditingRowImage
|
||||
{
|
||||
get { return (_EditingRowImage); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditingRowImage != value)
|
||||
{
|
||||
_EditingRowImage = value;
|
||||
|
||||
OnPropertyChangedEx("EditingRowImage", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditingRowImageIndex
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Editing Row image index
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(-1)]
|
||||
[Category("Appearance"), Description("Indicates the Editing Row image index")]
|
||||
[Editor("DevComponents.SuperGrid.Design.ImageIndexEditor, DevComponents.SuperGrid.Design, Version=14.1.0.37, Culture=neutral, PublicKeyToken=26d81176cfa2b486", typeof(UITypeEditor))]
|
||||
[TypeConverter(typeof(ImageIndexConverter))]
|
||||
public int EditingRowImageIndex
|
||||
{
|
||||
get { return (_EditingRowImageIndex); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditingRowImageIndex != value)
|
||||
{
|
||||
_EditingRowImageIndex = value;
|
||||
|
||||
OnPropertyChangedEx("EditingRowImageIndex", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetEditingRowImageIndex()
|
||||
{
|
||||
_EditingRowImageIndex = -1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InfoRowImage
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Info Row Image
|
||||
/// </summary>
|
||||
[DefaultValue(null), Category("Appearance")]
|
||||
[Description("Indicates the Info Row image")]
|
||||
public Image InfoRowImage
|
||||
{
|
||||
get { return (_InfoRowImage); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_InfoRowImage != value)
|
||||
{
|
||||
_InfoRowImage = value;
|
||||
|
||||
OnPropertyChangedEx("InfoRowImage", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InfoRowImageIndex
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Info Row image index
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(-1)]
|
||||
[Category("Appearance"), Description("Indicates the Info Row image index")]
|
||||
[Editor("DevComponents.SuperGrid.Design.ImageIndexEditor, DevComponents.SuperGrid.Design, Version=14.1.0.37, Culture=neutral, PublicKeyToken=26d81176cfa2b486", typeof(UITypeEditor))]
|
||||
[TypeConverter(typeof(ImageIndexConverter))]
|
||||
public int InfoRowImageIndex
|
||||
{
|
||||
get { return (_InfoRowImageIndex); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_InfoRowImageIndex != value)
|
||||
{
|
||||
_InfoRowImageIndex = value;
|
||||
|
||||
OnPropertyChangedEx("InfoRowImageIndex", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetInfoRowImageIndex()
|
||||
{
|
||||
_InfoRowImageIndex = -1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetActiveRowImage
|
||||
|
||||
internal Image GetActiveRowImage(GridPanel panel)
|
||||
{
|
||||
if (_ActiveRowImage != null)
|
||||
return (_ActiveRowImage);
|
||||
|
||||
if (_ActiveRowImageIndex >= 0 && panel != null)
|
||||
{
|
||||
ImageList imageList = panel.ImageList;
|
||||
|
||||
if (imageList != null && _ActiveRowImageIndex < imageList.Images.Count)
|
||||
return (imageList.Images[_ActiveRowImageIndex]);
|
||||
}
|
||||
|
||||
return (GetActiveRowImage());
|
||||
}
|
||||
|
||||
#region GetActiveRowImage
|
||||
|
||||
private Image GetActiveRowImage()
|
||||
{
|
||||
if (_ActiveRowImage != null)
|
||||
return (_ActiveRowImage);
|
||||
|
||||
if (_ActiveRowImageCache == null)
|
||||
{
|
||||
Rectangle r = new Rectangle(0, 0, Dpi.Width4, Dpi.Height7);
|
||||
Image image = new Bitmap(Dpi.Width4, Dpi.Height7);
|
||||
|
||||
using (Graphics g = Graphics.FromImage(image))
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
Point pt = new Point(r.Right, r.Y + r.Height / 2);
|
||||
|
||||
Point[] pts =
|
||||
{
|
||||
pt,
|
||||
new Point(pt.X - Dpi.Width4, pt.Y + Dpi.Height4),
|
||||
new Point(pt.X - Dpi.Width4, pt.Y - Dpi.Height4),
|
||||
pt
|
||||
};
|
||||
|
||||
path.AddLines(pts);
|
||||
|
||||
Color color = ActiveRowIndicatorColor;
|
||||
|
||||
if (color.IsEmpty)
|
||||
color = Color.Black;
|
||||
|
||||
using (Brush br = new SolidBrush(color))
|
||||
g.FillPath(br, path);
|
||||
}
|
||||
}
|
||||
|
||||
_ActiveRowImageCache = image;
|
||||
}
|
||||
|
||||
return (_ActiveRowImageCache);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetEditingRowImage
|
||||
|
||||
internal Image GetEditingRowImage(GridPanel panel)
|
||||
{
|
||||
if (_EditingRowImage != null)
|
||||
return (_EditingRowImage);
|
||||
|
||||
if (_EditingRowImageIndex >= 0 && panel != null)
|
||||
{
|
||||
ImageList imageList = panel.ImageList;
|
||||
|
||||
if (imageList != null && _EditingRowImageIndex < imageList.Images.Count)
|
||||
return (imageList.Images[_EditingRowImageIndex]);
|
||||
}
|
||||
|
||||
if (_EditingRowImageCache == null)
|
||||
_EditingRowImageCache = panel.GetResourceImage("Pencil");
|
||||
|
||||
return (_EditingRowImageCache);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetInfoRowImage
|
||||
|
||||
internal Image GetInfoRowImage(GridPanel panel)
|
||||
{
|
||||
if (_InfoRowImage != null)
|
||||
return (_InfoRowImage);
|
||||
|
||||
if (_InfoRowImageIndex >= 0 && panel != null)
|
||||
{
|
||||
ImageList imageList = panel.ImageList;
|
||||
|
||||
if (imageList != null && _InfoRowImageIndex < imageList.Images.Count)
|
||||
return (imageList.Images[_InfoRowImageIndex]);
|
||||
}
|
||||
|
||||
if (_InfoRowImageCache == null)
|
||||
_InfoRowImageCache = panel.GetResourceImage("InfoImage");
|
||||
|
||||
return (_InfoRowImageCache);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(RowHeaderVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style._ActiveRowIndicatorColor.IsEmpty == false)
|
||||
_ActiveRowIndicatorColor = style._ActiveRowIndicatorColor;
|
||||
|
||||
if (style._ActiveRowBackground != null && style._ActiveRowBackground.IsEmpty == false)
|
||||
_ActiveRowBackground = style._ActiveRowBackground.Copy();
|
||||
|
||||
if (style._DirtyMarkerBackground != null && style._DirtyMarkerBackground.IsEmpty == false)
|
||||
_DirtyMarkerBackground = style._DirtyMarkerBackground.Copy();
|
||||
|
||||
if (style.ActiveRowImageIndex >= 0)
|
||||
{
|
||||
_ActiveRowImage = null;
|
||||
_ActiveRowImageIndex = style.ActiveRowImageIndex;
|
||||
}
|
||||
|
||||
if (style.ActiveRowImage != null)
|
||||
{
|
||||
_ActiveRowImage = style.ActiveRowImage;
|
||||
_ActiveRowImageIndex = -1;
|
||||
}
|
||||
|
||||
if (style.EditingRowImageIndex >= 0)
|
||||
{
|
||||
_EditingRowImage = null;
|
||||
_EditingRowImageIndex = style.EditingRowImageIndex;
|
||||
}
|
||||
|
||||
if (style.EditingRowImage != null)
|
||||
{
|
||||
_EditingRowImage = style.EditingRowImage;
|
||||
_EditingRowImageIndex = -1;
|
||||
}
|
||||
|
||||
if (style.InfoRowImageIndex >= 0)
|
||||
{
|
||||
_InfoRowImage = null;
|
||||
_InfoRowImageIndex = style.InfoRowImageIndex;
|
||||
}
|
||||
|
||||
if (style.InfoRowImage != null)
|
||||
{
|
||||
_InfoRowImage = style.InfoRowImage;
|
||||
_InfoRowImageIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new RowHeaderVisualStyle Copy()
|
||||
{
|
||||
RowHeaderVisualStyle copy = new RowHeaderVisualStyle();
|
||||
|
||||
CopyTo(copy);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(RowHeaderVisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
if (_ActiveRowIndicatorColor.IsEmpty == false)
|
||||
copy.ActiveRowIndicatorColor = _ActiveRowIndicatorColor;
|
||||
|
||||
if (_ActiveRowBackground != null)
|
||||
copy.ActiveRowBackground = _ActiveRowBackground.Copy();
|
||||
|
||||
if (_DirtyMarkerBackground != null)
|
||||
copy.DirtyMarkerBackground = _DirtyMarkerBackground.Copy();
|
||||
|
||||
copy.ActiveRowImage = _ActiveRowImage;
|
||||
copy.ActiveRowImageIndex = _ActiveRowImageIndex;
|
||||
|
||||
copy.EditingRowImage = _EditingRowImage;
|
||||
copy.EditingRowImageIndex = _EditingRowImageIndex;
|
||||
|
||||
copy.InfoRowImage = _InfoRowImage;
|
||||
copy.InfoRowImageIndex = _InfoRowImageIndex;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
DirtyMarkerBackground = null;
|
||||
ActiveRowBackground = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,192 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// RowVisualStyles
|
||||
///</summary>
|
||||
public class RowVisualStyles : VisualStyles<RowVisualStyle>
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// RowVisualStyle
|
||||
///</summary>
|
||||
public class RowVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Background _Background;
|
||||
private RowHeaderVisualStyle _RowHeaderStyle;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Background
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style background.
|
||||
/// </summary>
|
||||
[Description("Indicates the style background")]
|
||||
public Background Background
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Background == null)
|
||||
{
|
||||
_Background = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _Background);
|
||||
}
|
||||
|
||||
return (_Background);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Background != value)
|
||||
{
|
||||
UpdateChangeHandler(_Background, value);
|
||||
|
||||
_Background = value;
|
||||
|
||||
OnPropertyChangedEx("Background", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBackground()
|
||||
{
|
||||
return (_Background != null && Background.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBackground()
|
||||
{
|
||||
Background = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RowHeaderStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the RowHeader Style
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the RowHeader Style.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public RowHeaderVisualStyle RowHeaderStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_RowHeaderStyle == null)
|
||||
{
|
||||
_RowHeaderStyle = RowHeaderVisualStyle.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _RowHeaderStyle);
|
||||
}
|
||||
|
||||
return (_RowHeaderStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_RowHeaderStyle != value)
|
||||
{
|
||||
UpdateChangeHandler(_RowHeaderStyle, value);
|
||||
|
||||
_RowHeaderStyle = value;
|
||||
|
||||
OnPropertyChangedEx("RowHeaderStyle", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(RowVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.Background != null && style.Background.IsEmpty == false)
|
||||
Background = style.Background.Copy();
|
||||
|
||||
if (style._RowHeaderStyle != null)
|
||||
RowHeaderStyle.ApplyStyle(style._RowHeaderStyle);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new RowVisualStyle Copy()
|
||||
{
|
||||
RowVisualStyle style = new RowVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(RowVisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
if (_Background != null)
|
||||
copy.Background = _Background.Copy();
|
||||
|
||||
if (_RowHeaderStyle != null)
|
||||
copy.RowHeaderStyle = _RowHeaderStyle.Copy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
Background = null;
|
||||
RowHeaderStyle = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,163 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// TextRowVisualStyles
|
||||
///</summary>
|
||||
public class TextRowVisualStyles : VisualStyles<TextRowVisualStyle>
|
||||
{
|
||||
#region Hidden properties
|
||||
|
||||
#region Empty
|
||||
|
||||
/// <summary>
|
||||
/// Empty
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new TextRowVisualStyle Empty
|
||||
{
|
||||
get { return (base.Empty); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region NotSelectable
|
||||
|
||||
/// <summary>
|
||||
/// NotSelectable
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new TextRowVisualStyle NotSelectable
|
||||
{
|
||||
get { return (base.NotSelectable); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// TextRowVisualStyle
|
||||
///</summary>
|
||||
public class TextRowVisualStyle : CellVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private BaseRowHeaderVisualStyle _RowHeaderStyle;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region RowHeaderStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the RowHeader Style
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the RowHeader Style")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public BaseRowHeaderVisualStyle RowHeaderStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_RowHeaderStyle == null)
|
||||
{
|
||||
_RowHeaderStyle = BaseRowHeaderVisualStyle.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _RowHeaderStyle);
|
||||
}
|
||||
|
||||
return (_RowHeaderStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_RowHeaderStyle != value)
|
||||
{
|
||||
UpdateChangeHandler(_RowHeaderStyle, value);
|
||||
|
||||
_RowHeaderStyle = value;
|
||||
|
||||
OnPropertyChangedEx("RowHeaderStyle", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(TextRowVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style._RowHeaderStyle != null)
|
||||
RowHeaderStyle.ApplyStyle(style._RowHeaderStyle);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new TextRowVisualStyle Copy()
|
||||
{
|
||||
TextRowVisualStyle copy = new TextRowVisualStyle();
|
||||
|
||||
CopyTo(copy);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(TextRowVisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
if (_RowHeaderStyle != null)
|
||||
copy.RowHeaderStyle = _RowHeaderStyle.Copy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
RowHeaderStyle = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,543 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines Thickness class.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(ThicknessTypeConverter))]
|
||||
public class Thickness : IEquatable<Thickness>, INotifyPropertyChanged
|
||||
{
|
||||
#region Static data
|
||||
|
||||
/// <summary>
|
||||
/// Returns Empty instance of Thickness.
|
||||
/// </summary>
|
||||
public static Thickness Empty
|
||||
{
|
||||
get { return (new Thickness(0)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private int _Bottom;
|
||||
private int _Left;
|
||||
private int _Right;
|
||||
private int _Top;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="left">Left thickness in pixels.</param>
|
||||
/// <param name="top">Top thickness in pixels.</param>
|
||||
/// <param name="right">Right thickness in pixels.</param>
|
||||
/// <param name="bottom">Bottom thickness in pixels.</param>
|
||||
public Thickness(int left, int top, int right, int bottom)
|
||||
{
|
||||
_Left = left;
|
||||
_Top = top;
|
||||
_Right = right;
|
||||
_Bottom = bottom;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="all">Specifies uniform Thickness.</param>
|
||||
public Thickness(int all)
|
||||
: this(all, all, all, all)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
public Thickness()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region All
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the thickness of all sides
|
||||
/// </summary>
|
||||
//[Browsable(false)]
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public int All
|
||||
{
|
||||
set { _Top = _Left = _Bottom = _Right = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Bottom
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Bottom thickness in pixels.
|
||||
/// </summary>
|
||||
[DefaultValue(0)]
|
||||
[Description("Indicates the Bottom thickness in pixels.")]
|
||||
public int Bottom
|
||||
{
|
||||
get { return (_Bottom); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Bottom != value)
|
||||
{
|
||||
_Bottom = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Bottom"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Horizontal
|
||||
|
||||
/// <summary>
|
||||
/// Gets horizontal thickness (Left + Right)
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public int Horizontal
|
||||
{
|
||||
get { return (_Left + _Right); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the item is empty.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left == 0 && _Right == 0 &&
|
||||
_Top == 0 && _Bottom == 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Left
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the left thickness in pixels
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(0)]
|
||||
[Description("Indicates the left thickness in pixels")]
|
||||
public int Left
|
||||
{
|
||||
get { return (_Left); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Left != value)
|
||||
{
|
||||
_Left = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Left"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Right
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Right thickness in pixels
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(0)]
|
||||
[Description("Indicates the Right thickness in pixels")]
|
||||
public int Right
|
||||
{
|
||||
get { return (_Right); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Right != value)
|
||||
{
|
||||
_Right = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Right"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Top
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Top thickness in pixels
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(0)]
|
||||
[Description("Indicates the Top thickness in pixels")]
|
||||
public int Top
|
||||
{
|
||||
get { return (_Top); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Top != value)
|
||||
{
|
||||
_Top = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Top"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Vertical
|
||||
|
||||
/// <summary>
|
||||
/// Gets vertical thickness (Top + Bottom)
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public int Vertical
|
||||
{
|
||||
get { return (_Top + _Bottom); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region IsUniform
|
||||
|
||||
internal bool IsUniform
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Dpi.Factor.Height == Dpi.Factor.Width &&
|
||||
_Left == _Top && _Left == _Right && _Left == _Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsZero
|
||||
|
||||
internal bool IsZero
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left == 0 && _Top == 0 &&
|
||||
_Right == 0 && _Bottom == 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Size
|
||||
|
||||
internal Size Size
|
||||
{
|
||||
get { return (new Size(_Left + _Right, _Top + _Bottom)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Equals
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether two instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="obj">Instance to compare to.</param>
|
||||
/// <returns>true if equal otherwise false.</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Thickness)
|
||||
return (this == (Thickness)obj);
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether two instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="thickness">Instance to compare to</param>
|
||||
/// <returns>true if equal otherwise false</returns>
|
||||
public bool Equals(Thickness thickness)
|
||||
{
|
||||
return (this == thickness);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
|
||||
/// <summary>
|
||||
/// Returns hash-code.
|
||||
/// </summary>
|
||||
/// <returns>hash-code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (((_Left.GetHashCode() ^ _Top.GetHashCode()) ^
|
||||
_Right.GetHashCode()) ^ _Bottom.GetHashCode());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
|
||||
#region "==" operator
|
||||
|
||||
/// <summary>
|
||||
/// Implements == operator.
|
||||
/// </summary>
|
||||
/// <param name="t1">Object 1</param>
|
||||
/// <param name="t2">Object 2</param>
|
||||
/// <returns>true if equals</returns>
|
||||
public static bool operator ==(Thickness t1, Thickness t2)
|
||||
{
|
||||
if (ReferenceEquals(t1, t2))
|
||||
return (true);
|
||||
|
||||
if (((object)t1 == null) || ((object)t2 == null))
|
||||
return (false);
|
||||
|
||||
return (t1._Left == t2._Left && t1._Right == t2._Right &&
|
||||
t1._Top == t2._Top && t1._Bottom == t2._Bottom);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "!=" operator
|
||||
|
||||
/// <summary>
|
||||
/// Implements != operator
|
||||
/// </summary>
|
||||
/// <param name="t1">Object 1</param>
|
||||
/// <param name="t2">Object 2</param>
|
||||
/// <returns>true if different</returns>
|
||||
public static bool operator !=(Thickness t1, Thickness t2)
|
||||
{
|
||||
return ((t1 == t2) == false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Creates an exact copy of the Thickness.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the Thickness.</returns>
|
||||
public Thickness Copy()
|
||||
{
|
||||
Thickness copy = new Thickness(_Left, _Top, _Right, _Bottom);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
void OnPropertyChanged(VisualPropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region ThicknessTypeConverter
|
||||
|
||||
///<summary>
|
||||
/// ThicknessTypeConverter
|
||||
///</summary>
|
||||
public class ThicknessTypeConverter : ExpandableObjectConverter
|
||||
{
|
||||
#region CanConvertTo
|
||||
|
||||
/// <summary>
|
||||
/// CanConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvertTo(
|
||||
ITypeDescriptorContext context, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
return (true);
|
||||
|
||||
return (base.CanConvertTo(context, destinationType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConvertTo
|
||||
|
||||
/// <summary>
|
||||
/// ConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
{
|
||||
Thickness t = value as Thickness;
|
||||
|
||||
if (t != null)
|
||||
{
|
||||
if (t.IsUniform == true)
|
||||
return (t.Left.ToString());
|
||||
|
||||
return (String.Format("{0:d}, {1:d}, {2:d}, {3:d}",
|
||||
t.Bottom, t.Left, t.Right, t.Top));
|
||||
}
|
||||
}
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CanConvertFrom
|
||||
|
||||
/// <summary>
|
||||
/// CanConvertFrom
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="sourceType"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvertFrom(
|
||||
ITypeDescriptorContext context, Type sourceType)
|
||||
{
|
||||
if (sourceType == typeof(string))
|
||||
return (true);
|
||||
|
||||
return (base.CanConvertFrom(context, sourceType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConvertFrom
|
||||
|
||||
/// <summary>
|
||||
/// ConvertFrom
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertFrom(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
if (value is string)
|
||||
{
|
||||
string[] values = ((string)value).Split(',');
|
||||
|
||||
if (values.Length != 1 && values.Length != 4)
|
||||
throw new ArgumentException("Invalid value to convert.");
|
||||
|
||||
try
|
||||
{
|
||||
int[] v = new int[values.Length];
|
||||
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
v[i] = int.Parse(values[i]);
|
||||
|
||||
Thickness t = (values.Length == 1)
|
||||
? new Thickness(v[0])
|
||||
: new Thickness(v[1], v[3], v[2], v[0]);
|
||||
|
||||
return (t);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new ArgumentException("Invalid value to convert.");
|
||||
}
|
||||
}
|
||||
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetCreateInstanceSupported
|
||||
|
||||
/// <summary>
|
||||
/// GetCreateInstanceSupported
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public override bool GetCreateInstanceSupported(ITypeDescriptorContext context)
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateInstance
|
||||
|
||||
/// <summary>
|
||||
/// CreateInstance
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="propertyValues"></param>
|
||||
/// <returns></returns>
|
||||
public override object CreateInstance(
|
||||
ITypeDescriptorContext context, IDictionary propertyValues)
|
||||
{
|
||||
return (new Thickness((int)propertyValues["Left"], (int)propertyValues["Top"],
|
||||
(int)propertyValues["Right"], (int)propertyValues["Bottom"]));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
@@ -0,0 +1,655 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Row.
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(BlankExpandableObjectConverter))]
|
||||
public class BaseTreeButtonVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Static data
|
||||
|
||||
///<summary>
|
||||
/// Empty
|
||||
///</summary>
|
||||
public static BaseTreeButtonVisualStyle Empty
|
||||
{
|
||||
get { return (new BaseTreeButtonVisualStyle()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private Color _BorderColor = Color.Empty;
|
||||
private Color _HotBorderColor = Color.Empty;
|
||||
private Color _LineColor = Color.Empty;
|
||||
private Color _HotLineColor = Color.Empty;
|
||||
|
||||
private Background _Background;
|
||||
private Background _HotBackground;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Background
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the TreeButton background.
|
||||
/// </summary>
|
||||
[Description("Indicates the TreeButton background")]
|
||||
public Background Background
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Background == null)
|
||||
{
|
||||
_Background = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _Background);
|
||||
}
|
||||
|
||||
return (_Background);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Background != value)
|
||||
{
|
||||
UpdateChangeHandler(_Background, value);
|
||||
|
||||
_Background = value;
|
||||
|
||||
OnPropertyChangedEx("Background", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBackground()
|
||||
{
|
||||
return (_Background != null && _Background.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBackground()
|
||||
{
|
||||
_Background = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HotBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Hot background.
|
||||
/// </summary>
|
||||
[Description("Indicates the Hot background")]
|
||||
public Background HotBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_HotBackground == null)
|
||||
{
|
||||
_HotBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _HotBackground);
|
||||
}
|
||||
|
||||
return (_HotBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_HotBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_HotBackground, value);
|
||||
|
||||
_HotBackground = value;
|
||||
|
||||
OnPropertyChangedEx("HotBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeHotBackground()
|
||||
{
|
||||
return (_HotBackground != null && _HotBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetHotBackground()
|
||||
{
|
||||
HotBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BorderColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the border Color
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the border Color.")]
|
||||
public Color BorderColor
|
||||
{
|
||||
get { return (_BorderColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_BorderColor != value)
|
||||
{
|
||||
_BorderColor = value;
|
||||
|
||||
OnPropertyChangedEx("BorderColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBorderColor()
|
||||
{
|
||||
return (_BorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBorderColor()
|
||||
{
|
||||
BorderColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HotBorderColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Hot border Color
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Hot border Color.")]
|
||||
public Color HotBorderColor
|
||||
{
|
||||
get { return (_HotBorderColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_HotBorderColor != value)
|
||||
{
|
||||
_HotBorderColor = value;
|
||||
|
||||
OnPropertyChangedEx("HotBorderColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeHotBorderColor()
|
||||
{
|
||||
return (_HotBorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetHotBorderColor()
|
||||
{
|
||||
HotBorderColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LineColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the button interior line Color
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the button interior line Color.")]
|
||||
public Color LineColor
|
||||
{
|
||||
get { return (_LineColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_LineColor != value)
|
||||
{
|
||||
_LineColor = value;
|
||||
|
||||
OnPropertyChangedEx("LineColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeLineColor()
|
||||
{
|
||||
return (_LineColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetLineColor()
|
||||
{
|
||||
LineColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HotLineColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Hot button interior line Color
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Hot button interior line Color.")]
|
||||
public Color HotLineColor
|
||||
{
|
||||
get { return (_HotLineColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_HotLineColor != value)
|
||||
{
|
||||
_HotLineColor = value;
|
||||
|
||||
OnPropertyChangedEx("HotLineColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeHotLineColor()
|
||||
{
|
||||
return (_HotLineColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetHotLineColor()
|
||||
{
|
||||
HotLineColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
///<summary>
|
||||
/// IsEmpty
|
||||
///</summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public override bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
((_Background == null || _Background.IsEmpty) &&
|
||||
(_HotBackground == null || _HotBackground.IsEmpty) &&
|
||||
(_BorderColor == Color.Empty && _HotBorderColor == Color.Empty && base.IsEmpty));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(BaseTreeButtonVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.BorderColor.IsEmpty == false)
|
||||
BorderColor = style.BorderColor;
|
||||
|
||||
if (style.HotBorderColor.IsEmpty == false)
|
||||
HotBorderColor = style.HotBorderColor;
|
||||
|
||||
if (style.Background != null && style.Background.IsEmpty == false)
|
||||
Background = style.Background.Copy();
|
||||
|
||||
if (style.HotBackground != null && style.HotBackground.IsEmpty == false)
|
||||
HotBackground = style.HotBackground.Copy();
|
||||
|
||||
if (style.LineColor.IsEmpty == false)
|
||||
LineColor = style.LineColor;
|
||||
|
||||
if (style.HotLineColor.IsEmpty == false)
|
||||
HotLineColor = style.HotLineColor;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new BaseTreeButtonVisualStyle Copy()
|
||||
{
|
||||
BaseTreeButtonVisualStyle style = new BaseTreeButtonVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(BaseTreeButtonVisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
copy.BorderColor = _BorderColor;
|
||||
copy.HotBorderColor = _HotBorderColor;
|
||||
copy.LineColor = _LineColor;
|
||||
copy.HotLineColor = _HotLineColor;
|
||||
|
||||
if (Background != null)
|
||||
copy.Background = _Background.Copy();
|
||||
|
||||
if (HotBackground != null)
|
||||
copy.HotBackground = _HotBackground.Copy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
Background = null;
|
||||
HotBackground = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Row.
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(BlankExpandableObjectConverter))]
|
||||
public class TreeButtonVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Static data
|
||||
|
||||
///<summary>
|
||||
/// Empty
|
||||
///</summary>
|
||||
public static TreeButtonVisualStyle Empty
|
||||
{
|
||||
get { return (new TreeButtonVisualStyle()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private BaseTreeButtonVisualStyle _ExpandButton;
|
||||
private BaseTreeButtonVisualStyle _CollapseButton;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CollapseButton
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CollapseButton.
|
||||
/// </summary>
|
||||
[Description("Indicates the CollapseButton")]
|
||||
public BaseTreeButtonVisualStyle CollapseButton
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_CollapseButton == null)
|
||||
{
|
||||
_CollapseButton = BaseTreeButtonVisualStyle.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _CollapseButton);
|
||||
}
|
||||
|
||||
return (_CollapseButton);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_CollapseButton != value)
|
||||
{
|
||||
UpdateChangeHandler(_CollapseButton, value);
|
||||
|
||||
_CollapseButton = value;
|
||||
|
||||
OnPropertyChangedEx("CollapseButton", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeCollapseButton()
|
||||
{
|
||||
return (_CollapseButton != null && _CollapseButton.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetCollapseButton()
|
||||
{
|
||||
CollapseButton = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ExpandButton
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ExpandButton.
|
||||
/// </summary>
|
||||
[Description("Indicates the ExpandButton")]
|
||||
public BaseTreeButtonVisualStyle ExpandButton
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ExpandButton == null)
|
||||
{
|
||||
_ExpandButton = BaseTreeButtonVisualStyle.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _ExpandButton);
|
||||
}
|
||||
|
||||
return (_ExpandButton);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_ExpandButton != value)
|
||||
{
|
||||
UpdateChangeHandler(_ExpandButton, value);
|
||||
|
||||
_ExpandButton = value;
|
||||
|
||||
OnPropertyChangedEx("ExpandButton", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeExpandButton()
|
||||
{
|
||||
return (_ExpandButton != null && _ExpandButton.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetExpandButton()
|
||||
{
|
||||
ExpandButton = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
///<summary>
|
||||
/// IsEmpty
|
||||
///</summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public override bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
((_CollapseButton == null || _CollapseButton.IsEmpty) &&
|
||||
(_ExpandButton == null || _ExpandButton.IsEmpty) && base.IsEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(TreeButtonVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style._CollapseButton != null)
|
||||
CollapseButton.ApplyStyle(style._CollapseButton);
|
||||
|
||||
if (style._ExpandButton != null)
|
||||
ExpandButton.ApplyStyle(style._ExpandButton);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new TreeButtonVisualStyle Copy()
|
||||
{
|
||||
TreeButtonVisualStyle style = new TreeButtonVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(TreeButtonVisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
if (_CollapseButton != null)
|
||||
copy.CollapseButton = _CollapseButton.Copy();
|
||||
|
||||
if (_ExpandButton != null)
|
||||
copy.ExpandButton = _ExpandButton.Copy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
CollapseButton = null;
|
||||
ExpandButton = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,725 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Row.
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class VisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Background _Background;
|
||||
private BorderColor _BorderColor;
|
||||
private BorderPattern _BorderPattern;
|
||||
private Thickness _BorderThickness;
|
||||
|
||||
private Color _TextColor = Color.Empty;
|
||||
|
||||
private Padding _Margin;
|
||||
private Padding _Padding;
|
||||
|
||||
private Font _Font;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Background
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style background.
|
||||
/// </summary>
|
||||
[Description("Indicates the style background")]
|
||||
public Background Background
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Background == null)
|
||||
{
|
||||
_Background = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _Background);
|
||||
}
|
||||
|
||||
return (_Background);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Background != value)
|
||||
{
|
||||
UpdateChangeHandler(_Background, value);
|
||||
|
||||
_Background = value;
|
||||
|
||||
OnPropertyChangedEx("Background", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBackground()
|
||||
{
|
||||
return (_Background != null && _Background.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBackground()
|
||||
{
|
||||
Background = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BorderColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style border color.
|
||||
/// </summary>
|
||||
[Description("Indicates the style Border Color")]
|
||||
public BorderColor BorderColor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_BorderColor == null)
|
||||
{
|
||||
_BorderColor = BorderColor.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _BorderColor);
|
||||
}
|
||||
|
||||
return (_BorderColor);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_BorderColor != value)
|
||||
{
|
||||
UpdateChangeHandler(_BorderColor, value);
|
||||
|
||||
_BorderColor = value;
|
||||
|
||||
OnPropertyChangedEx("BorderColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBorderColor()
|
||||
{
|
||||
return (_BorderColor != null && _BorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBorderColor()
|
||||
{
|
||||
BorderColor = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BorderPattern
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style border pattern (Solid, Dash, ...)
|
||||
/// </summary>
|
||||
[Description("Indicates the style border pattern (Solid, Dash, ...)")]
|
||||
public BorderPattern BorderPattern
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_BorderPattern == null)
|
||||
{
|
||||
_BorderPattern = BorderPattern.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _BorderPattern);
|
||||
}
|
||||
|
||||
return (_BorderPattern);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_BorderPattern != value)
|
||||
{
|
||||
UpdateChangeHandler(_BorderPattern, value);
|
||||
|
||||
_BorderPattern = value;
|
||||
|
||||
OnPropertyChangedEx("BorderPattern", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBorderPattern()
|
||||
{
|
||||
return (_BorderPattern != null && _BorderPattern.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBorderPattern()
|
||||
{
|
||||
BorderPattern = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BorderThickness
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style border thickness.
|
||||
/// </summary>
|
||||
[Description("Indicates the style border thickness")]
|
||||
public Thickness BorderThickness
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_BorderThickness == null)
|
||||
{
|
||||
_BorderThickness = Thickness.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _BorderThickness);
|
||||
}
|
||||
|
||||
return (_BorderThickness);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_BorderThickness != value)
|
||||
{
|
||||
UpdateChangeHandler(_BorderThickness, value);
|
||||
|
||||
_BorderThickness = value;
|
||||
|
||||
OnPropertyChangedEx("BorderThickness", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBorderThickness()
|
||||
{
|
||||
return (_BorderThickness != null && _BorderThickness.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBorderThickness()
|
||||
{
|
||||
BorderThickness = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Font
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style Font
|
||||
/// </summary>
|
||||
[DefaultValue(null)]
|
||||
[Description("Indicates the style Font")]
|
||||
public Font Font
|
||||
{
|
||||
get { return (_Font); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Font != value)
|
||||
{
|
||||
_Font = value;
|
||||
|
||||
OnPropertyChangedEx("Font", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the style is logically Empty.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("Gets whether the style is logically Empty.")]
|
||||
public override bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((_Background == null || _Background.IsEmpty == true) &&
|
||||
(_BorderColor == null || _BorderColor.IsEmpty == true) &&
|
||||
(_BorderPattern == null || _BorderPattern.IsEmpty == true) &&
|
||||
(_BorderThickness == null || _BorderThickness.IsEmpty == true) &&
|
||||
(_Margin == null || _Margin.IsEmpty == true) &&
|
||||
(_Padding == null || _Padding.IsEmpty == true) &&
|
||||
(_Font == null) &&
|
||||
(_TextColor.IsEmpty == true || _TextColor == Color.Black) &&
|
||||
|
||||
(base.IsEmpty == true)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Margin
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the spacing between the border and outside content.
|
||||
/// </summary>
|
||||
[Description("Indicates the spacing between the border and outside content")]
|
||||
public Padding Margin
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Margin == null)
|
||||
{
|
||||
_Margin = Padding.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _Margin);
|
||||
}
|
||||
|
||||
return (_Margin);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Margin != value)
|
||||
{
|
||||
UpdateChangeHandler(_Margin, value);
|
||||
|
||||
_Margin = value;
|
||||
|
||||
OnPropertyChangedEx("Margin", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeMargin()
|
||||
{
|
||||
return (_Margin != null && _Margin.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetMargin()
|
||||
{
|
||||
Margin = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Padding
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets spacing between the content and edges of the element.
|
||||
/// </summary>
|
||||
[Description("Indicates the spacing between the content and edges of the element")]
|
||||
public Padding Padding
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Padding == null)
|
||||
{
|
||||
_Padding = Padding.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _Padding);
|
||||
}
|
||||
|
||||
return (_Padding);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Padding != value)
|
||||
{
|
||||
UpdateChangeHandler(_Padding, value);
|
||||
|
||||
_Padding = value;
|
||||
|
||||
OnPropertyChangedEx("Padding", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializePadding()
|
||||
{
|
||||
return (_Padding != null && _Padding.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetPadding()
|
||||
{
|
||||
Padding = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Text color
|
||||
/// </summary>
|
||||
[Description("Indicates the Text color")]
|
||||
public Color TextColor
|
||||
{
|
||||
get { return (_TextColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_TextColor != value)
|
||||
{
|
||||
_TextColor = value;
|
||||
|
||||
OnPropertyChangedEx("TextColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeTextColor()
|
||||
{
|
||||
return (_TextColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetTextColor()
|
||||
{
|
||||
_TextColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(VisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style._Background != null && style._Background.IsEmpty == false)
|
||||
Background = style._Background.Copy();
|
||||
|
||||
if (style._BorderColor != null && style._BorderColor.IsEmpty == false)
|
||||
BorderColor = style._BorderColor.Copy();
|
||||
|
||||
if (style._BorderPattern != null && style._BorderPattern.IsEmpty == false)
|
||||
BorderPattern.ApplyPattern(style._BorderPattern);
|
||||
|
||||
if (style._BorderThickness != null && style._BorderThickness.IsZero == false)
|
||||
BorderThickness = style._BorderThickness.Copy();
|
||||
|
||||
if (style.Font != null)
|
||||
Font = style.Font;
|
||||
|
||||
if (style._Margin != null && style._Margin.IsEmpty == false)
|
||||
Margin = style.Margin.Copy();
|
||||
|
||||
if (style._Padding != null && style._Padding.IsEmpty == false)
|
||||
Padding = style.Padding.Copy();
|
||||
|
||||
if (style._TextColor.IsEmpty == false)
|
||||
TextColor = style._TextColor;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RenderBorder
|
||||
|
||||
internal void RenderBorder(Graphics g, Rectangle r)
|
||||
{
|
||||
if (_BorderPattern == null || BorderThickness == null || BorderColor == null)
|
||||
return;
|
||||
|
||||
SmoothingMode sm = g.SmoothingMode;
|
||||
g.SmoothingMode = SmoothingMode.None;
|
||||
|
||||
if (BorderColor.IsUniform == true &&
|
||||
BorderThickness.IsUniform == true && BorderPattern.IsUniform == true)
|
||||
{
|
||||
if (_BorderPattern.Top != LinePattern.None &&
|
||||
(_BorderThickness.Top > 0 && _BorderColor.Top.IsEmpty == false))
|
||||
{
|
||||
using (Pen pen = new
|
||||
Pen(_BorderColor.Top, Dpi.Width(_BorderThickness.Top)))
|
||||
{
|
||||
LinePattern pattern = (_BorderPattern.Top == LinePattern.NotSet)
|
||||
? LinePattern.Solid : _BorderPattern.Top;
|
||||
|
||||
if (pen.Width == 1)
|
||||
{
|
||||
r.Width--;
|
||||
r.Height--;
|
||||
}
|
||||
else
|
||||
{
|
||||
pen.Alignment = PenAlignment.Inset;
|
||||
}
|
||||
|
||||
pen.DashStyle = (DashStyle)pattern;
|
||||
|
||||
g.DrawRectangle(pen, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Pen[] pens = GetBorderPens();
|
||||
|
||||
if (pens[(int) BorderSide.Right] != null)
|
||||
{
|
||||
int right = r.Right -
|
||||
(Dpi.Width(_BorderThickness.Right) + 1) / 2;
|
||||
|
||||
g.DrawLine(pens[(int)BorderSide.Right],
|
||||
right, r.Top, right, r.Bottom - 1);
|
||||
}
|
||||
|
||||
if (pens[(int) BorderSide.Bottom] != null)
|
||||
{
|
||||
int bottom = r.Bottom -
|
||||
(Dpi.Height(_BorderThickness.Bottom) + 1) / 2;
|
||||
|
||||
g.DrawLine(pens[(int)BorderSide.Bottom],
|
||||
r.X, bottom, r.Right - 1, bottom);
|
||||
}
|
||||
|
||||
if (pens[(int)BorderSide.Left] != null)
|
||||
{
|
||||
int left = r.Left + Dpi.Width(_BorderThickness.Left) / 2;
|
||||
|
||||
g.DrawLine(pens[(int)BorderSide.Left],
|
||||
left, r.Top, left, r.Bottom - 1);
|
||||
}
|
||||
|
||||
if (pens[(int)BorderSide.Top] != null)
|
||||
{
|
||||
int top = r.Top + Dpi.Height(_BorderThickness.Top) / 2;
|
||||
|
||||
g.DrawLine(pens[(int) BorderSide.Top],
|
||||
r.X, top, r.Right - 1, top);
|
||||
}
|
||||
|
||||
foreach (Pen pen in pens)
|
||||
{
|
||||
if (pen != null)
|
||||
pen.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
g.SmoothingMode = sm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetBorderSize
|
||||
|
||||
internal Size GetBorderSize(bool inclPadding)
|
||||
{
|
||||
Size size = Size.Empty;
|
||||
|
||||
size.Width += (BorderThickness.Horizontal + Margin.Horizontal);
|
||||
size.Height += (BorderThickness.Vertical + Margin.Vertical);
|
||||
|
||||
if (inclPadding == true)
|
||||
{
|
||||
size.Width += Padding.Horizontal;
|
||||
size.Height += Padding.Vertical;
|
||||
}
|
||||
|
||||
return (Dpi.Size(size));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetBorderPens
|
||||
|
||||
internal Pen[] GetBorderPens()
|
||||
{
|
||||
Pen[] pens = new Pen[4];
|
||||
|
||||
pens[(int)BorderSide.Top] = GetBorderPen(pens,
|
||||
BorderColor.Top, Dpi.Height(BorderThickness.Top), BorderPattern.Top);
|
||||
|
||||
pens[(int)BorderSide.Left] = GetBorderPen(pens,
|
||||
BorderColor.Left, Dpi.Width(BorderThickness.Left), BorderPattern.Left);
|
||||
|
||||
pens[(int)BorderSide.Bottom] = GetBorderPen(pens,
|
||||
BorderColor.Bottom, Dpi.Height(BorderThickness.Bottom), BorderPattern.Bottom);
|
||||
|
||||
pens[(int)BorderSide.Right] = GetBorderPen(pens,
|
||||
BorderColor.Right, Dpi.Width(BorderThickness.Right), BorderPattern.Right);
|
||||
|
||||
return (pens);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetBorderPen
|
||||
|
||||
private Pen GetBorderPen(IEnumerable<Pen> pens,
|
||||
Color color, int width, LinePattern pattern)
|
||||
{
|
||||
if (color.IsEmpty == true ||
|
||||
pattern == LinePattern.None || width <= 0)
|
||||
{
|
||||
return (null);
|
||||
}
|
||||
|
||||
foreach (Pen pen in pens)
|
||||
{
|
||||
if (pen != null)
|
||||
{
|
||||
if (pen.Color == color && pen.Width == width &&
|
||||
pen.DashStyle == (DashStyle)pattern)
|
||||
{
|
||||
return (pen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Pen npen = new Pen(color, width);
|
||||
|
||||
if (pattern == LinePattern.NotSet)
|
||||
pattern = LinePattern.Solid;
|
||||
|
||||
npen.DashStyle = (DashStyle)pattern;
|
||||
|
||||
return (npen);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new VisualStyle Copy()
|
||||
{
|
||||
VisualStyle style = new VisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(VisualStyle copy)
|
||||
{
|
||||
base.CopyTo(copy);
|
||||
|
||||
copy.TextColor = _TextColor;
|
||||
|
||||
if (_Background != null)
|
||||
copy.Background = _Background.Copy();
|
||||
|
||||
if (_BorderColor != null)
|
||||
copy.BorderColor = _BorderColor.Copy();
|
||||
|
||||
if (_BorderPattern != null)
|
||||
copy.BorderPattern = _BorderPattern.Copy();
|
||||
|
||||
if (_BorderPattern != null)
|
||||
copy.BorderPattern = _BorderPattern.Copy();
|
||||
|
||||
if (_BorderThickness != null)
|
||||
copy.BorderThickness = _BorderThickness.Copy();
|
||||
|
||||
if (_Font != null)
|
||||
copy.Font = (Font)_Font.Clone();
|
||||
|
||||
if (_Margin != null)
|
||||
copy.Margin = _Margin.Copy();
|
||||
|
||||
if (_Padding != null)
|
||||
copy.Padding = _Padding.Copy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
Background = null;
|
||||
BorderColor = null;
|
||||
BorderPattern = null;
|
||||
BorderThickness = null;
|
||||
Margin = null;
|
||||
Padding = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,511 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// VisualStyles
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class VisualStyles<T> : IDisposable, INotifyPropertyChanged where T : BaseVisualStyle, new()
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private T[] _Styles;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// Constructor
|
||||
///</summary>
|
||||
public VisualStyles()
|
||||
{
|
||||
_Styles = new T[Enum.GetValues(typeof(StyleType)).Length - 1];
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Indexer
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style
|
||||
/// assigned to the element. Default value is null.
|
||||
/// </summary>
|
||||
[DefaultValue(null), Category("Style")]
|
||||
[Description("Indicates visual style assigned to the element")]
|
||||
public T this[StyleType e]
|
||||
{
|
||||
get
|
||||
{
|
||||
int n = ((IConvertible)e).ToInt32(null);
|
||||
|
||||
if (n < 0 || n > _Styles.Length)
|
||||
throw new Exception("Invalid Style indexer");
|
||||
|
||||
return (GetStyle(n));
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
int n = ((IConvertible)e).ToInt32(null);
|
||||
|
||||
if (n < 0 || n > _Styles.Length)
|
||||
throw new Exception("Invalid Style indexer");
|
||||
|
||||
SetStyle(n, value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Default
|
||||
|
||||
///<summary>
|
||||
/// The normal, default style
|
||||
///</summary>
|
||||
[Description("Style to use for normal, default items")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T Default
|
||||
{
|
||||
get { return (GetStyle((int) StyleType.Default)); }
|
||||
set { SetStyle((int) StyleType.Default, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Empty
|
||||
|
||||
///<summary>
|
||||
/// Style to use when a cell item is empty
|
||||
///</summary>
|
||||
[Description("Style to use when a cell item is empty")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T Empty
|
||||
{
|
||||
get { return (GetStyle((int)StyleType.Empty)); }
|
||||
set { SetStyle((int)StyleType.Empty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MouseOver
|
||||
|
||||
///<summary>
|
||||
/// MouseOver
|
||||
///</summary>
|
||||
[Description("Style to use when the Mouse is over an item")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T MouseOver
|
||||
{
|
||||
get { return (GetStyle((int)StyleType.MouseOver)); }
|
||||
set { SetStyle((int)StyleType.MouseOver, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region NotSelectable
|
||||
|
||||
///<summary>
|
||||
/// Style to use for non-selectable items
|
||||
///</summary>
|
||||
[Description("Style to use for non-selectable items")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T NotSelectable
|
||||
{
|
||||
get { return (GetStyle((int)StyleType.NotSelectable)); }
|
||||
set { SetStyle((int)StyleType.NotSelectable, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Selected
|
||||
|
||||
///<summary>
|
||||
/// Style to use for selected items.
|
||||
///</summary>
|
||||
[Description("Style to use for selected items.")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T Selected
|
||||
{
|
||||
get { return (GetStyle((int)StyleType.Selected)); }
|
||||
set { SetStyle((int)StyleType.Selected, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SelectedMouseOver
|
||||
|
||||
///<summary>
|
||||
/// Style to use for MouseOver selected items
|
||||
///</summary>
|
||||
[Description("Style to use for MouseOver selected items")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T SelectedMouseOver
|
||||
{
|
||||
get { return (GetStyle((int)StyleType.SelectedMouseOver)); }
|
||||
set { SetStyle((int)StyleType.SelectedMouseOver, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ReadOnly
|
||||
|
||||
///<summary>
|
||||
/// Style to use for ReadOnly items
|
||||
///</summary>
|
||||
[Description("Style to use for ReadOnly items.")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T ReadOnly
|
||||
{
|
||||
get { return (GetStyle((int)StyleType.ReadOnly)); }
|
||||
set { SetStyle((int)StyleType.ReadOnly, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ReadOnlyMouseOver
|
||||
|
||||
///<summary>
|
||||
/// Style to use for ReadOnly, MouseOver items
|
||||
///</summary>
|
||||
[Description("Style to use for ReadOnly, MouseOver items.")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T ReadOnlyMouseOver
|
||||
{
|
||||
get { return (GetStyle((int)StyleType.ReadOnlyMouseOver)); }
|
||||
set { SetStyle((int)StyleType.ReadOnlyMouseOver, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ReadOnlySelected
|
||||
|
||||
///<summary>
|
||||
/// ReadOnlySelected
|
||||
///</summary>
|
||||
[Description("Style to use for ReadOnly, Selected items.")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T ReadOnlySelected
|
||||
{
|
||||
get { return (GetStyle((int)StyleType.ReadOnlySelected)); }
|
||||
set { SetStyle((int)StyleType.ReadOnlySelected, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ReadOnlySelectedMouseOver
|
||||
|
||||
///<summary>
|
||||
/// Style to use for ReadOnly, Selected, MouseOver items
|
||||
///</summary>
|
||||
[Description("Style to use for ReadOnly, Selected, MouseOver items.")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T ReadOnlySelectedMouseOver
|
||||
{
|
||||
get { return (GetStyle((int)StyleType.ReadOnlySelectedMouseOver)); }
|
||||
set { SetStyle((int)StyleType.ReadOnlySelectedMouseOver, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Styles
|
||||
|
||||
///<summary>
|
||||
/// Styles array
|
||||
///</summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public T[] Styles
|
||||
{
|
||||
get { return (_Styles); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetStyle
|
||||
|
||||
private T GetStyle(int n)
|
||||
{
|
||||
if (_Styles[n] == null)
|
||||
{
|
||||
_Styles[n] = new T();
|
||||
|
||||
OnStyleChangeHandler(null, _Styles[n]);
|
||||
}
|
||||
|
||||
return (_Styles[n]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetStyle
|
||||
|
||||
private void SetStyle(int n, T value)
|
||||
{
|
||||
if (_Styles[n] != value)
|
||||
{
|
||||
T oldValue = _Styles[n];
|
||||
|
||||
_Styles[n] = value;
|
||||
|
||||
OnStyleChanged(Enum.GetName(typeof(StyleType), n), oldValue, value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnStyleChanged
|
||||
|
||||
private void OnStyleChanged(
|
||||
string property, T oldValue, T newValue)
|
||||
{
|
||||
OnStyleChangeHandler(oldValue, newValue);
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs(property));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsValid
|
||||
|
||||
internal bool IsValid(Enum e)
|
||||
{
|
||||
int n = ((IConvertible) e).ToInt32(null);
|
||||
|
||||
if (n < 0 || n > _Styles.Length)
|
||||
throw new Exception("Invalid Style indexer");
|
||||
|
||||
return (_Styles[n] != null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Style support routines
|
||||
|
||||
#region StyleVisualChangeHandler
|
||||
|
||||
private void OnStyleChangeHandler(T oldValue, T newValue)
|
||||
{
|
||||
if (oldValue != null)
|
||||
oldValue.PropertyChanged -= StyleChanged;
|
||||
|
||||
if (newValue != null)
|
||||
newValue.PropertyChanged += StyleChanged;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleChanged
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when one of element visual styles has property changes.
|
||||
/// Default implementation invalidates visual appearance of element.
|
||||
/// </summary>
|
||||
/// <param name="sender">VisualStyle that changed.</param>
|
||||
/// <param name="e">Event arguments.</param>
|
||||
protected virtual void StyleChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
for (int i = 0; i < _Styles.Length; i++)
|
||||
{
|
||||
T style = _Styles[i];
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
SetStyle(i, null);
|
||||
|
||||
style.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
_Styles = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region enums
|
||||
|
||||
#region StyleType
|
||||
|
||||
///<summary>
|
||||
/// StyleType
|
||||
///</summary>
|
||||
public enum StyleType
|
||||
{
|
||||
///<summary>
|
||||
/// CellStyle is Not Set
|
||||
///</summary>
|
||||
NotSet = -1,
|
||||
|
||||
///<summary>
|
||||
/// Default
|
||||
///</summary>
|
||||
Default = 0,
|
||||
|
||||
///<summary>
|
||||
/// MouseOver
|
||||
///</summary>
|
||||
MouseOver,
|
||||
|
||||
///<summary>
|
||||
/// Selected
|
||||
///</summary>
|
||||
Selected,
|
||||
|
||||
///<summary>
|
||||
/// SelectedMouseOver
|
||||
///</summary>
|
||||
SelectedMouseOver,
|
||||
|
||||
///<summary>
|
||||
/// ReadOnly
|
||||
///</summary>
|
||||
ReadOnly,
|
||||
|
||||
///<summary>
|
||||
/// ReadOnlyMouseOver
|
||||
///</summary>
|
||||
ReadOnlyMouseOver,
|
||||
|
||||
///<summary>
|
||||
/// ReadOnlySelected
|
||||
///</summary>
|
||||
ReadOnlySelected,
|
||||
|
||||
///<summary>
|
||||
/// ReadOnlySelectedMouseOver
|
||||
///</summary>
|
||||
ReadOnlySelectedMouseOver,
|
||||
|
||||
///<summary>
|
||||
/// Empty, non-populated cell
|
||||
///</summary>
|
||||
Empty,
|
||||
|
||||
///<summary>
|
||||
/// Empty, mouseOver non-populated cell
|
||||
///</summary>
|
||||
EmptyMouseOver,
|
||||
|
||||
///<summary>
|
||||
/// Empty, MouseOver, Selected, non-populated cell
|
||||
///</summary>
|
||||
EmptyMouseOverSelected,
|
||||
|
||||
///<summary>
|
||||
/// Not Selectable cell
|
||||
///</summary>
|
||||
NotSelectable,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleState
|
||||
|
||||
///<summary>
|
||||
/// StyleState
|
||||
///</summary>
|
||||
[Flags]
|
||||
public enum StyleState
|
||||
{
|
||||
///<summary>
|
||||
/// Default
|
||||
///</summary>
|
||||
Default = 0,
|
||||
|
||||
///<summary>
|
||||
/// MouseOver
|
||||
///</summary>
|
||||
MouseOver = (1 << 0),
|
||||
|
||||
///<summary>
|
||||
/// Selected
|
||||
///</summary>
|
||||
Selected = (1 << 1),
|
||||
|
||||
///<summary>
|
||||
/// ReadOnly
|
||||
///</summary>
|
||||
ReadOnly = (1 << 2),
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region VisualStylesConverter
|
||||
|
||||
///<summary>
|
||||
/// VisualStylesConverter
|
||||
///</summary>
|
||||
public class VisualStylesConverter : ExpandableObjectConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// ConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
return (" ");
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
Reference in New Issue
Block a user