C# Class BrightIdeasSoftware.BaseRenderer

Inheritance: AbstractRenderer
Afficher le fichier Open project: soywiz/cspspemu

Private Properties

Свойство Type Description
ClearState void

Méthodes publiques

Méthode Description
ApplyCellPadding ( Rectangle r ) : Rectangle

Change the bounds of the given rectangle to take any cell padding into account

DrawText ( Graphics g, Rectangle r, String txt ) : void

Draw the given text and optional image in the "normal" fashion

GetBackgroundColor ( ) : Color

Return the Color that is the background color for this item's cell

GetEditRectangle ( Graphics g, Rectangle cellBounds, BrightIdeasSoftware.OLVListItem item, int subItemIndex, Size preferredSize ) : Rectangle

Calculate the edit rectangle

GetForegroundColor ( ) : Color

Return the color to be used for text in this cell

HitTest ( BrightIdeasSoftware.OlvListViewHitTestInfo hti, int x, int y ) : void

Calculate which part of this cell was hit

OptionalRender ( Graphics g, Rectangle r ) : bool

Draw our data into the given rectangle using the given graphics context.

Subclasses should override this method.

Render ( Graphics g, Rectangle r ) : void

Draw our data into the given rectangle using the given graphics context.

Subclasses should override this method if they never want to fall back on the default processing

RenderItem ( DrawListViewItemEventArgs e, Graphics g, Rectangle itemBounds, object rowObject ) : bool

Render the whole item in a non-details view.

RenderSubItem ( DrawListViewSubItemEventArgs e, Graphics g, Rectangle cellBounds, object rowObject ) : bool

Render one cell

Méthodes protégées

Méthode Description
AlignHorizontally ( Rectangle outer, Rectangle inner ) : int

Calculate the left edge of the rectangle that aligns the outer rectangle with the inner one according to this renderer's horizontal alignement

AlignRectangle ( Rectangle outer, Rectangle inner ) : Rectangle

Align the second rectangle with the first rectangle, according to the alignment of the column

AlignVertically ( Rectangle outer, Rectangle inner ) : int

Calculate the top of the rectangle that aligns the outer rectangle with the inner rectangle according to this renders vertical alignment

AlignVertically ( Rectangle outer, int innerHeight ) : int

Calculate the top of the rectangle that aligns the outer rectangle with a rectangle of the given height according to this renderer's vertical alignment

CalculateAlignedRectangle ( Graphics g, Rectangle r ) : Rectangle

Calculate the space that our rendering will occupy and then align that space with the given rectangle, according to the Column alignment

CalculateCheckBoxBounds ( Graphics g, Rectangle cellBounds ) : Rectangle
CalculateCheckBoxWidth ( Graphics g ) : int

How much space will the check box for this cell occupy?

Only column 0 can have check boxes. Sub item checkboxes are treated as images

CalculateImageWidth ( Graphics g, object imageSelector ) : int

How much horizontal space will the image of this cell occupy?

CalculatePaddedAlignedBounds ( Graphics g, Rectangle bounds, Size preferredSize ) : Rectangle
CalculateTextWidth ( Graphics g, string txt ) : int

How much horizontal space will the text of this cell occupy?

DrawAlignedImage ( Graphics g, Rectangle r, Image image ) : void

Draw the given image aligned horizontally within the column.

Over tall images are scaled to fit. Over-wide images are truncated. This is by design!

DrawAlignedImageAndText ( Graphics g, Rectangle r ) : void

Draw our subitems image and text

DrawBackground ( Graphics g, Rectangle r ) : void

Fill in the background of this cell

DrawCheckBox ( Graphics g, Rectangle r ) : int

Draw the check box of this row

DrawImage ( Graphics g, Rectangle r, Object imageSelector ) : int

Draw the given text and optional image in the "normal" fashion

DrawImageAndText ( Graphics g, Rectangle r ) : void

Draw our subitems image and text

DrawImages ( Graphics g, Rectangle r, ICollection imageSelectors ) : int

Draw the given collection of image selectors

DrawTextGdi ( Graphics g, Rectangle r, String txt ) : void

Print the given text in the given rectangle using only GDI routines

The native list control uses GDI routines to do its drawing, so using them here makes the owner drawn mode looks more natural.

