/*
================
rvRollupPanel::ExpandItem

expand or collapse the item at the given index
================
*/
void rvRollupPanel::ExpandAllItems(bool expand)
{
	int i;

	// expand all items
	for (i=0; i < mItems.Num(); i ++) {
		_ExpandItem(mItems[i], expand);
	}

	RecallLayout();
}
示例#2
0
void CListViewCtrlEx::ExpandGroup( INT nItem, BOOL bExpand )
{
    // - title collapsed
    TListItem *pItem = _GetItemData( nItem );
    if(!pItem)
        return;

    if( (pItem->dwFlags & LISTITEM_TITLE)
            && (pItem->dwFlags & LISTITEM_EXPANDABLE) )
    {
        BOOL needRedraw = _ExpandItem(pItem, nItem, bExpand);
        RECT rcItem = {0};
        if( GetItemRect(nItem, &rcItem, LVIR_BOUNDS) )
            InvalidateRect( &rcItem );
    }
}
/*
================
rvRollupPanel::ExpandItem

expand or collapse the item at the given index
================
*/
void rvRollupPanel::ExpandItem(int index, bool expand)
{
	// safety check
	if (index >= mItems.Num() || index < 0) {
		return;
	}

	_ExpandItem(mItems[index], expand);

	RecallLayout();

	// scroll to this page (automatic page visibility)
	if (expand) {
		ScrollToItem(index, false);
	}
}
示例#4
0
LRESULT CListViewCtrlEx::OnClick( int idCtrl, LPNMHDR pnmh, BOOL& bHandled )
{
    bHandled = FALSE;

    LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) pnmh;

    // - title collapsed
    TListItem *pItem = _GetItemData(lpnmitem->iItem);
    if(!pItem)
        return 0;

    if(pItem->dwFlags & LISTITEM_TITLE)
    {
        if(pItem->dwFlags & LISTITEM_EXPANDABLE)
        {
            INT iItem = lpnmitem->iItem;
            RECT rcItem = {0};
            if( GetItemRect(iItem, &rcItem, LVIR_BOUNDS) )
            {
                _ExpandItem(pItem, lpnmitem->iItem, pItem->_isclapsed);
                InvalidateRect( &rcItem );
            }
            return 0;
        }
    }
    else
    {
        // - link check
        int iSubItem = lpnmitem->iSubItem;
        if(_PtInSubItemLink(lpnmitem->ptAction, lpnmitem->iItem, iSubItem) )
            _FireEvent(WMH_LISTEX_LINK, lpnmitem->iItem, iSubItem);
        else if( pItem->dwFlags & (LISTITEM_CHECKBOX|LISTITEM_RADIOBOX) )
        {
            // - check box
            BOOL bDirty = FALSE;
            if (pItem->dwFlags&LISTITEM_RADIOBOX)
            {
                bDirty = TRUE;
                SetRadioState( lpnmitem->iItem, !_super::GetCheckState(lpnmitem->iItem) );
            }
            else if (_PtInSubItemCheckBox(lpnmitem->ptAction, lpnmitem->iItem))
            {
                bDirty = TRUE;
                SetCheckState( lpnmitem->iItem, !_super::GetCheckState(lpnmitem->iItem) );
            }

            if( bDirty )
            {
                CRect	rcItem;
                GetItemRect( lpnmitem->iItem, &rcItem, LVIR_BOUNDS);
                InvalidateRect( rcItem );
            }

            /*const TListSubItem *pSubItem = _GetSubItemData(lpnmitem->iItem,lpnmitem->iSubItem);
            if(pSubItem->type==SUBITEM_COMBO)
            {

            }*/
        }
    }
    return 0;
}