列表控件2
#include <UiList_2.h>
继承自UiWin。
公有成员 | |
| void | AddItem (ListItem &item) |
| 添加项到列表的末尾 | |
| virtual int | CalcIndexOfPos (int xPos, int yPos) |
| virtual int | CalcItemHeight (int index) |
| virtual bool | CalcItemRect (int index, __in RECT *prcWin, __out RECT *pRect) |
| 计算某一项的矩形 | |
| int | CalcTotalItemsHeight () |
| 返回所有项的总高度 | |
| virtual void | DrawItem (HDC hdcDst, int nIndex, RECT *prcItem, RECT *prcWin, RECT *prcUpdate) |
| 当绘制列表项时会被调用.重载此成员函数可以自定义列表项的绘制 | |
| void | EnableGridlines (bool bEnable) |
| 启用、关闭列表线的绘制 | |
| void | EnableUltraGridlines (bool bEnable) |
| 启用、关闭额外列表线的绘制. 启用后,即使项的数量不足以填满整个控件区域,表格线仍然会绘制被整个控件区域。 | |
| void | EnableVaryItemHeight (bool bEnable) |
| 启用、关闭“不同项高度”支持,即每一项的高度都可以不同。 | |
| BOOL | GetExtendedProperty_UiList_2 (int nPropertyType, void *pValue, int nBufSize) |
| 获取或设置对象的扩展属性值 | |
| int | GetFirstVisibleItemIndex (int &nItemTopPos, RECT *prcWin, RECT *prcUpdate) |
| MZFC_INLINE COLORREF | GetGridlineColor_GradientBottomLeft () |
| MZFC_INLINE COLORREF | GetGridlineColor_GradientBottomrRight () |
| MZFC_INLINE COLORREF | GetGridlineColor_GradientTopLeft () |
| MZFC_INLINE COLORREF | GetGridlineColor_GradientTopRight () |
| ListItem * | GetItem (int index) |
| 获得列表项的数据 | |
| virtual int | GetItemCount () |
| 获得列表项的总数 | |
| int | GetMinHeight () |
| int | GetOriginOffset () |
| int | GetSelectedIndex () |
| void | InsertItem (ListItem &item, int nPos=-1) |
| 添加项到列表的指定位置: nPos: 0:最前面, -1:最后面 | |
| void | InvalidateItem (int nIndex) |
| bool | IsEnableVaryItemHeight () |
| 是否启用了“不同项高度”支持 | |
| bool | IsGridlinesEnabled () |
| bool | IsUltraGridlinesEnabled () |
| virtual int | OnDrawGradlines (HDC hdcDst, int nIndex, RECT *prcItem, bool bOuter=false) |
| virtual int | OnLButtonDown (UINT fwKeys, int xPos, int yPos) |
| 当控件被左键按下时,此函数会被调用. | |
| virtual int | OnLButtonUp (UINT fwKeys, int xPos, int yPos) |
| 当控件被左键放开时,此函数会被调用. | |
| virtual int | OnMouseMove (UINT fwKeys, int xPos, int yPos) |
| 当控件上鼠标移动时,此函数会被调用. | |
| virtual void | OnRemoveItem (int nIndex) |
| 当列表项被删除时,会调用此成员函数 | |
| virtual void | OnSelectItem (int nIndex, UINT fwKeys, int xPos, int yPos) |
| 列表项被选中时,会调用此函数 | |
| void | PaintWin (HDC hdc, RECT *prcWin, RECT *prcUpdate) |
| 绘制控件 | |
| void | RemoveAll () |
| 删除列表的所有项 | |
| void | RemoveItem (int nIndex) |
| 删除列表的指定项 | |
| BOOL | SetExtendedProperty_UiList_2 (int nPropertyType, void *pValue, int nBufSize) |
| 获取或设置对象的扩展属性值 | |
| void | SetGridlineColor_GradientBottomLeft (COLORREF clrGridline) |
| 设置列表线的渐变色(底部左边) | |
| void | SetGridlineColor_GradientBottomRight (COLORREF clrGridline) |
| 设置列表线的渐变色(底部中间) | |
| void | SetGridlineColor_GradientTopLeft (COLORREF clrGridline) |
| 设置列表线的渐变色(顶部左边) | |
| void | SetGridlineColor_GradientTopRight (COLORREF clrGridline) |
| 设置列表线的渐变色(顶部中间) | |
| void | SetItemHeight (int nHeight) |
| 设置列表项的默认高度 | |
| void | SetMinHeight (int nHeight) |
| void | SetOriginOffset (int offset) |
| 设置当GetTopPos为零时,内容顶部与控件顶部的偏移值 | |
| void | SetSelectedIndex (int index) |
| 设置选中项: | |
| void | SortItems (CompareListItem fnCompare, size_t nBeginPos, size_t nCount) |
| UiList_2 (void) | |
| void | UpdateList () |
| 更新列表的高度 (当列表项的数量有变动,或列表项的高度有变动,都需要调用此函数来重新计算设置控件的高度) | |
| ~UiList_2 (void) | |
保护属性 | |
| bool | m_bEnableVaryItemHeight |
| bool | m_bIsInDragH |
| bool | m_bIsVertDragDisabled |
| bool | m_bMouseDown |
| void * | m_Items |
| int | m_nItemHeight |
| int | m_nOriginOffset |
| int | m_nSelectedIndex |
列表控件2
| UiList_2::UiList_2 | ( | void | ) |
| UiList_2::~UiList_2 | ( | void | ) |
| void UiList_2::AddItem | ( | ListItem & | item | ) |
添加项到列表的末尾
operations to items
| virtual int UiList_2::CalcIndexOfPos | ( | int | xPos, | |
| int | yPos | |||
| ) | [virtual] |
计算某个坐标所在的列表项的索引: 返回值: -1:无, >=0: 项索引
| virtual int UiList_2::CalcItemHeight | ( | int | index | ) | [virtual] |
获得(计算)某一项的高度。 重载此函数以自定义每一项的高度. index: -1:返回的是默认项高度; >=0:返回指定项的高度 此成员函数只当 UiList::IsEnableVaryItemHeight() 为true时被调用。
| virtual bool UiList_2::CalcItemRect | ( | int | index, | |
| __in RECT * | prcWin, | |||
| __out RECT * | pRect | |||
| ) | [virtual] |
计算某一项的矩形
| int UiList_2::CalcTotalItemsHeight | ( | ) |
返回所有项的总高度
| virtual void UiList_2::DrawItem | ( | HDC | hdcDst, | |
| int | nIndex, | |||
| RECT * | prcItem, | |||
| RECT * | prcWin, | |||
| RECT * | prcUpdate | |||
| ) | [virtual] |
当绘制列表项时会被调用.重载此成员函数可以自定义列表项的绘制
| hdcDst | 目的DC | |
| nIndex | 要绘制的项的索引. | |
| prcItem | 列表项所在的矩形区域. | |
| prcWin | 列表控件所在区域. | |
| prcUpdate | 控件需要重画的区域.为优化绘制速度,不包含在prcUpdate区域内的内容请不要绘制。 |
| void UiList_2::EnableGridlines | ( | bool | bEnable | ) |
启用、关闭列表线的绘制
| void UiList_2::EnableUltraGridlines | ( | bool | bEnable | ) |
启用、关闭额外列表线的绘制. 启用后,即使项的数量不足以填满整个控件区域,表格线仍然会绘制被整个控件区域。
| void UiList_2::EnableVaryItemHeight | ( | bool | bEnable | ) |
启用、关闭“不同项高度”支持,即每一项的高度都可以不同。
| BOOL UiList_2::GetExtendedProperty_UiList_2 | ( | int | nPropertyType, | |
| void * | pValue, | |||
| int | nBufSize | |||
| ) |
获取或设置对象的扩展属性值
| nPropertyType | 要获取或设置的属性类型 | |
| pValue | 要获取或设置的属性值的指针 | |
| nBufSize | pValue所指向的变量的size大小(单位: 字节) |
| int UiList_2::GetFirstVisibleItemIndex | ( | int & | nItemTopPos, | |
| RECT * | prcWin, | |||
| RECT * | prcUpdate | |||
| ) |
| MZFC_INLINE COLORREF UiList_2::GetGridlineColor_GradientBottomLeft | ( | ) |
| MZFC_INLINE COLORREF UiList_2::GetGridlineColor_GradientBottomrRight | ( | ) |
| MZFC_INLINE COLORREF UiList_2::GetGridlineColor_GradientTopLeft | ( | ) |
| MZFC_INLINE COLORREF UiList_2::GetGridlineColor_GradientTopRight | ( | ) |
| ListItem* UiList_2::GetItem | ( | int | index | ) |
获得列表项的数据
| virtual int UiList_2::GetItemCount | ( | ) | [virtual] |
获得列表项的总数
| int UiList_2::GetMinHeight | ( | ) |
| int UiList_2::GetOriginOffset | ( | ) |
| int UiList_2::GetSelectedIndex | ( | ) |
获得选中项的索引: 返回值: -1:无, >=0: 项索引
| void UiList_2::InsertItem | ( | ListItem & | item, | |
| int | nPos = -1 | |||
| ) |
添加项到列表的指定位置: nPos: 0:最前面, -1:最后面
| void UiList_2::InvalidateItem | ( | int | nIndex | ) |
无效某一项所在的区域. nIndex: 项的索引,大于小于零
| bool UiList_2::IsEnableVaryItemHeight | ( | ) |
是否启用了“不同项高度”支持
| bool UiList_2::IsGridlinesEnabled | ( | ) |
| bool UiList_2::IsUltraGridlinesEnabled | ( | ) |
| virtual int UiList_2::OnDrawGradlines | ( | HDC | hdcDst, | |
| int | nIndex, | |||
| RECT * | prcItem, | |||
| bool | bOuter = false | |||
| ) | [virtual] |
| virtual int UiList_2::OnLButtonDown | ( | UINT | fwKeys, | |
| int | xPos, | |||
| int | yPos | |||
| ) | [virtual] |
当控件被左键按下时,此函数会被调用.
重载UiWin。
| virtual int UiList_2::OnLButtonUp | ( | UINT | fwKeys, | |
| int | xPos, | |||
| int | yPos | |||
| ) | [virtual] |
当控件被左键放开时,此函数会被调用.
重载UiWin。
| virtual int UiList_2::OnMouseMove | ( | UINT | fwKeys, | |
| int | xPos, | |||
| int | yPos | |||
| ) | [virtual] |
当控件上鼠标移动时,此函数会被调用.
重载UiWin。
| virtual void UiList_2::OnRemoveItem | ( | int | nIndex | ) | [virtual] |
当列表项被删除时,会调用此成员函数
假如你重载了此函数,则必须在你的派生列表类的析构函数中调用RemoveAll(),这样才能保证OnRemoveItem被调用。
| virtual void UiList_2::OnSelectItem | ( | int | nIndex, | |
| UINT | fwKeys, | |||
| int | xPos, | |||
| int | yPos | |||
| ) | [virtual] |
列表项被选中时,会调用此函数
| void UiList_2::PaintWin | ( | HDC | hdcDst, | |
| RECT * | prcWin, | |||
| RECT * | prcUpdate | |||
| ) | [virtual] |
绘制控件
重载此函数可以自定义控件的绘制
| hdcDst | 目的DC | |
| prcWin | 控件所在区域(以HDC的左上角为原点) | |
| prcUpdate | 需要更新的区域(以HDC的左上角为原点) |
重载UiWin。
| void UiList_2::RemoveAll | ( | ) |
删除列表的所有项
| void UiList_2::RemoveItem | ( | int | nIndex | ) |
删除列表的指定项
| BOOL UiList_2::SetExtendedProperty_UiList_2 | ( | int | nPropertyType, | |
| void * | pValue, | |||
| int | nBufSize | |||
| ) |
获取或设置对象的扩展属性值
| nPropertyType | 要获取或设置的属性类型 | |
| pValue | 要设置的属性值的指针 | |
| nBufSize | pValue所指向的变量的size大小(单位: 字节) |
| void UiList_2::SetGridlineColor_GradientBottomLeft | ( | COLORREF | clrGridline | ) |
设置列表线的渐变色(底部左边)
| void UiList_2::SetGridlineColor_GradientBottomRight | ( | COLORREF | clrGridline | ) |
设置列表线的渐变色(底部中间)
| void UiList_2::SetGridlineColor_GradientTopLeft | ( | COLORREF | clrGridline | ) |
设置列表线的渐变色(顶部左边)
| void UiList_2::SetGridlineColor_GradientTopRight | ( | COLORREF | clrGridline | ) |
设置列表线的渐变色(顶部中间)
| void UiList_2::SetItemHeight | ( | int | nHeight | ) |
设置列表项的默认高度
| void UiList_2::SetMinHeight | ( | int | nHeight | ) |
| void UiList_2::SetOriginOffset | ( | int | offset | ) |
设置当GetTopPos为零时,内容顶部与控件顶部的偏移值
| void UiList_2::SetSelectedIndex | ( | int | index | ) |
设置选中项:
| void UiList_2::SortItems | ( | CompareListItem | fnCompare, | |
| size_t | nBeginPos, | |||
| size_t | nCount | |||
| ) |
| void UiList_2::UpdateList | ( | ) |
更新列表的高度 (当列表项的数量有变动,或列表项的高度有变动,都需要调用此函数来重新计算设置控件的高度)
bool UiList_2::m_bEnableVaryItemHeight [protected] |
bool UiList_2::m_bIsInDragH [protected] |
重载UiWin。
bool UiList_2::m_bIsVertDragDisabled [protected] |
重载UiWin。
bool UiList_2::m_bMouseDown [protected] |
void* UiList_2::m_Items [protected] |
int UiList_2::m_nItemHeight [protected] |
int UiList_2::m_nOriginOffset [protected] |
int UiList_2::m_nSelectedIndex [protected] |
1.6.1