|
using System;
using System.ComponentModel;
using System.Drawing;
namespace dwf.tool
{
public class LayoutMapItem : ILayoutMapItem, IComparable, INotifyPropertyChanged
{
private static float min = 5;
[DefaultValue((float)18)]
protected float height = 18;
[DefaultValue((float)120)]
protected float width = 120;
[DefaultValue((int)0)]
protected int row = 0;
[DefaultValue((int)0)]
protected int col = 0;
[DefaultValue(true)]
protected bool visible = true;
[DefaultValue(false)]
protected bool fillW = false;
[DefaultValue(false)]
protected bool fillH = false;
protected string name = null;
[NonSerialized()]
protected ILayoutMap map = null;
[NonSerialized()]
protected object tag;
[NonSerialized()]
protected RectangleF temp;
public RectangleF Temp
{
get { return temp; }
set { temp = value; }
}
public float Height
{
get { return height; }
set
{
if (value == height || value < min)
return;
height = value;
OnPropertyChanged("Height");
}
}
public float Width
{
get { return width; }
set
{
if (value == width || value < min)
return;
width = value;
OnPropertyChanged("Width");
}
}
public int Row
{
get { return row; }
set
{
if (row == value)
return;
row = value;
OnPropertyChanged("Row");
}
}
public int Col
{
get { return col; }
set
{
if (col == value)
return;
col = value;
OnPropertyChanged("Col");
}
}
public virtual bool Visible
{
get { return visible; }
set
{
if (visible == value)
return;
visible = value;
OnPropertyChanged("Visible");
}
}
public bool FillWidth
{
get { return fillW; }
set
{
if (fillW == value)
return;
fillW = value;
OnPropertyChanged("FillWidth");
}
}
public bool FillHeight
{
get { return fillH; }
set
{
if (fillH == value)
return;
fillH = value;
OnPropertyChanged("FillHeight");
}
}
public string Name
{
get { return name; }
set
{
if (name == value)
return;
name = value;
OnPropertyChanged("Name");
}
}
public ILayoutMap Map
{
get { return map; }
set
{
if (map == value)
return;
map = value;
OnPropertyChanged("Map");
}
}
public object Tag
{
get { return tag; }
set
{
if (tag == value)
return;
tag = value;
OnPropertyChanged("Tag");
}
}
public override string ToString()
{
return string.Format("({0},{1}) {2}", row , col , name);
}
#region IComparable implementation
public int CompareTo(object obj)
{
return LayoutMapTool.Compare(this, obj as ILayoutMapItem);
}
#endregion
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string Property)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(Property));
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.