示例#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
void wxExStatusBar::Handle(wxMouseEvent& event, const wxExStatusBarPane& pane)
{
  if (event.LeftUp())
  {
    m_Frame->StatusBarClicked(pane.GetName());
  }
  else if (event.RightUp())
  {
    m_Frame->StatusBarClickedRight(pane.GetName());
  }
  // Show tooltip if tooltip is available, and not yet presented.
  else if (event.Moving())
  {
#if wxUSE_TOOLTIPS
    const wxString tooltip = GetToolTipText();
              
    if (pane.GetHelpText().empty())
    {
      if (!tooltip.empty())
      {
        UnsetToolTip();
      }
    }
    else if (tooltip != pane.GetHelpText())
    {
      SetToolTip(pane.GetHelpText());
    }
#endif    
  }
}
示例#3
0
void CPPageAdvanced::OnLvnGetInfoTipList(NMHDR* pNMHDR, LRESULT* pResult)
{
    LPNMLVGETINFOTIP pGetInfoTip = reinterpret_cast<LPNMLVGETINFOTIP>(pNMHDR);

    auto eSetting = static_cast<ADVANCED_SETTINGS>(m_list.GetItemData(pGetInfoTip->iItem));
    auto pItem = m_hiddenOptions.at(eSetting);
    StringCchCopy(pGetInfoTip->pszText, pGetInfoTip->cchTextMax, pItem->GetToolTipText());

    *pResult = 0;
}
SpinControl::SpinControl(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) :
wxPanel(parent, id, pos, size, (style & ~wxBORDER_MASK) | wxBORDER_NONE, name),
m_text(NULL),
m_spin(NULL),
m_minValue(std::numeric_limits<double>::min()),
m_maxValue(std::numeric_limits<double>::max()),
m_regularIncrement(0.0),
m_shiftIncrement(0.0),
m_ctrlIncrement(0.0),
m_value(0.0),
m_digits(0),
m_format(wxT("%g")) {
    m_text = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER | wxTE_RIGHT);
    m_spin = new wxSpinButton(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_VERTICAL);

    m_text->SetSizeHints(wxDefaultCoord, wxDefaultCoord);
    m_text->SetToolTip(GetToolTipText());

    m_spin->SetToolTip(GetToolTipText());
    m_spin->SetSizeHints(wxDefaultCoord, wxDefaultCoord);
    m_spin->SetRange(-32000, 32000);
    
    DoSetValue(m_value);
    
    wxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
    sizer->Add(m_text, 1, wxEXPAND);
    sizer->Add(m_spin);
    SetSizerAndFit(sizer);
    
    SetInitialSize(size);
    Move(pos);
    
    m_text->Bind(wxEVT_COMMAND_TEXT_ENTER, &SpinControl::OnTextEnter, this);
    m_text->Bind(wxEVT_KILL_FOCUS, &SpinControl::OnTextKillFocus, this);
    m_spin->Bind(wxEVT_SPIN_UP, &SpinControl::OnSpinButtonUp, this);
    m_spin->Bind(wxEVT_SPIN_DOWN, &SpinControl::OnSpinButtonDown, this);
    
    Bind(wxEVT_SET_FOCUS, &SpinControl::OnSetFocus, this);
}
void CommandContributionItem::UpdateToolItem()
{
  QString text = label;
  QString tooltip = label;
  if (text.isNull())
  {
    if (command.IsNotNull())
    {
      try
      {
        text = command->GetCommand()->GetName();
        tooltip = command->GetCommand()->GetDescription();
        if (tooltip.trimmed().isEmpty())
        {
          tooltip = text;
        }
      }
      catch (const NotDefinedException& e)
      {
//        StatusManager.getManager().handle(
//              StatusUtil.newStatus(IStatus.ERROR,
//                                   "Update item failed "
//                                   + getId(), e));
        BERRY_ERROR << "Update item failed " << GetId() << e.what();
      }
    }
  }

  if ((icon.isNull() || (mode & MODE_FORCE_TEXT) == MODE_FORCE_TEXT)
      && !text.isNull())
  {
    action->setText(text);
  }

  QString toolTipText = GetToolTipText(tooltip);
  action->setToolTip(toolTipText);

  if (action->isChecked() != checkedState)
  {
    action->setChecked(checkedState);
  }

  // allow the handler update its enablement
  bool shouldBeEnabled = IsEnabled();
  if (action->isEnabled() != shouldBeEnabled)
  {
    action->setEnabled(shouldBeEnabled);
  }
}
示例#6
0
//
// Handle mouse enter events
//
void Grabber::OnEnter(wxMouseEvent & WXUNUSED(event))
{
   // Bug 1201:  On Mac, unsetting and re-setting the tooltip may be needed
   // to make it pop up when we want it.
   const auto text = GetToolTipText();
   UnsetToolTip();
   SetToolTip(text);

   if( mAsSpacer )
      return;

   // Redraw highlighted
   mOver = true;
   Refresh(false);
}
示例#7
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;
}
示例#8
0
bool EditorHistoryItem::Matches(const SmartPointer<IEditorInput>& input) const
{
  if (IsRestored())
  {
    return input == GetInput();
  }
  // if not restored, compare name, tool tip text and factory id,
  // avoiding as much work as possible
  if (GetName() != input->GetName())
  {
    return false;
  }
  if (GetToolTipText() != input->GetToolTipText())
  {
    return false;
  }

  const IPersistableElement* persistable = input->GetPersistable();
  QString inputId = persistable ? QString::null : persistable->GetFactoryId();
  QString myId = GetFactoryId();
  return myId.isEmpty() ? inputId.isEmpty() : myId == inputId;
}
示例#9
0
void AButton::OnMouseEvent(wxMouseEvent & event)
{
   wxSize clientSize = GetClientSize();
   AButtonState prevState = GetState();

   if (event.Entering()) {
      // Bug 1201:  On Mac, unsetting and re-setting the tooltip may be needed
      // to make it pop up when we want it.
      auto text = GetToolTipText();
      UnsetToolTip();
      SetToolTip(text);
      mCursorIsInWindow = true;
   }
   else if (event.Leaving())
      mCursorIsInWindow = false;
   else
      mCursorIsInWindow =
         (event.m_x >= 0 && event.m_y >= 0 &&
          event.m_x < clientSize.x && event.m_y < clientSize.y);

   if (mEnabled && event.IsButton()) {
      if (event.ButtonIsDown(wxMOUSE_BTN_ANY)) {
         mIsClicking = true;
         if (event.ButtonDClick())
            mIsDoubleClicked = true;
         if( !HasCapture() )
            CaptureMouse();
      }
      else if (mIsClicking) {
         mIsClicking = false;

         if (HasCapture())
            ReleaseMouse();

         if (mCursorIsInWindow && (mToggle || !mButtonIsDown)) {
            if (mToggle)
               mButtonIsDown = !mButtonIsDown;
            else
               mButtonIsDown = true;

            mWasShiftDown = event.ShiftDown();
            mWasControlDown = event.ControlDown();

            Click();
         }
      }
   }

   // Only redraw and change tooltips if the state has changed.
   AButtonState newState = GetState();

   if (newState != prevState) {
      Refresh(false);

      if (mCursorIsInWindow)
         UpdateStatus();
      else {
         GetActiveProject()->TP_DisplayStatusMessage(wxT(""));
      }
   }
   else
      event.Skip();
}
示例#10
0
long FAR PASCAL 
WinWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HICON hIcon;
	FARPROC lpDlg = (FARPROC)NULL;
	LPNMHDR pnmh;

	pnmh = (LPNMHDR) lParam; 

	switch (message) {
	case WM_CREATE:
		hInstance = ( ( LPCREATESTRUCT )lParam )->hInstance;
		InitCommonControls();
        CreateToolbar(hWnd);
		CreateStatusBar(hWnd);
		break;
	case WM_MENUSELECT:
		GetMenuSelect (hWndStatus, message, wParam, lParam);
		break;
	case WM_NOTIFY:
		switch (pnmh->code)
		{
			case TTN_NEEDTEXT:
				GetToolTipText((LPTOOLTIPTEXT)lParam);
				break;
			default:
				return (DefWindowProc(hWnd, message, 
					wParam, lParam));
		}	
		break;
	case WM_COMMAND:
        	switch (wParam) {
        	case IDM_ABOUT:
               		hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
	       		    ShellAbout(hWnd, Program, Title, hIcon);
               		DestroyIcon(hIcon);
               		break;
	    	case IDM_UPDOWN:
               		if ( DialogBox ( hInstance, MAKEINTRESOURCE 
					( IDD_UPDOWNTEST ), hWnd,
                     			(DLGPROC)UpDownProc ) == -1 )
                       		MessageBox ( hWnd, "Dialog Failed", "Error", 
						MB_OK);
	       	    	break;
			case IDM_PROPSHEET:
					CreatePropSheet(hWnd);
					break;
			case IDM_EXIT:
	       		DestroyWindow(hWnd);
	       		break;
          	 }
	break;
	case WM_SIZE:
       		SendMessage(hWndToolbar, message, wParam, lParam);
     		SendMessage(hWndStatus, message, wParam, lParam);
       		switch (wParam) {
       		case SIZEICONIC:
	    		MessageBeep(0);
           	}
           	break;
    	    case WM_DESTROY:
       		    PostQuitMessage(0);
        	    break;
	default:
        	return (DefWindowProc(hWnd, message, wParam, lParam));
	}
	return (0);
}
示例#11
0
bool CQListCtrl::ShowFullDescription(bool bFromAuto, bool fromNextPrev)
{
	if (this->GetSelectedCount() == 0)
	{
		return false;
	}	

	int clipId = this->GetItemData(this->GetCaret());

	if(VALID_TOOLTIP && 
		m_pToolTip->GetClipId() == clipId &&
		::IsWindow(m_toolTipHwnd))
	{
		return false;
	}

	int nItem = GetCaret();
	CRect rc, crWindow;
	GetWindowRect(&crWindow);
	GetItemRect(nItem, rc, LVIR_BOUNDS);
	ClientToScreen(rc);

	CPoint pt;
	
	if(CGetSetOptions::GetRememberDescPos())
	{
		CGetSetOptions::GetDescWndPoint(pt);
	}
	else if(bFromAuto == false)
	{
		pt = CPoint(rc.left, rc.bottom);
	}
	else
	{
		pt = CPoint((crWindow.left + (crWindow.right - crWindow.left)/2), rc.bottom);
	}

	CString csDescription;
	GetToolTipText(nItem, csDescription);
		
	if (m_pToolTip == NULL ||
		fromNextPrev == false ||
		::IsWindow(m_toolTipHwnd) == FALSE)
	{
		m_pToolTip->DestroyWindow();

		m_pToolTip = new CToolTipEx;
		m_pToolTip->Create(this);
		m_toolTipHwnd = m_pToolTip->GetSafeHwnd();
		m_pToolTip->SetNotifyWnd(GetParent());
	}
	else if(VALID_TOOLTIP)
	{
		CRect r;
		m_pToolTip->GetWindowRect(r);
		pt = r.TopLeft();

		m_pToolTip->SetBitmap(NULL);
		m_pToolTip->SetRTFText("");
		m_pToolTip->SetToolTipText(_T(""));
		
	}
	
	if(VALID_TOOLTIP)
	{
		m_pToolTip->SetClipId(clipId);
		m_pToolTip->SetSearchText(m_searchText);

		m_pToolTip->SetToolTipText(_T(""));  
		m_pToolTip->SetRTFText("    ");
		bool bSetPlainText = false;
		CClipFormat Clip;
		
		Clip.m_cfType = CF_UNICODETEXT;
		if(GetClipData(nItem, Clip) && Clip.m_hgData)
		{
			LPVOID pvData = GlobalLock(Clip.m_hgData);
			if(pvData)
			{
				CString csText = (WCHAR*)pvData;
				m_pToolTip->SetToolTipText(csText);
				bSetPlainText = true;
			}

			GlobalUnlock(Clip.m_hgData);

			Clip.Free();
			Clip.Clear();
		}

		if(bSetPlainText == false)
		{
			Clip.m_cfType = CF_TEXT;
			if(GetClipData(nItem, Clip) && Clip.m_hgData)
			{
				LPVOID pvData = GlobalLock(Clip.m_hgData);
				if(pvData)
				{
					CString csText = (char*)pvData;
					m_pToolTip->SetToolTipText(csText);

					bSetPlainText = true;
				}

				GlobalUnlock(Clip.m_hgData);

				Clip.Free();
				Clip.Clear();
			}
		}

		if(bSetPlainText == false)
		{
			m_pToolTip->SetToolTipText(csDescription);
		}

		Clip.m_cfType = RegisterClipboardFormat(CF_RTF);

		if(GetClipData(nItem, Clip) && Clip.m_hgData)
		{
			LPVOID pvData = GlobalLock(Clip.m_hgData);
			if(pvData)
			{
				m_pToolTip->SetRTFText((char*)pvData);
			}

			GlobalUnlock(Clip.m_hgData);

			Clip.Free();
			Clip.Clear();
		}	
			
		Clip.m_cfType = CF_DIB;
				
		if(GetClipData(nItem, Clip) && Clip.m_hgData)
		{			
			CBitmap *pBitMap = new CBitmap;
			if(pBitMap)
			{
				CRect rcItem;
				GetWindowRect(rcItem);
				
				CDC *pDC = GetDC();;

				CBitmapHelper::GetCBitmap(&Clip, pDC, pBitMap, MAXINT);

				ReleaseDC(pDC);

				//Tooltip wnd will release
				m_pToolTip->SetBitmap(pBitMap);
			}

			Clip.Free();
			Clip.Clear();
		}			
		
		m_pToolTip->Show(pt);
	}

	return true;
}
示例#12
0
BOOL CQListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
{
	// need to handle both ANSI and UNICODE versions of the message
	TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
	TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
	CString strTipText;
	
	UINT_PTR nID = pNMHDR->idFrom;
	
	if(nID == 0)	  	// Notification in NT from automatically
		return FALSE;   	// created tooltip
	
	::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 500);
	
	// Use Item's name as the tool tip. Change this for something different.
	// Like use its file size, etc.
	GetToolTipText((int)nID-1, strTipText);
	
	//Replace the tabs with spaces, the tooltip didn't like the \t s
	strTipText.Replace(_T("\t"), _T("  "));
	
	int nLength = strTipText.GetLength()+2;

