soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SHeaderCtrl Class Reference

Header Control. More...

#include <SHeaderCtrl.h>

Public Member Functions

 SHeaderCtrl (void)
 Constructor.
 
 ~SHeaderCtrl (void)
 Destructor.
 
int InsertItem (int iItem, LPCTSTR pszText, int nWidth, UINT fmt, LPARAM lParam, BOOL bDpiAware=FALSE, float fWeight=0.0f) OVERRIDE
 Insert a new item.
 
int InsertItemA (int iItem, LPCSTR pszText, int nWidth, UINT fmt, LPARAM lParam, BOOL bDpiAware=FALSE, float fWeight=0.0f) OVERRIDE
 Insert a new item (ANSI version)
 
BOOL GetItem (int iItem, SHDITEM *pItem) SCONST OVERRIDE
 Get an item.
 
BOOL SetItem (int iItem, const SHDITEM *pItem) OVERRIDE
 Set an item.
 
UINT GetItemCount () SCONST OVERRIDE
 Get the number of items.
 
int GetTotalWidth (BOOL bMinWid=FALSE) SCONST OVERRIDE
 Get the total width of all items.
 
BOOL IsAutoResize () SCONST OVERRIDE
 Check if auto-resize is enabled.
 
int GetItemWidth (int iItem) SCONST OVERRIDE
 Get the width of a specific item.
 
BOOL DeleteItem (int iItem) OVERRIDE
 Delete a specific item.
 
void DeleteAllItems () OVERRIDE
 Delete all items.
 
void SetItemSort (int iItem, UINT sortFlag) OVERRIDE
 Set the sort flag for an item.
 
void SetItemVisible (int iItem, BOOL visible) OVERRIDE
 Set the visibility of an item.
 
BOOL IsItemVisible (int iItem) SCONST OVERRIDE
 Check if an item is visible.
 
int GetOriItemIndex (int iOrder) SCONST OVERRIDE
 Get the original item index from the order.
 
void GetItemRect (int iItem, LPRECT prc) SCONST OVERRIDE
 Get the rectangle of an item.
 
CRect GetItemRect (int iItem) const
 Get the rectangle of an item.
 
virtual HRESULT SetAttribute (const SNS::SStringW &amp;amp;amp;amp;strAttribName, const SNS::SStringW &amp;amp;amp;amp;strValue, BOOL bLoading=FALSE)
 

Protected Member Functions

virtual BOOL CreateChildren (SXmlNode xmlNode)
 Create child items from XML configuration.
 
virtual BOOL OnSetCursor (const CPoint &pt)
 Set the cursor based on the mouse position.
 
void OnPaint (IRenderTarget *pRT)
 Paint the control.
 
virtual void DrawItem (IRenderTarget *pRT, CRect rcItem, const LPSHDITEMEX pItem)
 Draw an item.
 
virtual void OnColorize (COLORREF cr)
 Handle colorization event.
 
virtual HRESULT OnLanguageChanged ()
 Handle language change event.
 
virtual void OnScaleChanged (int nScale)
 Handle scale change event.
 
virtual BOOL OnRelayout (const CRect &rcWnd)
 Handle relayout event.
 
DWORD HitTest (CPoint pt)
 Hit test to determine the item under the mouse.
 
void RedrawItem (int iItem)
 Redraw a specific item.
 
void DrawDraggingState (DWORD dwDragTo)
 Draw the dragging state.
 
BOOL IsItemHover (DWORD dwHitTest)
 Check if an item is in hover state.
 
HBITMAP CreateDragImage (UINT iItem)
 Create a drag image for an item.
 
void OnLButtonDown (UINT nFlags, CPoint pt)
 Handle left mouse button down event.
 
void OnLButtonUp (UINT nFlags, CPoint pt)
 Handle left mouse button up event.
 
void OnMouseMove (UINT nFlags, CPoint pt)
 Handle mouse move event.
 
void OnMouseLeave ()
 Handle mouse leave event.
 
void OnDestroy ()
 Handle destroy event.
 
void OnActivateApp (BOOL bActive, DWORD dwThreadID)
 Handle activate application event.
 

Protected Attributes

SAutoRefPtr< ISkinObjm_pSkinItem
 
SAutoRefPtr< ISkinObjm_pSkinSort
 
BOOL m_bSortHeader
 
BOOL m_bFixWidth
 
BOOL m_bItemSwapEnable
 
BOOL m_bDragging
 
HBITMAP m_hDragImg
 
CPoint m_ptClick
 
DWORD m_dwHitTest
 
DWORD m_dwDragTo
 