This method doesn't honour the CanWrap setting on the renderer. All text is single line

DrawTextGdiPlus ( Graphics g, Rectangle r, String txt ) : void

Print the given text in the given rectangle using normal GDI+ .NET methods

Printing to a printer dc has to be done using this method.

GetCheckBoxState ( CheckState checkState ) : CheckBoxState

Calculate the renderer checkboxstate we need to correctly draw the given state

GetImage ( ) : Image

Return the image that should be drawn against this subitem

GetImage ( Object imageSelector ) : Image

Return the actual image that should be drawn when keyed by the given image selector. An image selector can be: an int, giving the index into the image list a string, giving the image key into the image list an Image, being the image itself

GetImageSelector ( ) : Object

GetText ( ) : string

Return the string that should be drawn within this

GetTextBackgroundColor ( ) : Color

Return the Color that is the background color for this item's text

HandleGetEditRectangle ( Graphics g, Rectangle cellBounds, BrightIdeasSoftware.OLVListItem item, int subItemIndex, Size preferredSize ) : Rectangle

Handle a HitTest request after all state information has been initialized

HandleHitTest ( Graphics g, BrightIdeasSoftware.OlvListViewHitTestInfo hti, int x, int y ) : void

Do the actual work of hit testing. Subclasses should override this rather than HitTest()

StandardGetEditRectangle ( Graphics g, Rectangle cellBounds, Size preferredSize ) : Rectangle

This method calculates the bounds of the text within a standard layout (i.e. optional checkbox, optional image, text)

This method only works correctly if the state of the renderer has been fully initialized (see BaseRenderer.GetEditRectangle)

StandardHitTest ( Graphics g, BrightIdeasSoftware.OlvListViewHitTestInfo hti, Rectangle bounds, int x, int y ) : void

Perform normal hit testing relative to the given bounds

StandardRender ( Graphics g, Rectangle r ) : void

Draw the standard "[checkbox] [image] [text]" cell after the state properties have been initialized.

Private Methods

Méthode Description
ClearState ( ) : void

Method Details

AlignHorizontally() protected méthode

Calculate the left edge of the rectangle that aligns the outer rectangle with the inner one according to this renderer's horizontal alignement
protected AlignHorizontally ( Rectangle outer, Rectangle inner ) : int
outer System.Drawing.Rectangle
inner System.Drawing.Rectangle
Résultat int

AlignRectangle() protected méthode

Align the second rectangle with the first rectangle, according to the alignment of the column
protected AlignRectangle ( Rectangle outer, Rectangle inner ) : Rectangle
outer System.Drawing.Rectangle The cell's bounds
inner System.Drawing.Rectangle The rectangle to be aligned within the bounds
Résultat System.Drawing.Rectangle

AlignVertically() protected méthode

Calculate the top of the rectangle that aligns the outer rectangle with the inner rectangle according to this renders vertical alignment
protected AlignVertically ( Rectangle outer, Rectangle inner ) : int
outer System.Drawing.Rectangle
inner System.Drawing.Rectangle
Résultat int

AlignVertically() protected méthode

Calculate the top of the rectangle that aligns the outer rectangle with a rectangle of the given height according to this renderer's vertical alignment
protected AlignVertically ( Rectangle outer, int innerHeight ) : int
outer System.Drawing.Rectangle
innerHeight int
Résultat int

ApplyCellPadding() public méthode

Change the bounds of the given rectangle to take any cell padding into account
public ApplyCellPadding ( Rectangle r ) : Rectangle
r System.Drawing.Rectangle
Résultat System.Drawing.Rectangle

CalculateAlignedRectangle() protected méthode

Calculate the space that our rendering will occupy and then align that space with the given rectangle, according to the Column alignment
protected CalculateAlignedRectangle ( Graphics g, Rectangle r ) : Rectangle
g System.Drawing.Graphics
r System.Drawing.Rectangle
Résultat System.Drawing.Rectangle

CalculateCheckBoxBounds() protected méthode

protected CalculateCheckBoxBounds ( Graphics g, Rectangle cellBounds ) : Rectangle
g System.Drawing.Graphics
cellBounds System.Drawing.Rectangle
Résultat System.Drawing.Rectangle

CalculateCheckBoxWidth() protected méthode