#ifndef _UNICODE
	if (pNMHDR->code == TTN_NEEDTEXTA)
	{
		if(m_pchTip != NULL)
			delete m_pchTip;
		
		m_pchTip = new TCHAR[nLength];
		lstrcpyn(m_pchTip, strTipText, nLength-1);
		m_pchTip[nLength-1] = 0;
		pTTTW->lpszText = (WCHAR*)m_pchTip;
	}
	else
	{
		if(m_pwchTip != NULL)
			delete m_pwchTip;
		
		m_pwchTip = new WCHAR[nLength];
		_mbstowcsz(m_pwchTip, strTipText, nLength-1);
		m_pwchTip[nLength-1] = 0; // end of text
		pTTTW->lpszText = (WCHAR*)m_pwchTip;
	}
#else
	if(pNMHDR->code == TTN_NEEDTEXTA)
	{
		if(m_pchTip != NULL)
			delete m_pchTip;
		
		m_pchTip = new TCHAR[nLength];
		STRNCPY(m_pchTip, strTipText, nLength-1);
		m_pchTip[nLength-1] = 0; // end of text
		pTTTW->lpszText = (LPTSTR)m_pchTip;
	}
	else
	{
		if(m_pwchTip != NULL)
			delete m_pwchTip;
		
		m_pwchTip = new WCHAR[nLength];
		lstrcpyn(m_pwchTip, strTipText, nLength-1);
		m_pwchTip[nLength-1] = 0;
		pTTTW->lpszText = (LPTSTR) m_pwchTip;
	}
