예제 #1
0
BOOL CClonePairListCtrl::OnToolNeedText(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
{
    CPoint pt(GetMessagePos());
    ScreenToClient(&pt);

    int nRow, nCol;
    CellHitTest(pt, nRow, nCol);

    LPTSTR tooltip = GetToolTipText(nRow, nCol);
    if( tooltip == NULL)
	{ 
		return FALSE;
	}

	// Non-unicode applications can receive requests for tooltip-text in unicode
    TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
    TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
#ifndef _UNICODE
    if (pNMHDR->code == TTN_NEEDTEXTA)
        lstrcpyn(pTTTA->szText, static_cast<LPCTSTR>(tooltip), sizeof(pTTTA->szText));
    else
        _mbstowcsz(pTTTW->szText, static_cast<LPCTSTR>(tooltip), 
				sizeof(pTTTW->szText)/sizeof(WCHAR));
#else
	pTTTA->lpszText = (LPSTR) tooltip;

#endif
    // If wanting to display a tooltip which is longer than 80 characters,
    // one must allocate the needed text-buffer instead of using szText,
    // and point the TOOLTIPTEXT::lpszText to this text-buffer.
    // When doing this, one is required to release this text-buffer again
	//free( pTTTA->lpszText);
    return TRUE;
}
예제 #2
0
//------------------------------------------------------------------------
//! Called by the framework when a drop operation is to occur, where the
//! origin is the CGridListCtrlEx itself
//!
//! @param pDataObject Points to the data object containing the data that can be dropped
//! @param dropEffect The effect that the user chose for the drop operation (DROPEFFECT_COPY, DROPEFFECT_MOVE, DROPEFFECT_LINK)
//! @param point Contains the current location of the cursor in client coordinates.
//! @return Nonzero if the drop is successful; otherwise 0
//------------------------------------------------------------------------
BOOL CGridListCtrlGroups::OnDropSelf(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
{
	// Internal drag (Move rows to other group)
	int nRow, nCol;
	CellHitTest(point, nRow, nCol);
	if (!IsGroupViewEnabled())
		return CGridListCtrlEx::MoveSelectedRows(nRow);

	if (GetStyle() & LVS_OWNERDATA)
		return false;

	int nGroupId = nRow!=-1 ? GetRowGroupId(nRow) : GroupHitTest(point);
	if (nGroupId==-1)
		return FALSE;
		
	if (MoveSelectedRows(nGroupId))
	{
		if (nRow!=-1)
		{
			EnsureVisible(nRow, FALSE);
			SetFocusRow(nRow);
		}
	}
	return TRUE;
}
예제 #3
0
BOOL CStockList::OnItemDblClick(NMHDR* pNMHDR, LRESULT* pResult)
{
	NMITEMACTIVATE* pItem = reinterpret_cast<NMITEMACTIVATE*>(pNMHDR);

	// The iItem member of pItem is only valid if the icon or first-column label has been clicked
	int nRow = pItem->iItem;
	int nCol = pItem->iSubItem;

	CellHitTest(pItem->ptAction, nRow, nCol);
	tagQueryGame* QueryGame;
	ZeroMemory(QueryGame,sizeof(QueryGame));

	CString szText;
	if (nRow != -1)
	{
		switch (nCol)
		{
		case 6:
			{
				szText = GetItemText(nRow,5);
				//AfxMessageBox(szText);
				QueryGame->dwServerID = _ttoi(szText);
				QueryGame->dwDay = 2;
				ASSERT(CMissionUserInfo::GetInstance()!=NULL);
				CMissionUserInfo::GetInstance()->OnGetStockUser(QueryGame);
			}
			break;
		case 7:
			{
				szText = GetItemText(nRow,5);
				//AfxMessageBox(szText);

				QueryGame->dwServerID = _ttoi(szText);
				QueryGame->dwDay = 1;
				ASSERT(CMissionUserInfo::GetInstance()!=NULL);
				CMissionUserInfo::GetInstance()->OnGetStockUser(QueryGame);
			}
			break;
		case 8:
			{
				szText = GetItemText(nRow,5);
				//AfxMessageBox(szText);

				QueryGame->dwServerID = _ttoi(szText);
				QueryGame->dwDay = 0;
				ASSERT(CMissionUserInfo::GetInstance()!=NULL);
				CMissionUserInfo::GetInstance()->OnGetStockUser(QueryGame);
			}
			break;
		}
	}

	ASSERT(CMissionUserInfo::GetInstance()!=NULL);
/*	CMissionUserInfo::GetInstance()->SetUserVip(m_tabUserVip);*/

	return FALSE;
}
예제 #4
0
bool CSortListCtrl::ShowToolTip(const CPoint& pt) const
{
	// Lookup up the cell
	int nRow, nCol;
	CellHitTest(pt, nRow, nCol);

	if (nRow!=-1 && nCol!=-1)
		return true;
	else
		return false;
}
예제 #5
0
BOOL CSortListCtrl::OnToolNeedText(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
{
	CPoint pt(GetMessagePos());
	ScreenToClient(&pt);

	int nRow, nCol;
	CellHitTest(pt, nRow, nCol);

	CString tooltip = GetToolTipText(nRow, nCol);
	if (tooltip.IsEmpty())
		return FALSE;

	// Non-unicode applications can receive requests for tooltip-text in unicode
	
	TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
	
	if(!m_pwchTip)      
		  delete m_pwchTip;

	m_pwchTip = tooltip;

	//get the maxwidth for the tooltip
	int maxwidth = 0;
	CString tmp = tooltip;
	int newline = tmp.Find('\n');
	while(newline > 0 && tmp.GetLength()>1)
	{
		if(newline>maxwidth)
			maxwidth = newline;
		tmp = tmp.Right(tmp.GetLength()-newline);
		newline = tmp.Find('\n');
	}
	if(tmp.GetLength()>maxwidth)
		maxwidth =  tmp.GetLength();
	
	::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, maxwidth*6);
	pTTTW->lpszText = const_cast<LPTSTR>((const WCHAR*)m_pwchTip);
	
	// If wanting to display a tooltip which is longer than 80 characters,
	// then one must allocate the needed text-buffer instead of using szText,
	// and point the TOOLTIPTEXT::lpszText to this text-buffer.
	// When doing this, then one is required to release this text-buffer again
	return TRUE;
}