Esempio n. 1
0
void CCompileEditView::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CRichEditView::OnMouseMove(nFlags, point);

	if ( !nFlags && IsDataTip() )
	{
		CString strTitle;
		CString strText = GetTipText(strTitle,nFlags,point);
		if(!strText.IsEmpty())
		{
			//m_pDatatip->On(TRUE);
			//ClientToScreen(&point);
			//if (::GetCursorPos(&point))
			//{
				//m_pDatatip->SetOffset(8,8);
			/*	m_pDatatip->Set(point,strTitle,strText,30,5);*/
		/*	m_pDatatip.Show(strTitle,strText);*/
			//}
		}
		else
		{
			//m_pDatatip->Hide();
		}
	}
	/*
	CWnd* pWnd = GetFocus();
	if(pWnd != NULL && pWnd != m_pDatatip)
	{
		this->SetFocus();
	}
	*/
}
Esempio n. 2
0
// DrawTipText --------------------------------------------------------------
void CCodeTipCtrl::DrawTipText( HDC hdc, RECT& rect, BOOL bCalcRect )
{
   LPCTSTR lpszTip = GetTipText();
   UINT nFormat = DT_LEFT | DT_NOPREFIX | DT_WORDBREAK;
   HFONT hfOld = (HFONT)::SelectObject( hdc, __GetFont() );

   if( bCalcRect )
      nFormat |= DT_CALCRECT;

   ::DrawText( hdc, lpszTip, lstrlen( lpszTip ), &rect, nFormat );

   if( hfOld )
      ::SelectObject( hdc, hfOld );
}
Esempio n. 3
0
// GetSelection -------------------------------------------------------------
void CCodeTipFuncHighlightCtrl::GetSelection()
{
   LPCTSTR lpszTip = GetTipText();
   int iTipLen = lstrlen( lpszTip ), iBegin = 0;

   m_iHighlightBegin = -1;
   m_iHighlightEnd = -1;

   for( int i = 0, iArg = -1; -1 == iArg && i < iTipLen; i++ )
   {
      switch( lpszTip[i] )
      {
      case L'(':
         iBegin = ++i;
      case L',':
         iArg = 0;
         break;
      }
   }

   if( 0 == iArg )
   {
      for( int i = iBegin; iArg != m_nArgument && i < iTipLen; i++ )
      {
         if( L',' == lpszTip[i] )
         {
            iArg++;
            iBegin = ++i;
         }
      }
   }

   if( iArg == m_nArgument )
   {
      for( int iEnd = iBegin; iEnd < iTipLen; iEnd++ )
      {
         if( L',' == lpszTip[iEnd] || L')' == lpszTip[iEnd] )
         {
            iEnd--;
            break;
         }
      }

      m_iHighlightBegin = iBegin;
      m_iHighlightEnd = iEnd;
   }
}
Esempio n. 4
0
// Handle the tooltip messages.  Returns true to mean message was handled.
BOOL MyGraph::OnNeedText(UINT /*uiId*/, NMHDR* pNMHDR, LRESULT* pResult)
{
	_ASSERTE(pNMHDR  &&  "Bad parameter passed");
	_ASSERTE(pResult  &&  "Bad parameter passed");

	bool bReturn(false);
	UINT_PTR uiID(pNMHDR->idFrom);

	// Notification in NT from automatically created tooltip.
	if (0U != uiID) {
		bReturn = true;

		// Need to handle both ANSI and UNICODE versions of the message.
		TOOLTIPTEXTA* pTTTA = reinterpret_cast<TOOLTIPTEXTA*> (pNMHDR);
		ASSERT_POINTER(pTTTA, TOOLTIPTEXTA);

		TOOLTIPTEXTW* pTTTW = reinterpret_cast<TOOLTIPTEXTW*> (pNMHDR);
		ASSERT_POINTER(pTTTW, TOOLTIPTEXTW);

		CString sTipText(GetTipText());

#ifndef _UNICODE
		if (TTN_NEEDTEXTA == pNMHDR->code) {
			lstrcpyn(pTTTA->szText, sTipText, _countof(pTTTA->szText));
		}
		else {
			_mbstowcsz(pTTTW->szText, sTipText, _countof(pTTTA->szText));
		}
#else
		if (pNMHDR->code == TTN_NEEDTEXTA) {
			_wcstombsz(pTTTA->szText, sTipText, _countof(pTTTA->szText));
		}
		else {
			lstrcpyn(pTTTW->szText, sTipText, _countof(pTTTA->szText));
		}
#endif

		*pResult = 0;
	}

	return bReturn;
}
Esempio n. 5
0
void CCompileEditView::ShowOnlineList(CPoint& point,int nCmdShow,CString strText /*= ""*/,
									  BOOL bEdit /*= FALSE*/,
									  int nBegin,int nEnd)
{
	COnlineList* pOnline = CreateOnlineList();
	if(pOnline == NULL) return;

	if( !bEdit )
	{
		CString strTitle;
		strText = GetTipText(strTitle,MK_RBUTTON,point,&nBegin,&nEnd);
	}

	if( pOnline->AddToOnlineList(strText,bEdit,nBegin,nEnd) )
	{
		CRect rect,rc;
		pOnline->GetWindowRect(rect);
		
		ClientToScreen(&point);
		rc.left = point.x;
		rc.top  = point.y;
		rc.right = rc.left + rect.Width();
		rc.bottom = rc.top + rect.Height();
		pOnline->MoveWindow(rc);
		
		if( !pOnline->IsWindowVisible() )
		{
			pOnline->ShowWindow(nCmdShow);
		}
	}
	else
	{
		if( pOnline->IsWindowVisible() )
		{
			pOnline->ShowWindow(SW_HIDE);
		}
	}
}