int m_nAdjItemOldWidth
 
SArray< SHDITEMEX > m_arrItems
 
int m_nScale
 

Detailed Description

Header Control.

A header control that manages columns with titles and sorting indicators.

Definition at line 18 of file SHeaderCtrl.h.

Constructor & Destructor Documentation

◆ SHeaderCtrl()

SNSBEGIN SHeaderCtrl::SHeaderCtrl ( void )

Constructor.

Definition at line 6 of file SHeaderCtrl.cpp.

◆ ~SHeaderCtrl()

SHeaderCtrl::~SHeaderCtrl ( void )

Destructor.

Definition at line 25 of file SHeaderCtrl.cpp.

Member Function Documentation

◆ CreateChildren()

BOOL SHeaderCtrl::CreateChildren ( SXmlNode xmlNode)
protectedvirtual

Create child items from XML configuration.

Parameters
xmlNodeXML node for the child items
Returns
TRUE if successful, FALSE otherwise

Reimplemented from SWindow.

Definition at line 464 of file SHeaderCtrl.cpp.

◆ CreateDragImage()

HBITMAP SHeaderCtrl::CreateDragImage ( UINT iItem)
protected

Create a drag image for an item.

Parameters
iItemIndex of the item
Returns
Handle to the drag image

Definition at line 575 of file SHeaderCtrl.cpp.

◆ DeleteAllItems()

void SHeaderCtrl::DeleteAllItems ( )

Delete all items.

Definition at line 191 of file SHeaderCtrl.cpp.

◆ DeleteItem()

BOOL SHeaderCtrl::DeleteItem ( int iItem)

Delete a specific item.

Parameters
iItemIndex of the item to delete
Returns
TRUE if successful, FALSE otherwise

Definition at line 171 of file SHeaderCtrl.cpp.

◆ DrawDraggingState()

void SHeaderCtrl::DrawDraggingState ( DWORD dwDragTo)
protected

Draw the dragging state.

Parameters
dwDragToDrag target

Definition at line 602 of file SHeaderCtrl.cpp.

◆ DrawItem()

void SHeaderCtrl::DrawItem ( IRenderTarget * pRT,
CRect rcItem,
const LPSHDITEMEX pItem )
protectedvirtual

Draw an item.

Parameters
pRTRendering target handle
rcItemRectangle for the item
pItemPointer to the item structure

Definition at line 141 of file SHeaderCtrl.cpp.

◆ GetItem()

BOOL SHeaderCtrl::GetItem ( int iItem,
SHDITEM * pItem )

Get an item.

Parameters
iItemIndex of the item
pItemOutput structure for the item
Returns
TRUE if successful, FALSE otherwise

Definition at line 64 of file SHeaderCtrl.cpp.

◆ GetItemCount()

UINT SHeaderCtrl::GetItemCount ( )

Get the number of items.

Returns
Number of items

Definition at line 808 of file SHeaderCtrl.cpp.

◆ GetItemRect() [1/2]

CRect SHeaderCtrl::GetItemRect ( int iItem) const

Get the rectangle of an item.

Parameters
iItemIndex of the item
Returns
Rectangle of the item

Definition at line 207 of file SHeaderCtrl.cpp.

◆ GetItemRect() [2/2]

void SHeaderCtrl::GetItemRect ( int iItem,
LPRECT prc )

Get the rectangle of an item.

Parameters
iItemIndex of the item
prcOutput rectangle

Definition at line 224 of file SHeaderCtrl.cpp.

◆ GetItemWidth()

int SHeaderCtrl::GetItemWidth ( int iItem)

Get the width of a specific item.

Parameters
iItemIndex of the item
Returns
Width of the item

Definition at line 657 of file SHeaderCtrl.cpp.

◆ GetOriItemIndex()

int SHeaderCtrl::GetOriItemIndex ( int iOrder)

Get the original item index from the order.

Parameters
iOrderOrder index
Returns
Original item index

Definition at line 229 of file SHeaderCtrl.cpp.

◆ GetTotalWidth()

int SHeaderCtrl::GetTotalWidth ( BOOL bMinWid = FALSE)

Get the total width of all items.

Parameters
bMinWidWhether to get the minimum width
Returns
Total width

Definition at line 634 of file SHeaderCtrl.cpp.

◆ HitTest()

DWORD SHeaderCtrl::HitTest ( CPoint pt)
protected

Hit test to determine the item under the mouse.

Parameters
ptMouse coordinates
Returns
Hit test result (DWORD)

Definition at line 539 of file SHeaderCtrl.cpp.

◆ InsertItem()