#endif
	*pResult = 0;
	
	return TRUE;    // message was handled
}
示例#13
0
void CQListCtrl::ShowFullDescription(bool bFromAuto)
{
	int nItem = GetCaret();
	CRect rc, crWindow;
	GetWindowRect(&crWindow);
	GetItemRect(nItem, rc, LVIR_BOUNDS);
	ClientToScreen(rc);

	CPoint pt;
	
	if(bFromAuto == false)
	{
		pt = CPoint(rc.left, rc.bottom);
	}
	else
		pt = CPoint((crWindow.left + (crWindow.right - crWindow.left)/2), rc.bottom);

	CString csDescription;
	GetToolTipText(nItem, csDescription);

	m_pToolTip->DestroyWindow();

	m_pToolTip = new CToolTipEx;
	m_pToolTip->Create(this);
	m_pToolTip->SetNotifyWnd(GetParent());
	
	if(m_pToolTip)
	{
		m_pToolTip->SetToolTipText(_T(""));  
		m_pToolTip->SetRTFText("    ");
		bool bSetPlainText = false;
		CClipFormat Clip;
		
		Clip.m_cfType = CF_UNICODETEXT;
		if(GetClipData(nItem, Clip) && Clip.m_hgData)
		{
			LPVOID pvData = GlobalLock(Clip.m_hgData);
			if(pvData)
			{
				CString csText = (WCHAR*)pvData;
				m_pToolTip->SetToolTipText(csText);
				bSetPlainText = true;
			}

			GlobalUnlock(Clip.m_hgData);

			Clip.Free();
			Clip.Clear();
		}

		if(bSetPlainText == false)
		{
			Clip.m_cfType = CF_TEXT;
			if(GetClipData(nItem, Clip) && Clip.m_hgData)
			{
				LPVOID pvData = GlobalLock(Clip.m_hgData);
				if(pvData)
				{
					CString csText = (char*)pvData;
					m_pToolTip->SetToolTipText(csText);

					bSetPlainText = true;
				}

				GlobalUnlock(Clip.m_hgData);

				Clip.Free();
				Clip.Clear();
			}
		}

		if(bSetPlainText == false)
		{
			m_pToolTip->SetToolTipText(csDescription);
		}

		Clip.m_cfType = RegisterClipboardFormat(CF_RTF);

		if(GetClipData(nItem, Clip) && Clip.m_hgData)
		{
			LPVOID pvData = GlobalLock(Clip.m_hgData);
			if(pvData)
			{
				m_pToolTip->SetRTFText((char*)pvData);
			}

			GlobalUnlock(Clip.m_hgData);

			Clip.Free();
			Clip.Clear();
		}	
			
		Clip.m_cfType = CF_DIB;
				
		if(GetClipData(nItem, Clip) && Clip.m_hgData)
		{			
			CBitmap *pBitMap = new CBitmap;
			if(pBitMap)
			{
				CRect rcItem;
				GetWindowRect(rcItem);
				
				CDC *pDC = GetDC();;

				CBitmapHelper::GetCBitmap(&Clip, pDC, pBitMap, (rcItem.Width() * 2));

				ReleaseDC(pDC);

				//Tooltip wnd will release
				m_pToolTip->SetBitmap(pBitMap);
			}

			Clip.Free();
			Clip.Clear();
		}
			
		
		m_pToolTip->Show(pt);
	}
}