How much space will the check box for this cell occupy?
Only column 0 can have check boxes. Sub item checkboxes are treated as images
protected CalculateCheckBoxWidth ( Graphics g ) : int
g System.Drawing.Graphics
Résultat int

CalculateImageWidth() protected méthode

How much horizontal space will the image of this cell occupy?
protected CalculateImageWidth ( Graphics g, object imageSelector ) : int
g System.Drawing.Graphics
imageSelector object
Résultat int

CalculatePaddedAlignedBounds() protected méthode

protected CalculatePaddedAlignedBounds ( Graphics g, Rectangle bounds, Size preferredSize ) : Rectangle
g System.Drawing.Graphics
bounds System.Drawing.Rectangle
preferredSize System.Drawing.Size
Résultat System.Drawing.Rectangle

CalculateTextWidth() protected méthode

How much horizontal space will the text of this cell occupy?
protected CalculateTextWidth ( Graphics g, string txt ) : int
g System.Drawing.Graphics
txt string
Résultat int

DrawAlignedImage() protected méthode

Draw the given image aligned horizontally within the column.
Over tall images are scaled to fit. Over-wide images are truncated. This is by design!
protected DrawAlignedImage ( Graphics g, Rectangle r, Image image ) : void
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
image Image The image to be drawn
Résultat void

DrawAlignedImageAndText() protected méthode

Draw our subitems image and text
protected DrawAlignedImageAndText ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
Résultat void

DrawBackground() protected méthode

Fill in the background of this cell
protected DrawBackground ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
Résultat void

DrawCheckBox() protected méthode

Draw the check box of this row
protected DrawCheckBox ( Graphics g, Rectangle r ) : int
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
Résultat int

DrawImage() protected méthode

Draw the given text and optional image in the "normal" fashion
protected DrawImage ( Graphics g, Rectangle r, Object imageSelector ) : int
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
imageSelector Object The optional image to be drawn
Résultat int

DrawImageAndText() protected méthode

Draw our subitems image and text
protected DrawImageAndText ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
Résultat void

DrawImages() protected méthode

Draw the given collection of image selectors
protected DrawImages ( Graphics g, Rectangle r, ICollection imageSelectors ) : int
g System.Drawing.Graphics
r System.Drawing.Rectangle
imageSelectors ICollection
Résultat int

DrawText() public méthode

Draw the given text and optional image in the "normal" fashion
public DrawText ( Graphics g, Rectangle r, String txt ) : void
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
txt String The string to be drawn
Résultat void

DrawTextGdi() protected méthode

Print the given text in the given rectangle using only GDI routines
The native list control uses GDI routines to do its drawing, so using them here makes the owner drawn mode looks more natural.

This method doesn't honour the CanWrap setting on the renderer. All text is single line

