UIList.cpp ( 文件浏览 )
- keepall 发布于 2016-08-23 13:24
- 浏览次数:521
- 下载次数: 1
- 下载需 20 积分
-
- 侵权举报
#include "StdAfx.h" namespace DuiLib { ///////////////////////////////////////////////////////////////////////////////////// // // CListUI::CListUI() : m_pCallback(NULL), m_bScrollSelect(false), m_iCurSel(-1), m_iExpandedItem(-1) { m_pList = new CListBodyUI(this); m_pHeader = new CListHeaderUI; Add(m_pHeader); CVerticalLayoutUI::Add(m_pList); m_ListInfo.nColumns = 0; m_ListInfo.nFont = -1; m_ListInfo.uTextStyle = DT_VCENTER; // m_uTextStyle(DT_VCENTER | DT_END_ELLIPSIS) m_ListInfo.dwTextColor = 0xFF000000; m_ListInfo.dwBkColor = 0; m_ListInfo.bAlternateBk = false; m_ListInfo.dwSelectedTextColor = 0xFF000000; m_ListInfo.dwSelectedBkColor = 0xFFC1E3FF; m_ListInfo.dwHotTextColor = 0xFF000000; m_ListInfo.dwHotBkColor = 0xFFE9F5FF; m_ListInfo.dwDisabledTextColor = 0xFFCCCCCC; m_ListInfo.dwDisabledBkColor = 0xFFFFFFFF; m_ListInfo.dwLineColor = 0; m_ListInfo.bShowHtml = false; m_ListInfo.bMultiExpandable = false; ::ZeroMemory(&m_ListInfo.rcTextPadding, sizeof(m_ListInfo.rcTextPadding)); ::ZeroMemory(&m_ListInfo.rcColumn, sizeof(m_ListInfo.rcColumn)); } LPCTSTR CListUI::GetClass() const { return _T("ListUI"); } UINT CListUI::GetControlFlags() const { return UIFLAG_TABSTOP; } LPVOID CListUI::GetInterface(LPCTSTR pstrName) { if( _tcscmp(pstrName, _T("List")) == 0 ) return static_cast<CListUI*>(this); if( _tcscmp(pstrName, _T("IList")) == 0 ) return static_cast<IListUI*>(this); if( _tcscmp(pstrName, _T("IListOwner")) == 0 ) return static_cast<IListOwnerUI*>(this); return CVerticalLayoutUI::GetInterface(pstrName); } CControlUI* CListUI::GetItemAt(int iIndex) const { return m_pList->GetItemAt(iIndex); } int CListUI::GetItemIndex(CControlUI* pControl) const { if( pControl->GetInterface(_T("ListHeader")) != NULL ) return CVerticalLayoutUI::GetItemIndex(pControl); // We also need to recognize header sub-items if( _tcsstr(pControl->GetClass(), _T("ListHeaderItemUI")) != NULL ) return m_pHeader->GetItemIndex(pControl); return m_pList->GetItemIndex(pControl); } bool CListUI::SetItemIndex(CControlUI* pControl, int iIndex) { if( pControl->GetInterface(_T("ListHeader")) != NULL ) return CVerticalLayoutUI::SetItemIndex(pControl, iIndex); // We also need to recognize header sub-items if( _tcsstr(pControl->GetClass(), _T("ListHeaderItemUI")) != NULL ) return m_pHeader->SetItemIndex(pControl, iIndex); int iOrginIndex = m_pList->GetItemIndex(pControl); if( iOrginIndex == -1 ) return false; if( iOrginIndex == iIndex ) return true; IListItemUI* pSelectedListItem = NULL; if( m_iCurSel >= 0 ) pSelectedListItem = static_cast<IListItemUI*>(GetItemAt(m_iCurSel)->GetInterface(_T("ListItem"))); if( !m_pList->SetItemIndex(pControl, iIndex) ) return false; int iMinIndex = min(iOrginIndex, iIndex); int iMaxIndex = m[!==More==!]
...
展开> <收缩
Sponsored links
源码文件列表
温馨提示: 点击源码文件名可预览文件内容哦 ^_^ Sponsored links