Class AbstractCustomColumn
Abstract base class that you can derive from when creating custom columns for the editor.
Takes care of some of the plumbing involved in implementing the interfaces and implements helper functions for drawing background and borders, measuring text and implementing font fallback.
Inheritance
Implements
Inherited Members
Namespace: Sdl.DesktopEditor.EditorApi.Implementation
Assembly: Sdl.DesktopEditor.EditorApi.dll
Syntax
public abstract class AbstractCustomColumn : ICustomColumn
Constructors
AbstractCustomColumn()
Declaration
protected AbstractCustomColumn()
Properties
EditControl
Default implementation stores the value in a member.
Declaration
public virtual IEditControl EditControl { get; set; }
Property Value
Type | Description |
---|---|
IEditControl |
IsComplex
Determines whether the column is complex or not. A normal column can draw each row independently of other rows. However, a complex column cannot draw each row independently of other rows. So complex columns need to be entirely redrawn when rows are changed or resized.
Declaration
public virtual bool IsComplex { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
TextFormat
Alignment of the text in the control, used when calculating the text size. By default the text is centered vertically.
Declaration
public TextFormatFlags TextFormat { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.TextFormatFlags |
Width
Default implementation stores the value in a member.
Declaration
public virtual int Width { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
BeginDraw()
Called by the control when a repaint is needed. This is called once before a range of DrawCell calls.
Declaration
public virtual void BeginDraw()
CalculateCellContentHeight(Graphics, IRowInfo)
The implementation should return the height of the content in the cell.
Declaration
public abstract int CalculateCellContentHeight(Graphics g, IRowInfo row)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | |
IRowInfo | row |
Returns
Type | Description |
---|---|
System.Int32 |
CalculateTextSize(Graphics, String, Font)
Determine the size of a text string in a specific font on a specific device, assuming that the text will not need to get word wrapped.
Declaration
protected Size CalculateTextSize(Graphics g, string text, Font font)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | |
System.String | text | |
System.Drawing.Font | font |
Returns
Type | Description |
---|---|
System.Drawing.Size |
CalculateTextSize(Graphics, String, Font, Int32)
Determine the size of a text string in a specified font, assuming that there is a maximum width which if exceeded will cause the text to word wrap across multiple lines.
Declaration
protected Size CalculateTextSize(Graphics g, string text, Font font, int maxWidth)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | |
System.String | text | |
System.Drawing.Font | font | |
System.Int32 | maxWidth |
Returns
Type | Description |
---|---|
System.Drawing.Size |
DrawBorders(Graphics, Rectangle, Pen, Pen, Pen, Pen)
Draw all the default borders for the cell.
Declaration
protected static void DrawBorders(Graphics g, Rectangle cellBounds, Pen leftBorderPen, Pen rightBorderPen, Pen topBorderPen, Pen bottomBorderPen)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | |
System.Drawing.Rectangle | cellBounds | |
System.Drawing.Pen | leftBorderPen | |
System.Drawing.Pen | rightBorderPen | |
System.Drawing.Pen | topBorderPen | |
System.Drawing.Pen | bottomBorderPen |
DrawBottomBorder(Graphics, Rectangle, Pen)
Draw the bottom border for the cell.
Declaration
protected static void DrawBottomBorder(Graphics g, Rectangle cellBounds, Pen bottomBorderPen)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | |
System.Drawing.Rectangle | cellBounds | |
System.Drawing.Pen | bottomBorderPen |
DrawCell(Graphics, IRowInfo, Rectangle, Pen, Pen, Pen, Pen)
The implementation should draw the content of the cell.
Declaration
public abstract void DrawCell(Graphics g, IRowInfo row, Rectangle cellBounds, Pen leftBorderPen, Pen rightBorderPen, Pen topBorderPen, Pen bottomBorderPen)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | |
IRowInfo | row | |
System.Drawing.Rectangle | cellBounds | |
System.Drawing.Pen | leftBorderPen | |
System.Drawing.Pen | rightBorderPen | |
System.Drawing.Pen | topBorderPen | |
System.Drawing.Pen | bottomBorderPen |
DrawDefaultBackground(Graphics, Rectangle, IRowInfo)
Fill the cell with the effective background color for the row.
Declaration
protected void DrawDefaultBackground(Graphics g, Rectangle cellBounds, IRowInfo row)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | |
System.Drawing.Rectangle | cellBounds | |
IRowInfo | row |
DrawLeftBorder(Graphics, Rectangle, Pen)
Draw the left border for the cell.
Declaration
protected static void DrawLeftBorder(Graphics g, Rectangle cellBounds, Pen leftBorderPen)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | |
System.Drawing.Rectangle | cellBounds | |
System.Drawing.Pen | leftBorderPen |
DrawRightBorder(Graphics, Rectangle, Pen)
Draw the right border for the cell.
Declaration
protected static void DrawRightBorder(Graphics g, Rectangle cellBounds, Pen rightBorderPen)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | |
System.Drawing.Rectangle | cellBounds | |
System.Drawing.Pen | rightBorderPen |
DrawTopBorder(Graphics, Rectangle, Pen)
Draw the top border for the cell.
Declaration
protected static void DrawTopBorder(Graphics g, Rectangle cellBounds, Pen topBorderPen)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | |
System.Drawing.Rectangle | cellBounds | |
System.Drawing.Pen | topBorderPen |
GetFont()
Get the default font to use for text in this column.
Declaration
protected virtual Font GetFont()
Returns
Type | Description |
---|---|
System.Drawing.Font |
Remarks
The default implementation returns the system menu font.
GetOptimalWidth(Graphics)
The implementation should return the desired column width.
Declaration
public abstract int GetOptimalWidth(Graphics g)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g |
Returns
Type | Description |
---|---|
System.Int32 |
PrepareRegisterRows()
Called from the Editor before RegisterRows are called. Unfortunately RegisterRow is called for all rows when a change occurs in structure, even the row was already 'registered'.
Declaration
public virtual void PrepareRegisterRows()
RegisterRow(IRowInfo)
Called from the Editor when a row has been created. Allows a column to keep track of the rows available in the Editor and collect any information it needs about it. The default implementation does nothing.
Declaration
public virtual void RegisterRow(IRowInfo row)
Parameters
Type | Name | Description |
---|---|---|
IRowInfo | row | The row that has been created in the Editor. |
SetRowSizeAccessor(RowSizeAccessor)
Allows the Editor to pass in a row size delegate which can be used to get the current System.Drawing.Rectangle of any row in the Editor. The default implementation does nothing.
Declaration
public virtual void SetRowSizeAccessor(RowSizeAccessor rowSizeAccessor)
Parameters
Type | Name | Description |
---|---|---|
RowSizeAccessor | rowSizeAccessor | Delegate that will be passed into the row when registered with the Editor. |