C# Class BrightIdeasSoftware.HeaderControl

Class used to capture window messages for the header of the list view control.
Inheritance: System.Windows.Forms.NativeWindow
显示文件 Open project: soywiz/cspspemu Class Usage Examples

Private Properties

Property Type Description
CalculateColumnHeight float
CalculateFilterIndicatorWidth int
DrawImageAndText void
DrawText void
DrawVerticalText void
HandleHeaderCustomDraw bool
NeedsCustomDraw bool
NeedsCustomDraw bool
WndProc void

Public Methods

Method Description
GetItemRect ( int itemIndex ) : Rectangle

Return the bounds of the item with the given index

HeaderControl ( ObjectListView olv ) : System

Create a header control for the given ObjectListView.

Invalidate ( ) : void

Force the header to redraw by invalidating it

Protected Methods

Method Description
CalculateFont ( OLVColumn column, bool isHot, bool isPressed ) : Font

What font should be used to draw the header text?

CalculateHeight ( Graphics g ) : int

Calculate how height the header needs to be

CalculateStyle ( OLVColumn column, bool isHot, bool isPressed ) : BrightIdeasSoftware.HeaderStateStyle

What style should be applied to the header?

CreateToolTip ( ) : void

Create a native tool tip control for this listview

CustomDrawHeaderCell ( Graphics g, int columnIndex, int itemState ) : void

Draw one cell of the header

DrawFilterIndicator ( Graphics g, Rectangle r ) : Rectangle

Draw an indication that this column has a filter applied to it

DrawHeaderImageAndText ( Graphics g, Rectangle r, OLVColumn column, BrightIdeasSoftware.HeaderStateStyle stateStyle ) : void

Draw the header's image and text

DrawThemedBackground ( Graphics g, Rectangle r, int columnIndex, bool isSelected ) : void

Draw a more-or-less pure themed header background.

DrawThemedSortIndicator ( Graphics g, Rectangle r ) : void

Draw a sort indicator using themes

DrawUnthemedBackground ( Graphics g, Rectangle r, int columnIndex, bool isSelected, BrightIdeasSoftware.HeaderStateStyle stateStyle ) : void

Draw a background for the header, without using Themes.

DrawUnthemedSortIndicator ( Graphics g, Rectangle r ) : Rectangle

Draw a sort indicator without using themes

HandleDestroy ( Message &m ) : bool

Handle when the underlying header control is destroyed

HandleLayout ( Message &m ) : bool

The message divides a ListView's space between the header and the rows of the listview. The WINDOWPOS structure controls the headers bounds, the RECT controls the listview bounds.

HandleMouseMove ( Message &m ) : bool

Handle the MouseMove windows message

HandleNotify ( Message &m ) : bool

Handle the Notify windows message

HandleSetCursor ( Message &m ) : bool

Handle the SetCursor windows message

HasFilterIndicator ( OLVColumn column ) : bool

Should the given column be drawn with a filter indicator against it?

HasNonThemedSortIndicator ( OLVColumn column ) : bool

Should the given column show a non-themed sort indicator?

HasSortIndicator ( OLVColumn column ) : bool

Should the given column show a sort indicator?

NeedsCustomDraw ( ) : bool

Does this header need to be custom drawn?

Word wrapping and colored text require custom drawning. Funnily enough, we can change the font natively.

Private Methods

Method Description
CalculateColumnHeight ( Graphics g, OLVColumn column, TextFormatFlags flags, bool isHot, int i ) : float
CalculateFilterIndicatorWidth ( Rectangle r ) : int
DrawImageAndText ( Graphics g, Rectangle r, OLVColumn column, TextFormatFlags flags, Font f, Color color, int imageTextGap ) : void
DrawText ( Graphics g, Rectangle r, OLVColumn column, TextFormatFlags flags, Font f, Color color ) : void
DrawVerticalText ( Graphics g, Rectangle r, OLVColumn column, Font f, Color color ) : void
HandleHeaderCustomDraw ( Message &m ) : bool

Handle the CustomDraw windows message

NeedsCustomDraw ( BrightIdeasSoftware.HeaderFormatStyle style ) : bool
NeedsCustomDraw ( BrightIdeasSoftware.HeaderStateStyle style ) : bool
WndProc ( Message &m ) : void

Method Details

CalculateFont() protected method

What font should be used to draw the header text?
protected CalculateFont ( OLVColumn column, bool isHot, bool isPressed ) : Font
column OLVColumn
isHot bool
isPressed bool
return System.Drawing.Font

CalculateHeight() protected method

Calculate how height the header needs to be
protected CalculateHeight ( Graphics g ) : int
g System.Drawing.Graphics
return int

CalculateStyle() protected method

What style should be applied to the header?
protected CalculateStyle ( OLVColumn column, bool isHot, bool isPressed ) : BrightIdeasSoftware.HeaderStateStyle
column OLVColumn
isHot bool
isPressed bool
return BrightIdeasSoftware.HeaderStateStyle

CreateToolTip() protected method

Create a native tool tip control for this listview
protected CreateToolTip ( ) : void
return void

CustomDrawHeaderCell() protected method

Draw one cell of the header
protected CustomDrawHeaderCell ( Graphics g, int columnIndex, int itemState ) : void
g System.Drawing.Graphics
columnIndex int
itemState int
return void

DrawFilterIndicator() protected method

Draw an indication that this column has a filter applied to it
protected DrawFilterIndicator ( Graphics g, Rectangle r ) : Rectangle
g System.Drawing.Graphics
r System.Drawing.Rectangle
return System.Drawing.Rectangle

DrawHeaderImageAndText() protected method

Draw the header's image and text
protected DrawHeaderImageAndText ( Graphics g, Rectangle r, OLVColumn column, BrightIdeasSoftware.HeaderStateStyle stateStyle ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
column OLVColumn
stateStyle BrightIdeasSoftware.HeaderStateStyle
return void

DrawThemedBackground() protected method

Draw a more-or-less pure themed header background.
protected DrawThemedBackground ( Graphics g, Rectangle r, int columnIndex, bool isSelected ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
columnIndex int
isSelected bool
return void

DrawThemedSortIndicator() protected method

Draw a sort indicator using themes
protected DrawThemedSortIndicator ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
return void

DrawUnthemedBackground() protected method

Draw a background for the header, without using Themes.
protected DrawUnthemedBackground ( Graphics g, Rectangle r, int columnIndex, bool isSelected, BrightIdeasSoftware.HeaderStateStyle stateStyle ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
columnIndex int
isSelected bool
stateStyle BrightIdeasSoftware.HeaderStateStyle
return void

DrawUnthemedSortIndicator() protected method

Draw a sort indicator without using themes
protected DrawUnthemedSortIndicator ( Graphics g, Rectangle r ) : Rectangle
g System.Drawing.Graphics
r System.Drawing.Rectangle
return System.Drawing.Rectangle

GetItemRect() public method

Return the bounds of the item with the given index
public GetItemRect ( int itemIndex ) : Rectangle
itemIndex int
return System.Drawing.Rectangle

HandleDestroy() protected method

Handle when the underlying header control is destroyed
protected HandleDestroy ( Message &m ) : bool
m System.Windows.Forms.Message
return bool

HandleLayout() protected method

The message divides a ListView's space between the header and the rows of the listview. The WINDOWPOS structure controls the headers bounds, the RECT controls the listview bounds.
protected HandleLayout ( Message &m ) : bool
m System.Windows.Forms.Message
return bool

HandleMouseMove() protected method

Handle the MouseMove windows message
protected HandleMouseMove ( Message &m ) : bool
m System.Windows.Forms.Message
return bool

HandleNotify() protected method

Handle the Notify windows message
protected HandleNotify ( Message &m ) : bool
m System.Windows.Forms.Message
return bool

HandleSetCursor() protected method

Handle the SetCursor windows message
protected HandleSetCursor ( Message &m ) : bool
m System.Windows.Forms.Message
return bool

HasFilterIndicator() protected method

Should the given column be drawn with a filter indicator against it?
protected HasFilterIndicator ( OLVColumn column ) : bool
column OLVColumn
return bool

HasNonThemedSortIndicator() protected method

Should the given column show a non-themed sort indicator?
protected HasNonThemedSortIndicator ( OLVColumn column ) : bool
column OLVColumn
return bool

HasSortIndicator() protected method

Should the given column show a sort indicator?
protected HasSortIndicator ( OLVColumn column ) : bool
column OLVColumn
return bool

HeaderControl() public method

Create a header control for the given ObjectListView.
public HeaderControl ( ObjectListView olv ) : System
olv ObjectListView
return System

Invalidate() public method

Force the header to redraw by invalidating it
public Invalidate ( ) : void
return void

NeedsCustomDraw() protected method

Does this header need to be custom drawn?
Word wrapping and colored text require custom drawning. Funnily enough, we can change the font natively.
protected NeedsCustomDraw ( ) : bool
return bool