int SHeaderCtrl::InsertItem ( int iItem,
LPCTSTR pszText,
int nWidth,
UINT fmt,
LPARAM lParam,
BOOL bDpiAware = FALSE,
float fWeight = 0.0f )

Insert a new item.

Parameters
iItemIndex of the new item
pszTextTitle of the new item
nWidthWidth of the new item
fmtFormat flag
lParamAdditional parameter
bDpiAwareDPI awareness flag
fWeightFont weight
Returns
Index of the inserted item

Definition at line 29 of file SHeaderCtrl.cpp.

◆ InsertItemA()

int SHeaderCtrl::InsertItemA ( int iItem,
LPCSTR pszText,
int nWidth,
UINT fmt,
LPARAM lParam,
BOOL bDpiAware = FALSE,
float fWeight = 0.0f )
inline

Insert a new item (ANSI version)

Parameters
iItemIndex of the new item
pszTextTitle of the new item
nWidthWidth of the new item
fmtFormat flag
lParamAdditional parameter
bDpiAwareDPI awareness flag
fWeightFont weight
Returns
Index of the inserted item

Definition at line 69 of file SHeaderCtrl.h.

◆ IsAutoResize()

BOOL SHeaderCtrl::IsAutoResize ( )

Check if auto-resize is enabled.

Returns
TRUE if auto-resize is enabled, FALSE otherwise

Definition at line 798 of file SHeaderCtrl.cpp.

◆ IsItemHover()

BOOL SHeaderCtrl::IsItemHover ( DWORD dwHitTest)
inlineprotected

Check if an item is in hover state.

Parameters
dwHitTestHit test result
Returns
TRUE if in hover state, FALSE otherwise

Definition at line 259 of file SHeaderCtrl.h.

◆ IsItemVisible()

BOOL SHeaderCtrl::IsItemVisible ( int iItem)

Check if an item is visible.

Parameters
iItemIndex of the item
Returns
TRUE if visible, FALSE otherwise

Definition at line 792 of file SHeaderCtrl.cpp.

◆ OnActivateApp()

void SHeaderCtrl::OnActivateApp ( BOOL bActive,
DWORD dwThreadID )
protected

Handle activate application event.

Parameters
bActiveActivation flag
dwThreadIDThread ID

Definition at line 702 of file SHeaderCtrl.cpp.

◆ OnColorize()

void SHeaderCtrl::OnColorize ( COLORREF cr)
protectedvirtual

Handle colorization event.

Parameters
crColor reference

Reimplemented from SWindow.

Definition at line 734 of file SHeaderCtrl.cpp.

◆ OnDestroy()

void SHeaderCtrl::OnDestroy ( )
protected

Handle destroy event.

Definition at line 199 of file SHeaderCtrl.cpp.

◆ OnLanguageChanged()

HRESULT SHeaderCtrl::OnLanguageChanged ( )
protectedvirtual

Handle language change event.

Returns
HRESULT

Reimplemented from SWindow.

Definition at line 743 of file SHeaderCtrl.cpp.

◆ OnLButtonDown()

void SHeaderCtrl::OnLButtonDown ( UINT nFlags,
CPoint pt )
protected

Handle left mouse button down event.

Parameters
nFlagsFlags
ptMouse coordinates

Definition at line 247 of file SHeaderCtrl.cpp.

◆ OnLButtonUp()

void SHeaderCtrl::OnLButtonUp ( UINT nFlags,
CPoint pt )
protected

Handle left mouse button up event.

Parameters
nFlagsFlags
ptMouse coordinates

Definition at line 267 of file SHeaderCtrl.cpp.

◆ OnMouseLeave()

void SHeaderCtrl::OnMouseLeave ( )
protected

Handle mouse leave event.

Definition at line 448 of file SHeaderCtrl.cpp.

◆ OnMouseMove()

void SHeaderCtrl::OnMouseMove ( UINT nFlags,
CPoint pt )
protected

Handle mouse move event.

Parameters
nFlagsFlags
ptMouse coordinates

Definition at line 330 of file SHeaderCtrl.cpp.

◆ OnPaint()

void SHeaderCtrl::OnPaint ( IRenderTarget * pRT)
protected

Paint the control.

Parameters
pRTRendering target handle

Definition at line 114 of file SHeaderCtrl.cpp.

◆ OnRelayout()

BOOL SHeaderCtrl::OnRelayout ( const CRect & rcWnd)
protectedvirtual

Handle relayout event.

Parameters
rcWndWindow rectangle
Returns
TRUE if successful, FALSE otherwise

Reimplemented from SWindow.