protected DrawTextGdi ( Graphics g, Rectangle r, String txt ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
txt String
Résultat void

DrawTextGdiPlus() protected méthode

Print the given text in the given rectangle using normal GDI+ .NET methods
Printing to a printer dc has to be done using this method.
protected DrawTextGdiPlus ( Graphics g, Rectangle r, String txt ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
txt String
Résultat void

GetBackgroundColor() public méthode

Return the Color that is the background color for this item's cell
public GetBackgroundColor ( ) : Color
Résultat Color

GetCheckBoxState() protected méthode

Calculate the renderer checkboxstate we need to correctly draw the given state
protected GetCheckBoxState ( CheckState checkState ) : CheckBoxState
checkState CheckState
Résultat CheckBoxState

GetEditRectangle() public méthode

Calculate the edit rectangle
public GetEditRectangle ( Graphics g, Rectangle cellBounds, BrightIdeasSoftware.OLVListItem item, int subItemIndex, Size preferredSize ) : Rectangle
g System.Drawing.Graphics
cellBounds System.Drawing.Rectangle
item BrightIdeasSoftware.OLVListItem
subItemIndex int
preferredSize System.Drawing.Size
Résultat System.Drawing.Rectangle

GetForegroundColor() public méthode

Return the color to be used for text in this cell
public GetForegroundColor ( ) : Color
Résultat Color

GetImage() protected méthode

Return the image that should be drawn against this subitem
protected GetImage ( ) : Image
Résultat Image

GetImage() protected méthode

Return the actual image that should be drawn when keyed by the given image selector. An image selector can be: an int, giving the index into the image list a string, giving the image key into the image list an Image, being the image itself
protected GetImage ( Object imageSelector ) : Image
imageSelector Object The value that indicates the image to be used
Résultat Image

GetImageSelector() protected méthode

protected GetImageSelector ( ) : Object
Résultat Object

GetText() protected méthode

Return the string that should be drawn within this
protected GetText ( ) : string
Résultat string

GetTextBackgroundColor() protected méthode

Return the Color that is the background color for this item's text
protected GetTextBackgroundColor ( ) : Color
Résultat Color

HandleGetEditRectangle() protected méthode

Handle a HitTest request after all state information has been initialized
protected HandleGetEditRectangle ( Graphics g, Rectangle cellBounds, BrightIdeasSoftware.OLVListItem item, int subItemIndex, Size preferredSize ) : Rectangle
g System.Drawing.Graphics
cellBounds System.Drawing.Rectangle
item BrightIdeasSoftware.OLVListItem
subItemIndex int
preferredSize System.Drawing.Size
Résultat System.Drawing.Rectangle

HandleHitTest() protected méthode

Do the actual work of hit testing. Subclasses should override this rather than HitTest()
protected HandleHitTest ( Graphics g, BrightIdeasSoftware.OlvListViewHitTestInfo hti, int x, int y ) : void
g System.Drawing.Graphics
hti BrightIdeasSoftware.OlvListViewHitTestInfo
x int
y int
Résultat void

HitTest() public méthode

Calculate which part of this cell was hit
public HitTest ( BrightIdeasSoftware.OlvListViewHitTestInfo hti, int x, int y ) : void
hti BrightIdeasSoftware.OlvListViewHitTestInfo
x int
y int
Résultat void

OptionalRender() public méthode

Draw our data into the given rectangle using the given graphics context.

Subclasses should override this method.

public OptionalRender ( Graphics g, Rectangle r ) : bool
g System.Drawing.Graphics The graphics context that should be used for drawing
r System.Drawing.Rectangle The bounds of the subitem cell
Résultat bool

Render() public méthode

Draw our data into the given rectangle using the given graphics context.

Subclasses should override this method if they never want to fall back on the default processing

public Render ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics The graphics context that should be used for drawing
r System.Drawing.Rectangle The bounds of the subitem cell
Résultat void

RenderItem() public méthode

Render the whole item in a non-details view.
public RenderItem ( DrawListViewItemEventArgs e, Graphics g, Rectangle itemBounds, object rowObject ) : bool
e System.Windows.Forms.DrawListViewItemEventArgs
g System.Drawing.Graphics
itemBounds System.Drawing.Rectangle
rowObject object
Résultat bool

RenderSubItem() public méthode

Render one cell
public RenderSubItem ( DrawListViewSubItemEventArgs e, Graphics g, Rectangle cellBounds, object rowObject ) : bool
e System.Windows.Forms.DrawListViewSubItemEventArgs
g System.Drawing.Graphics
cellBounds System.Drawing.Rectangle
rowObject object
Résultat bool

StandardGetEditRectangle() protected méthode

This method calculates the bounds of the text within a standard layout (i.e. optional checkbox, optional image, text)
This method only works correctly if the state of the renderer has been fully initialized (see BaseRenderer.GetEditRectangle)
protected StandardGetEditRectangle ( Graphics g, Rectangle cellBounds, Size preferredSize ) : Rectangle
g System.Drawing.Graphics
cellBounds System.Drawing.Rectangle
preferredSize System.Drawing.Size
Résultat System.Drawing.Rectangle

StandardHitTest() protected méthode

Perform normal hit testing relative to the given bounds
protected StandardHitTest ( Graphics g, BrightIdeasSoftware.OlvListViewHitTestInfo hti, Rectangle bounds, int x, int y ) : void
g System.Drawing.Graphics
hti BrightIdeasSoftware.OlvListViewHitTestInfo
bounds System.Drawing.Rectangle
x int
y int
Résultat void

StandardRender() protected méthode

Draw the standard "[checkbox] [image] [text]" cell after the state properties have been initialized.
protected StandardRender ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
Résultat void