CPF/CPF.ReoGrid/CellTypes/CellBody.cs

128 lines
1.7 KiB
C#
Raw Normal View History

2024-06-24 10:15:59 +08:00
using System;
using CPF.Drawing;
using CPF.ReoGrid.Events;
using CPF.ReoGrid.Interaction;
using CPF.ReoGrid.Rendering;
namespace CPF.ReoGrid.CellTypes
{
[Serializable]
public class CellBody : ICellBody
{
internal Cell InnerCell
{
set
{
this.cell = value;
}
}
public Cell Cell
{
get
{
return this.cell;
}
}
public virtual void OnSetup(Cell cell)
{
this.cell = cell;
}
public virtual Rect Bounds { get; set; }
public virtual bool DisableWhenCellReadonly
{
get
{
return true;
}
}
public virtual void OnBoundsChanged()
{
}
public virtual bool AutoCaptureMouse()
{
return true;
}
public virtual bool OnMouseDown(CellMouseEventArgs e)
{
return false;
}
public virtual bool OnMouseMove(CellMouseEventArgs e)
{
return false;
}
public virtual bool OnMouseUp(CellMouseEventArgs e)
{
return false;
}
public virtual bool OnMouseEnter(CellMouseEventArgs e)
{
return false;
}
public virtual bool OnMouseLeave(CellMouseEventArgs e)
{
return false;
}
public virtual void OnMouseWheel(CellMouseEventArgs e)
{
}
public virtual bool OnKeyDown(KeyCode e)
{
return false;
}
public virtual bool OnKeyUp(KeyCode e)
{
return false;
}
public virtual void OnPaint(CellDrawingContext dc)
{
dc.DrawCellBackground();
dc.DrawCellText();
}
public virtual bool OnStartEdit()
{
return true;
}
public virtual object OnEndEdit(object data)
{
return data;
}
public virtual void OnGotFocus()
{
}
public virtual void OnLostFocus()
{
}
public virtual object OnSetData(object data)
{
return data;
}
public virtual ICellBody Clone()
{
return new CellBody();
}
private Cell cell;
}
}