Definition at line 768 of file SHeaderCtrl.cpp.

◆ OnScaleChanged()

void SHeaderCtrl::OnScaleChanged ( int nScale)
protectedvirtual

Handle scale change event.

Parameters
nScaleScale factor

Reimplemented from SWindow.

Definition at line 753 of file SHeaderCtrl.cpp.

◆ OnSetCursor()

BOOL SHeaderCtrl::OnSetCursor ( const CPoint & pt)
protectedvirtual

Set the cursor based on the mouse position.

Parameters
ptMouse coordinates
Returns
TRUE if successful, FALSE otherwise

Reimplemented from SWindow.

Definition at line 527 of file SHeaderCtrl.cpp.

◆ RedrawItem()

void SHeaderCtrl::RedrawItem ( int iItem)
protected

Redraw a specific item.

Parameters
iItemIndex of the item to redraw

Definition at line 239 of file SHeaderCtrl.cpp.

◆ SetAttribute()

virtual HRESULT SHeaderCtrl::SetAttribute ( const SNS::SStringW &amp;amp;amp;amp; strAttribName,
const SNS::SStringW &amp;amp;amp;amp; strValue,
BOOL bLoading = FALSE )
inlinevirtual

Reimplemented from SWindow.

Definition at line 173 of file SHeaderCtrl.h.

◆ SetItem()

BOOL SHeaderCtrl::SetItem ( int iItem,
const SHDITEM * pItem )

Set an item.

Parameters
iItemIndex of the item
pItemStructure for the item
Returns
TRUE if successful, FALSE otherwise

Definition at line 89 of file SHeaderCtrl.cpp.

◆ SetItemSort()

void SHeaderCtrl::SetItemSort ( int iItem,
UINT sortFlag )

Set the sort flag for an item.

Parameters
iItemIndex of the item
sortFlagSort flag

Definition at line 721 of file SHeaderCtrl.cpp.

◆ SetItemVisible()

void SHeaderCtrl::SetItemVisible ( int iItem,
BOOL visible )

Set the visibility of an item.

Parameters
iItemIndex of the item
visibleVisibility flag

Definition at line 779 of file SHeaderCtrl.cpp.

Member Data Documentation

◆ m_arrItems

SArray<SHDITEMEX> SHeaderCtrl::m_arrItems
protected

Array of header items

Definition at line 332 of file SHeaderCtrl.h.

◆ m_bDragging

BOOL SHeaderCtrl::m_bDragging
protected

Dragging flag

Definition at line 326 of file SHeaderCtrl.h.

◆ m_bFixWidth

BOOL SHeaderCtrl::m_bFixWidth
protected

Whether item widths are fixed

Definition at line 323 of file SHeaderCtrl.h.

◆ m_bItemSwapEnable

BOOL SHeaderCtrl::m_bItemSwapEnable
protected

Whether item swapping is enabled

Definition at line 324 of file SHeaderCtrl.h.

◆ m_bSortHeader

BOOL SHeaderCtrl::m_bSortHeader
protected

Whether header can be clicked to sort

Definition at line 322 of file SHeaderCtrl.h.

◆ m_dwDragTo

DWORD SHeaderCtrl::m_dwDragTo
protected

Drag target

Definition at line 330 of file SHeaderCtrl.h.

◆ m_dwHitTest

DWORD SHeaderCtrl::m_dwHitTest
protected

Hit test result

Definition at line 329 of file SHeaderCtrl.h.

◆ m_hDragImg

HBITMAP SHeaderCtrl::m_hDragImg
protected

Bitmap for drag image

Definition at line 327 of file SHeaderCtrl.h.

◆ m_nAdjItemOldWidth

int SHeaderCtrl::m_nAdjItemOldWidth
protected

Original width of the dragged item

Definition at line 331 of file SHeaderCtrl.h.

◆ m_nScale

int SHeaderCtrl::m_nScale
protected

Current scale factor

Definition at line 333 of file SHeaderCtrl.h.

◆ m_pSkinItem

SAutoRefPtr<ISkinObj> SHeaderCtrl::m_pSkinItem
protected

Skin for drawing header items

Definition at line 320 of file SHeaderCtrl.h.

◆ m_pSkinSort

SAutoRefPtr<ISkinObj> SHeaderCtrl::m_pSkinSort
protected

Skin for sorting indicators

Definition at line 321 of file SHeaderCtrl.h.

◆ m_ptClick

CPoint SHeaderCtrl::m_ptClick
protected

Click point

Definition at line 328 of file SHeaderCtrl.h.


The documentation for this class was generated from the following files: