Exemplo n.º 1
0
//-----------------------------------------------------------------------------
afx_msg void CMRCSizeToolBar::OnTBNToolTip(UINT uID, NMHDR *pNMHDR, LRESULT * pResult)
// tool tip notification handler for tool bar
//-----------------------------------------------------------------------------
{
	TOOLTIPTEXT * pTip = (TOOLTIPTEXT *) pNMHDR;
	pTip->hinst = NULL;
	pTip->lpszText = NULL;
	UINT ButtonId = pTip->hdr.idFrom;	
	
	CString strText;
	if (strText.LoadString(ButtonId))
	{
		char * pTipText = strchr(strText, '\n');   // tool tip is after "\n" in the string
		if (pTipText != NULL)
		{	
			strcpy(pTip->szText, pTipText + 1);
			pTip->lpszText = pTip->szText;
		
			// try to ensure tool tip control and ensure it is top most in the Z-order
			CToolTipCtrl * pToolTipCtrl = m_ToolCtrl.GetToolTips();
			pToolTipCtrl->SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
	
		}	
		// Set the text in the main window. Doesn't appear to be an easy way to check if
		// we're not over any particular bit of the tool tip.
		AfxGetMainWnd()->SendMessage(WM_SETMESSAGESTRING, ButtonId);
		return; 
	}	
	
	TRACE("CMRCSizeToolBar:No Tooltip prompt for ID=%d\n", ButtonId);
	return;	
}
// tool tip notification handler for tool bar
afx_msg void COXSizeToolBar::OnTBNToolTip(UINT /* uID */, NMHDR* pNMHDR, LRESULT* /* pResult */)
{
	TOOLTIPTEXT* pTip = (TOOLTIPTEXT*)pNMHDR;
	pTip->hinst = NULL;
	pTip->lpszText = NULL;
	UINT ButtonId = PtrToUint(pTip->hdr.idFrom);	

	CString strText;
	if (strText.LoadString(ButtonId))
	{
		LPCTSTR pTipText = _tcschr(strText, _T('\n'));   // tool tip is after "\n" in the string
		if (pTipText != NULL)
		{	
			UTBStr::tcscpy(pTip->szText, 80, pTipText + 1);
			pTip->lpszText = pTip->szText;

			// try to ensure tool tip control and ensure it is top most in the Z-order
			CToolTipCtrl* pToolTipCtrl = m_ToolCtrl.GetToolTips();
			pToolTipCtrl->SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);

		}	
		// Set the text in the main window. Doesn't appear to be an easy way to check if
		// we're not over any particular bit of the tool tip.
		AfxGetMainWnd()->SendMessage(WM_SETMESSAGESTRING, ButtonId);
		return; 
	}	

	TRACE1("COXSizeToolBar:No Tooltip prompt for ID=%d\n", ButtonId);
	return;	
}
Exemplo n.º 3
0
// @pymethod |PyCToolTipCtrl|CreateWindow|Creates the actual control.
static PyObject *
PyCToolTipCtrl_create_window(PyObject *self, PyObject *args)
{
	int style;
	PyObject *obParent;
	if (!PyArg_ParseTuple(args, "Oi:CreateWindow", 
			   &obParent, // @pyparm <o PyCWnd>|parent||The parent window of the control.
			   &style)) // @pyparm int|style||The style for the control.
		return NULL;

	if (!ui_base_class::is_uiobject(obParent, &PyCWnd::type))
		RETURN_TYPE_ERR("parent argument must be a window object");
	CWnd *pParent = GetWndPtr( obParent );
	if (pParent==NULL)
		return NULL;
	CToolTipCtrl *pTTC = GetToolTipCtrl(self);
	if (!pTTC)
		return NULL;

	BOOL ok;
	GUI_BGN_SAVE;
	ok = pTTC->Create(pParent,style);
	GUI_END_SAVE;
	if (!ok)
		RETURN_ERR("CToolTipCtrl::Create");
	RETURN_NONE;
}
Exemplo n.º 4
0
// @pymethod |PyCToolTipCtrl|UpdateTipText|Update the tool tip text for a control's tools
static PyObject *
PyCToolTipCtrl_update_tip_text(PyObject *self, PyObject *args)
	{
	PyObject *obWnd;
	TCHAR *pszText;
	PyObject *obText;
	UINT nIDTool;
	if (!PyArg_ParseTuple(args, "OOi:UpdateTipText", 
			   &obText,// @pyparm string|text||The text for the tool.
			   &obWnd, // @pyparm <o PyCWnd>|wnd||The window of the tool.
			   &nIDTool// @pyparm int|id||The id of the tool
			   )) 
		return NULL;

	CWnd *pWndToolOwner = NULL;
	if (obWnd != Py_None) 
		{
		if (!ui_base_class::is_uiobject(obWnd,&PyCWnd::type))
			RETURN_TYPE_ERR("wnd argument must be a window object");
		pWndToolOwner = GetWndPtr(obWnd);
		if (pWndToolOwner==NULL)
			RETURN_TYPE_ERR("The window is not a valid PyCWnd");
		}

	CToolTipCtrl *pTTC = GetToolTipCtrl(self);
	if (!pTTC)return NULL;
	if (!PyWinObject_AsTCHAR(obText, &pszText, FALSE))
		return NULL;
	GUI_BGN_SAVE;
	pTTC->UpdateTipText(pszText,pWndToolOwner,nIDTool);
	GUI_END_SAVE;
	PyWinObject_FreeTCHAR(pszText);
	RETURN_NONE;
	}
Exemplo n.º 5
0
static BOOL CreateToolTip(HWND nWndTool, CToolTipCtrl& ctlToolTipCtrl, int nIDS)
{
	ATLASSERT(ctlToolTipCtrl.m_hWnd == NULL);

	ctlToolTipCtrl.Create(::GetParent(nWndTool));

	CToolInfo ti(TTF_SUBCLASS, nWndTool, 0, NULL, MAKEINTRESOURCE(nIDS));
	
	return ctlToolTipCtrl.AddTool(ti);
}
Exemplo n.º 6
0
BOOL CListCtrlA::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult ){
	TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
	TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;

	CString i,j,k,l,m;
	UINT nID = pNMHDR->idFrom;
	AFX_MODULE_THREAD_STATE* pThreadState = AfxGetModuleThreadState();
	CToolTipCtrl *pToolTip = pThreadState->m_pToolTip;
	if(pToolTip==NULL) return FALSE;
	pToolTip->SetMaxTipWidth(500);
	if( nID == 0 )	  	// Notification in NT from automatically
		return FALSE;   	// created tooltip

	int row = ((nID-1) >> 10) & 0x3fffff ;
	int col = (nID-1) & 0x3ff;
	i = GetItemText( row, 0 );
	j = GetItemText( row, 3 );
	k = GetItemText( row, 4 );
	l = GetItemText( row, 2 );
	m = GetItemText( row, 1 );
	strTipText.Format(_T("名前:%s\nアーティスト:%s\nアルバム:%s\n時間:%s\n種類:%s"),i,j,k,l,m);

//#ifndef _UNICODE
//	if (pNMHDR->code == TTN_NEEDTEXTA)
//		lstrcpyn(pTTTA->szText, strTipText, 579);
//	else
//		_mbstowcsz(pTTTW->szText, strTipText, 579);
//#else
//	if (pNMHDR->code == TTN_NEEDTEXTA)
//		_wcstombsz(pTTTA->szText, strTipText, 579);
//	else
//		lstrcpyn(pTTTW->szText, strTipText, 579);
//#endif
#ifndef _UNICODE
	if (pNMHDR->code == TTN_NEEDTEXTA){
		lstrcpyn(ff1,strTipText,1024);
		pTTTA->lpszText= ff1;
		pTTTA->szText[0]=NULL;
	}
	else{
		int rr=MultiByteToWideChar(CP_ACP,0,strTipText,-1,ff2,1024);
		pTTTW->lpszText= ff2;
		pTTTW->szText[0]=NULL;
	}
#else
	if (pNMHDR->code == TTN_NEEDTEXTA)
		pTTTA->lpszText = (LPSTR)(LPWSTR)(LPCWSTR)strTipText;
	else
	    pTTTW->lpszText = (LPWSTR)(LPCWSTR)strTipText;
#endif
	*pResult = 0;

	return TRUE;    // message was handled
}
Exemplo n.º 7
0
// @pymethod |PyCToolTipCtrl|AddTool|Adds a tool to tooltip control.
static PyObject *
PyCToolTipCtrl_add_tool(PyObject *self, PyObject *args)
	{
	PyObject *obWnd,*obRect;
	TCHAR *pszText;
	PyObject *obText;
	UINT nIDTool;
	if (!PyArg_ParseTuple(args, "OOOi:CreateWindow", 
			   &obWnd, // @pyparm <o PyCWnd>|wnd||The window of the tool.
			   &obText,// @pyparm string|text||The text for the tool.
			   &obRect, // @pyparm int, int, int, int|rect|None|The default rectangle
			   &nIDTool// @pyparm int|id||The id of the tool
			   )) 
		return NULL;

	CWnd *pWnd = NULL;
	if (obWnd != Py_None) 
		{
		if (!ui_base_class::is_uiobject(obWnd,&PyCWnd::type))
			RETURN_TYPE_ERR("wnd argument must be a window object");
		pWnd = GetWndPtr(obWnd);
		if (pWnd==NULL)
			RETURN_TYPE_ERR("The window is not a valid PyCWnd");
		}

	RECT rect;
	RECT *pRectTool=NULL;
	if (obRect != Py_None) 
		{
		if (!PyArg_ParseTuple(obRect, "iiii", &rect.left,  &rect.top,  &rect.right,&rect.bottom)) 
			{
			PyErr_Clear();
			RETURN_TYPE_ERR("Rect must be None or a tuple of (iiii)");
			}
		pRectTool=&rect;
		}


	CToolTipCtrl *pTTC = GetToolTipCtrl(self);
	if (!pTTC)return NULL;
	if (!PyWinObject_AsTCHAR(obText, &pszText, FALSE))
		return NULL;
	GUI_BGN_SAVE;
	BOOL ok=pTTC->AddTool(pWnd,pszText,pRectTool,nIDTool);
	GUI_END_SAVE;
	PyWinObject_FreeTCHAR(pszText);
	if (!ok)
		RETURN_ERR("CToolTipCtrl::AddTool");
	RETURN_NONE;
	}
CToolTipCtrl&  gGetToolTipCtrl() {
    AFX_MODULE_THREAD_STATE* pModuleThreadState = AfxGetModuleThreadState();
    CToolTipCtrl* ctrl = pModuleThreadState->m_pToolTip;

    if (!ctrl) {
        pModuleThreadState->m_pToolTip = ctrl = CToolTipCtrlEx::Create();
        ctrl->Create(AfxGetMainWnd(), TTS_ALWAYSTIP | WS_VISIBLE | WS_POPUP);
        ctrl->ModifyStyleEx(0, WS_EX_TOPMOST);
        ctrl->SetDelayTime(-1);
        ctrl->Activate(TRUE);
    }

    return *ctrl;
}
Exemplo n.º 9
0
void CUploadListCtrl::Init()
{
    SetPrefsKey(_T("UploadListCtrl"));
    SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP);

    // ==> Run eMule as NT Service [leuk_he/Stulle] - Stulle
    // workaround running MFC as service
    if (!theApp.IsRunningAsService())
    {
        // <== Run eMule as NT Service [leuk_he/Stulle] - Stulle
        CToolTipCtrl* tooltip = GetToolTips();
        if (tooltip) {
            m_tooltip->SubclassWindow(tooltip->m_hWnd);
            tooltip->ModifyStyle(0, TTS_NOPREFIX);
            tooltip->SetDelayTime(TTDT_AUTOPOP, 20000);
            tooltip->SetDelayTime(TTDT_INITIAL, thePrefs.GetToolTipDelay()*1000);
        }
    } // Run eMule as NT Service [leuk_he/Stulle] - Stulle

    InsertColumn(0, GetResString(IDS_QL_USERNAME),	LVCFMT_LEFT,  DFLT_CLIENTNAME_COL_WIDTH);
    InsertColumn(1, GetResString(IDS_FILE),			LVCFMT_LEFT,  DFLT_FILENAME_COL_WIDTH);
    InsertColumn(2, GetResString(IDS_DL_SPEED),		LVCFMT_RIGHT, DFLT_DATARATE_COL_WIDTH);
    InsertColumn(3, GetResString(IDS_DL_TRANSF),	LVCFMT_RIGHT, DFLT_DATARATE_COL_WIDTH);
    InsertColumn(4, GetResString(IDS_WAITED),		LVCFMT_LEFT,   60);
    InsertColumn(5, GetResString(IDS_UPLOADTIME),	LVCFMT_LEFT,   80);
    InsertColumn(6, GetResString(IDS_STATUS),		LVCFMT_LEFT,  100);
    InsertColumn(7, GetResString(IDS_UPSTATUS),		LVCFMT_LEFT,  DFLT_PARTSTATUS_COL_WIDTH);
    InsertColumn(8,	GetResString(IDS_CD_CSOFT),		LVCFMT_LEFT, 90); //Xman version see clientversion in every window
    InsertColumn(9, GetResString(IDS_UPDOWNUPLOADLIST),	LVCFMT_LEFT, 90); //Xman show complete up/down in uploadlist
    // ==> Uploading Chunk Detail Display [SiRoB/Fafner] - Stulle
    InsertColumn(10,GetResString(IDS_CHUNK),LVCFMT_LEFT,100);
    // <== Uploading Chunk Detail Display [SiRoB/Fafner] - Stulle


    SetAllIcons();
    Localize();
    LoadSettings();

    //Xman client percentage
    CFont* pFont = GetFont();
    LOGFONT lfFont = {0};
    pFont->GetLogFont(&lfFont);
    lfFont.lfHeight = 11;
    m_fontBoldSmaller.CreateFontIndirect(&lfFont);
    //Xman end

    SetSortArrow();
    SortItems(SortProc, GetSortItem() + (GetSortAscending() ? 0 : 100));
}
Exemplo n.º 10
0
// @pymethod int|PyCToolTipCtrl|SetMaxTipWidth|
static PyObject *
PyCToolTipCtrl_set_max_tip_width(PyObject *self, PyObject *args)
	{
	int width;
	if (!PyArg_ParseTuple(args, "i:SetMaxTipWidth", 
			   &width)) // @pyparm int|width||The new width
		return NULL;

	CToolTipCtrl *pTTC = GetToolTipCtrl(self);
	if (!pTTC)return NULL;

	GUI_BGN_SAVE;
	int rc = pTTC->SetMaxTipWidth(width);
	GUI_END_SAVE;
	return PyInt_FromLong(rc);
}
Exemplo n.º 11
0
LRESULT CRunDlg::OnTTGetDisp(CToolTipCtrl& tip_ctrl, LPNMHDR pnmh, BOOL &)
{
	static wchar_t buf[512];
	LPNMTTDISPINFO pDispInfo = (LPNMTTDISPINFO)pnmh;
	POINT pt;
	GetCursorPos(&pt);
	ScreenToClient(&pt);
	prog_pos pp = m_lyt->get_prog_from_point(pt);
	if (pp != pp_null)
	{
		const prog * p = g_c->get_prog(pp.g, pp.p);
		std::wstring abspath = hlp::abs_path(p->path.c_str());
		hlp::path_elem pe = hlp::split_path(abspath.c_str());
		std::wstring name = abspath.substr(pe.name.s, pe.name.n)
		                  + L" -- "
						  + g_c->get_group_info(pp.g)->name;
		if (g_c->gm.use_simple_tip)
		{
			tip_ctrl.SetTitle(TTI_NONE, hc::empty_str);
		}
		else
		{
			tip_ctrl.SetTitle(TTI_INFO, name.c_str());
		}

		buf[0] = L'\0';
		size_t bl = sizeof(buf)/sizeof(buf[0]);
		size_t pos = 0;
		pos = hlp::strcat_ex(buf, bl, pos, p->path.c_str());
		if (!p->param.empty())
		{
			pos = hlp::strcat_ex(buf, bl, pos, L" ");
			pos = hlp::strcat_ex(buf, bl, pos, p->param.c_str());
		}
		if (!p->comment.empty())
		{
			pos = hlp::strcat_ex(buf, bl, pos, L"\r\n");
			pos = hlp::strcat_ex(buf, bl, pos, p->comment.c_str());
		}
		
		pDispInfo->lpszText = buf;
	}
	return TRUE;
}
Exemplo n.º 12
0
BOOL CWnd::_EnableToolTips(BOOL bEnable, UINT nFlag)
{
    ASSERT(nFlag == WF_TOOLTIPS || nFlag == WF_TRACKINGTOOLTIPS);

    AFX_MODULE_THREAD_STATE* pModuleThreadState = AfxGetModuleThreadState();
    CToolTipCtrl* pToolTip = pModuleThreadState->m_pToolTip;

    if (!bEnable)
    {
        // nothing to do if tooltips not enabled
        if (!(m_nFlags & nFlag))
            return TRUE;

        // cancel tooltip if this window is active
        if (pModuleThreadState->m_pLastHit == this)
            CancelToolTips(TRUE);

        // remove "dead-area" toolbar
        if (pToolTip->GetSafeHwnd() != NULL)
        {
            TOOLINFO ti;
            memset(&ti, 0, sizeof(TOOLINFO));
            ti.cbSize = sizeof(AFX_OLDTOOLINFO);
            ti.uFlags = TTF_IDISHWND;
            ti.hwnd = m_hWnd;
            ti.uId = (UINT_PTR)m_hWnd;
            pToolTip->SendMessage(TTM_DELTOOL, 0, (LPARAM)&ti);
        }

        // success
        m_nFlags &= ~nFlag;
        return TRUE;
    }

    // if already enabled for tooltips, nothing to do
    if (!(m_nFlags & nFlag))
    {
        // success
        AFX_MODULE_STATE* pModuleState = _AFX_CMDTARGET_GETSTATE();
        pModuleState->m_pfnFilterToolTipMessage = &CWnd::_FilterToolTipMessage;
        m_nFlags |= nFlag;
    }
    return TRUE;
}
Exemplo n.º 13
0
bool CServerListCtrl::Init()
{
	SetName(_T("ServerListCtrl"));
	ModifyStyle(0,LVS_SINGLESEL|LVS_REPORT);
	ModifyStyle(LVS_SINGLESEL|LVS_LIST|LVS_ICON|LVS_SMALLICON,LVS_REPORT); //here the CListCtrl is set to report-style
	SetExtendedStyle(GetExtendedStyle() | LVS_EX_INFOTIP);

	CToolTipCtrl* tooltip = GetToolTips();
	if (tooltip) {
		m_tooltip->SubclassWindow(*tooltip);
		tooltip->ModifyStyle(0, TTS_NOPREFIX);
		tooltip->SetDelayTime(TTDT_AUTOPOP, 20000);
		tooltip->SetDelayTime(TTDT_INITIAL, thePrefs.GetToolTipDelay()*1000);
	}

	InsertColumn(0, GetResString(IDS_SL_SERVERNAME),LVCFMT_LEFT, 150);
	InsertColumn(1, GetResString(IDS_IP),			LVCFMT_LEFT, 140);
	InsertColumn(2, GetResString(IDS_DESCRIPTION),	LVCFMT_LEFT, 150);
	InsertColumn(3, GetResString(IDS_PING),			LVCFMT_RIGHT, 50);
	InsertColumn(4, GetResString(IDS_UUSERS),		LVCFMT_RIGHT, 50);
	InsertColumn(5, GetResString(IDS_MAXCLIENT),	LVCFMT_RIGHT, 50);
	InsertColumn(6, GetResString(IDS_PW_FILES) ,	LVCFMT_RIGHT, 50);
	InsertColumn(7, GetResString(IDS_PREFERENCE),	LVCFMT_LEFT,  60);
	InsertColumn(8, GetResString(IDS_UFAILED),		LVCFMT_RIGHT, 50);
	InsertColumn(9, GetResString(IDS_STATICSERVER),	LVCFMT_LEFT,  50);
	InsertColumn(10,GetResString(IDS_SOFTFILES),	LVCFMT_RIGHT, 50);
	InsertColumn(11,GetResString(IDS_HARDFILES),	LVCFMT_RIGHT, 50);
	InsertColumn(12,GetResString(IDS_VERSION),		LVCFMT_LEFT,  50);
	InsertColumn(13,GetResString(IDS_IDLOW),		LVCFMT_RIGHT, 50);
	InsertColumn(14,GetResString(IDS_OBFUSCATION)  ,LVCFMT_RIGHT, 50);

	SetAllIcons();
	Localize();
	LoadSettings();

	// Barry - Use preferred sort order from preferences
	SetSortArrow();
	SortItems(SortProc, MAKELONG(GetSortItem(), (GetSortAscending()? 0 : 0x0001)));

	ShowServerCount();

	return true;
} 
Exemplo n.º 14
0
BOOL CAlphaBlendDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: この位置に初期化の補足処理を追加してください
	m_cSldAlphaBlend.SetRange( 26, 255, TRUE);
	CToolTipCtrl* pcToolTip = m_cSldAlphaBlend.GetToolTips();
	if( pcToolTip)
	{
		pcToolTip->AddTool( this, LPSTR_TEXTCALLBACK);
	}

	CString cStr;
	cStr.Format( IDS_ALPHABLENDCAPTION, 100 - ( ( ( m_nAlphaBlend) * 100) / 255));
	SetWindowText( cStr);

	m_cSldAlphaBlend.SetPos( m_nAlphaBlend);
	
	return TRUE;  // コントロールにフォーカスを設定しないとき、戻り値は TRUE となります
	              // 例外: OCX プロパティ ページの戻り値は FALSE となります
}
Exemplo n.º 15
0
UINT CTabClassView::OnNcHitTest(CPoint point) 
{
	UINT uFlag=0;

	// Get the cursor location in client coordinates.
	CPoint pt = point;	
	ScreenToClient(&pt);

	// Get a pointer to the tooltip control.
	CToolTipCtrl* pCtrl = m_pTreeCtrl->GetToolTips();

	// If we have a valid tooltip pointer and the cursor
	// is over a tree item, the bring the tooltip control
	// to the top of the Z-order.
	if (pCtrl && m_pTreeCtrl->HitTest(pt, &uFlag)){
		pCtrl->SetWindowPos(&wndTop,0, 0, 0, 0,
			SWP_NOACTIVATE | SWP_NOSIZE |SWP_NOMOVE);
	}
	
	return CTreeView::OnNcHitTest(point);
}
Exemplo n.º 16
0
void CUploadListCtrl::Init()
{
	SetName(_T("UploadListCtrl"));

	CImageList ilDummyImageList; //dummy list for getting the proper height of listview entries
	ilDummyImageList.Create(1, theApp.GetSmallSytemIconSize().cy,theApp.m_iDfltImageListColorFlags|ILC_MASK, 1, 1); 
	SetImageList(&ilDummyImageList, LVSIL_SMALL);
	ASSERT( (GetStyle() & LVS_SHAREIMAGELISTS) == 0 );
	ilDummyImageList.Detach();

	SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP);

	CToolTipCtrl* tooltip = GetToolTips();
	if (tooltip){
		m_tooltip->SubclassWindow(tooltip->m_hWnd);
		tooltip->ModifyStyle(0, TTS_NOPREFIX);
		tooltip->SetDelayTime(TTDT_AUTOPOP, 20000);
		tooltip->SetDelayTime(TTDT_INITIAL, thePrefs.GetToolTipDelay()*1000);
	}

	InsertColumn(0,GetResString(IDS_QL_USERNAME),LVCFMT_LEFT,150,0);
	InsertColumn(1,GetResString(IDS_FILE),LVCFMT_LEFT,275,1);
	InsertColumn(2,GetResString(IDS_DL_SPEED),LVCFMT_LEFT,60,2);
	InsertColumn(3,GetResString(IDS_DL_TRANSF),LVCFMT_LEFT,65,3);
	InsertColumn(4,GetResString(IDS_WAITED),LVCFMT_LEFT,60,4);
	InsertColumn(5,GetResString(IDS_UPLOADTIME),LVCFMT_LEFT,60,5);
	InsertColumn(6,GetResString(IDS_STATUS),LVCFMT_LEFT,110,6);
	InsertColumn(7,GetResString(IDS_UPSTATUS),LVCFMT_LEFT,100,7);

	SetAllIcons();
	Localize();
	LoadSettings();

	// Barry - Use preferred sort order from preferences
	SetSortArrow();
	SortItems(SortProc, GetSortItem() + (GetSortAscending() ? 0:100));
}
Exemplo n.º 17
0
void CInputDocView::addPanel(CResultStream* pStream, int id)
#endif
{
	CRect r;//(0,0, 100, 100);
	GetClientRect(&r);
#ifndef rde270
	// change the dimensions a little so we don't get the annoying non-repaint of m_tabCtrl
	//  when we repaint the RECtrl after a chunk has been loaded offline.
	r.top = 21;
	AsyncLoadRichEditCtrl* pEC = new AsyncLoadRichEditCtrl;
#else   // rde270
	r.top = 25;
	r.right -= 5;
	r.bottom -= 5;
	CRichEditCtrl* pEC = new CRichEditCtrl;//CPanelRichEditCtrl;//
#endif
	//	CEdit* pEC = new CEdit;
	m_pEditCtrls.Add(pEC);



	DWORD dwFlags = ECO_SAVESEL | ES_AUTOVSCROLL | ES_MULTILINE |
				ES_NOHIDESEL   | WS_BORDER | WS_VSCROLL | WS_CHILD | WS_VISIBLE | ES_WANTRETURN;

#ifndef jdhhab621
	// a hack to get a scrollbar for pc-patr.  This could be generalized or put in the user's
	// control, but not without work that seems unjustified if it's just for pcpatr.

	if (pStream->getDescriptor()->getTabLabel().Find(_T("PATR")) != -1)
		dwFlags |= WS_HSCROLL | ES_AUTOHSCROLL;
#endif // jdhhab261

	pEC->Create(dwFlags,
				(RECT&)r,
				&m_tabCtrl,
				id);

	CFont* test = pStream->getFont();
	pEC->SetFont(test);

#ifndef rde270
	// delay StreamIn until after setting up of the associated tab (because during StreamIn
	//  our callback must have the pStream which is stored in the tab's lParam member.
#else   // rde270
	// NOTE: I'm not clear on whether StreamIn is done with the stream when it returns;
	// it doesn't seem to delete it, but you'd think it would need
	// to keep it around so it can get at large files when the user
	// scrolls down; maybe not.  Why it matters is, what if the cwCOOKIE
	// member points to a CResultsStream that I've deleted?
	// For now, I'm going to go on the assumption that the whole
	// file is read right here.
	pEC->StreamIn(SF_TEXT, pStream->getEditStreamIn()); // icon may be set in here

	// Set editing flags and limit

	CInputDoc* pDoc = (CInputDoc*) GetDocument();
	if(id==kBasePanelID && pDoc->m_bBaseIsEditable)
	{
		pEC->SetReadOnly(FALSE);
		const long kMaxAddableChars = 2000;
		long l = pEC->GetTextLength() + kMaxAddableChars;
		pEC->LimitText(l);
		pEC->SetEventMask( ENM_KEYEVENTS| ENM_CHANGE );// want to know when the user changes something
	}
	else
		pEC->SetReadOnly(TRUE);
#endif  // rde270


/*	ALL THIS WAS FOR CEDIT, NOT CRICHEDIT
	EDITSTREAM es =  pStream->getEditStreamIn();
	long sz = pEC->GetLimitText()-10;
	LPTSTR buff = new char [sz+1];
	ASSERTX(buff);
	long actual;
	(es.pfnCallback)((DWORD)(pStream), (unsigned char*)buff, sz, &actual);
	buff[actual] = '\0';
	CString sOverflowMsg = pStream->getOverflowMsg();
	if(actual > sz - sOverflowMsg.GetLength())
	{
		buff[sz-sOverflowMsg.GetLength()] = '\0';
		CString s = buff;
		s += sOverflowMsg;
		pEC->SetWindowText(s);
	}
	else
		pEC->SetWindowText(buff);


	// make it close
	(es.pfnCallback)((DWORD)(pStream), (unsigned char*)buff, 0, &actual);
	delete buff;
*/

	// make the tab for this item
	TC_ITEM tie;
	tie.mask = TCIF_TEXT |TCIF_PARAM ;
	tie.lParam = (LPARAM)pStream;
	tie.pszText = (LPTSTR)  LPCTSTR(pStream->getDescriptor()->getTabLabel());
	int iconEnum = pStream->getTabIconEnum();
	if(iconEnum>=0)
	{
		tie.mask |= TCIF_IMAGE;
		tie.iImage = iconEnum;
	}

#ifndef rde270
	// save the inserted tab's index (so it can be accessed by knowing the EC).
	int nIndex = m_tabCtrl.InsertItem(99, &tie );
	::SetWindowLong(pEC->GetSafeHwnd(),GWL_USERDATA,nIndex);
	if( -1 == nIndex )
#else   // rde270
	if (-1 == m_tabCtrl.InsertItem(99, &tie ))
#endif  // rde270
	{
		ASSERTX(FALSE);
	}
	else
	{
		//CToolTipCtrl* pTip = new CToolTipCtrl;
		//pTip->Create(this); // <--- or should it be the tab bar?
		//pTip->
		CToolTipCtrl* pTip = m_tabCtrl.GetToolTips();
		ASSERT(pTip);
		CRect r;
		m_tabCtrl.GetItemRect(m_tabCtrl.GetItemCount()-1, &r);
		CString s;
		s.Format(_T("%s"), (LPCTSTR)pStream->getToolTipText());
		pTip->AddTool(&m_tabCtrl, s, &r, id);
	}

#ifndef rde270
	// moved 'StreamIn' here because we want the tab already setup for when we get the
	//  'finished-a-chunk' callback.
	// use the 'AsyncLoadRichEdit' to stream it in [load asynchronously so we don't kill
	//  the UI for minutes (on big files).]
#pragma message("If you subclass CResultStream with something besides CResultStreamFile, this'll break!")
	CResultStreamFile* pStreamFile = (CResultStreamFile*)pStream;
	// ASSERT(pStreamFile->IsKindOf(RUNTIME_CLASS(CResultStreamFile)));
	// this assert is what *should* be, but the various streams are from the processor DLLs
	//  and for some reason IsKindOf doesn't appear to work across DLL boundaries.

	pEC->StreamIn(pStreamFile->getPath(), bSyncStreamIn, CInputDocView::OnStreamInChunkComplete, (DWORD_PTR)this);

	// Set editing flags and limit
	CInputDoc* pDoc = (CInputDoc*) GetDocument();
	if(id==kBasePanelID && pDoc->m_bBaseIsEditable)
	{
		pEC->SetReadOnly(FALSE);
		const long kMaxAddableChars = 2000;
		long l = pEC->GetTextLength() + kMaxAddableChars;
		pEC->LimitText(l);
		pEC->SetEventMask( ENM_KEYEVENTS| ENM_CHANGE );// want to know when the user changes something

		// if the editable file was imported as UTF-16, then we must make it 'modified' so
		//  it'll be saved as UTF-8 before processing (Ample, et al., can deal with UTF-8,
		//  but not UTF-16).
		if(     (pEC->FileEncoding() != eUTF8)
			&&  (pEC->FileEncoding() != eAnsi) )
			GetDocument()->SetModifiedFlag();
	}
	else
		pEC->SetReadOnly(TRUE);
#endif  // rde270
}
Exemplo n.º 18
0
BOOL CToolBarDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here

//	We create our toolbar (this is in a standard dialog box)
//	with the CToolBarCtrl.Create() function. This function takes 
//	a RECT structure as a parameter, but the RECT structure is ignored
//	and not used.

	int ButtonBitmap = 0;
	int ButtonString = 0;
	int ButtonCount = 0;

	RECT	rect;
	rect.top = 0;
	rect.left = 0;
	rect.bottom = 60;
	rect.right = 100;
	
	m_ToolBarCtrl.Create(
		WS_CHILD | WS_VISIBLE | CCS_TOP | TBSTYLE_TOOLTIPS | CCS_ADJUSTABLE, 
		rect, this, 0);

	ButtonBitmap = m_ToolBarCtrl.AddBitmap(20, IDB_TOOLBAR);
	ButtonString = m_ToolBarCtrl.AddString(IDS_FIRST_BUTTON);

	m_Buttons[ButtonCount].iBitmap = NULL;
	m_Buttons[ButtonCount].idCommand = 0;
	m_Buttons[ButtonCount].fsState = TBSTATE_ENABLED;
	m_Buttons[ButtonCount].fsStyle = TBSTYLE_SEP;
	m_Buttons[ButtonCount].dwData = 0;
	m_Buttons[ButtonCount].iString = NULL;
	
	++ButtonCount;

//	Move everything over to leave room for the combobox
//	which will be on the far left of the toolbar.
//	The combobox could be anywhere, but putting it on the 
//	left is easier for the programmer. Most applications with 
//	stock implementations of CToolBarCtrl do it this way.

	m_Buttons[ButtonCount] = m_Buttons[ButtonCount - 1]; 
	++ButtonCount;
	m_Buttons[ButtonCount] = m_Buttons[ButtonCount - 1]; 
	++ButtonCount;
	m_Buttons[ButtonCount] = m_Buttons[ButtonCount - 1]; 
	++ButtonCount;
	m_Buttons[ButtonCount] = m_Buttons[ButtonCount - 1]; 
	++ButtonCount;
	m_Buttons[ButtonCount] = m_Buttons[ButtonCount - 1]; 
	++ButtonCount;
	m_Buttons[ButtonCount] = m_Buttons[ButtonCount - 1]; 
	++ButtonCount;
	m_Buttons[ButtonCount] = m_Buttons[ButtonCount - 1]; 
	++ButtonCount;
	m_Buttons[ButtonCount] = m_Buttons[ButtonCount - 1]; 
	++ButtonCount;
	m_Buttons[ButtonCount] = m_Buttons[ButtonCount - 1]; 
	++ButtonCount;
	m_Buttons[ButtonCount] = m_Buttons[ButtonCount - 1]; 
	++ButtonCount;
	m_Buttons[ButtonCount] = m_Buttons[ButtonCount - 1]; 
	++ButtonCount;
	m_Buttons[ButtonCount] = m_Buttons[ButtonCount - 1]; 
	++ButtonCount;

	m_Buttons[ButtonCount].iBitmap = ButtonBitmap + 0;
	m_Buttons[ButtonCount].idCommand = IDOK;
	m_Buttons[ButtonCount].fsState = TBSTATE_ENABLED;
	m_Buttons[ButtonCount].fsStyle = TBSTYLE_BUTTON;
	m_Buttons[ButtonCount].dwData = 0;
	m_Buttons[ButtonCount].iString = ButtonString;

	++ButtonCount;
	
	m_Buttons[ButtonCount].iBitmap = NULL;
	m_Buttons[ButtonCount].idCommand = 0;
	m_Buttons[ButtonCount].fsState = TBSTATE_ENABLED;
	m_Buttons[ButtonCount].fsStyle = TBSTYLE_SEP;
	m_Buttons[ButtonCount].dwData = 0;
	m_Buttons[ButtonCount].iString = NULL;
	
	++ButtonCount;

	m_Buttons[ButtonCount].iBitmap = ButtonBitmap + 1;
	m_Buttons[ButtonCount].idCommand = IDCANCEL;
	m_Buttons[ButtonCount].fsState = TBSTATE_ENABLED;
	m_Buttons[ButtonCount].fsStyle = TBSTYLE_BUTTON;
	m_Buttons[ButtonCount].dwData = 0;
	m_Buttons[ButtonCount].iString = NULL;

	++ButtonCount;

	m_Buttons[ButtonCount].iBitmap = ButtonBitmap + 2;
	m_Buttons[ButtonCount].idCommand = IDC_CHECK1;
	m_Buttons[ButtonCount].fsState = TBSTATE_ENABLED;
	m_Buttons[ButtonCount].fsStyle = TBSTYLE_CHECK;
	m_Buttons[ButtonCount].dwData = 0;
	m_Buttons[ButtonCount].iString = NULL;

	++ButtonCount;
	
	m_Buttons[ButtonCount].iBitmap = ButtonBitmap + 3;
	m_Buttons[ButtonCount].idCommand = IDC_OTHER_BUTTON;
	m_Buttons[ButtonCount].fsState = TBSTATE_ENABLED;
	m_Buttons[ButtonCount].fsStyle = TBSTYLE_BUTTON;
	m_Buttons[ButtonCount].dwData = 0;
	m_Buttons[ButtonCount].iString = NULL;

	++ButtonCount;
	
	m_Buttons[ButtonCount].iBitmap = ButtonBitmap + 4;
	m_Buttons[ButtonCount].idCommand = 0;
	m_Buttons[ButtonCount].fsState = TBSTATE_ENABLED;
	m_Buttons[ButtonCount].fsStyle = TBSTYLE_SEP;
	m_Buttons[ButtonCount].dwData = 0;
	m_Buttons[ButtonCount].iString = NULL;
	
	++ButtonCount;

	m_Buttons[ButtonCount].iBitmap = ButtonBitmap + 5;
	m_Buttons[ButtonCount].idCommand = IDC_LAST_BUTTON;
	m_Buttons[ButtonCount].fsState = TBSTATE_ENABLED;
	m_Buttons[ButtonCount].fsStyle = TBSTYLE_BUTTON;
	m_Buttons[ButtonCount].dwData = 0;
	m_Buttons[ButtonCount].iString = ButtonString;

	++ButtonCount;

//	Once the m_Buttons[] array is filled in, then we add
//	the buttons to the toolbar.

	m_ToolBarCtrl.AddButtons(ButtonCount, m_Buttons);

//	Since our bitmaps are non-standard in size, we resize
//	the toolbar's buttons to fit the bitmaps:

	CSize sizeButtons(55, 65);

	m_ToolBarCtrl.SetButtonSize(sizeButtons);

//	Since our bitmaps are non-standard in size, we tell
//	the toolbar the real size of our images:

	CSize sizeBitmap(48, 45);

	m_ToolBarCtrl.SetBitmapSize(sizeBitmap);

//	Finally, we resize the toolbar for our non-standard
//	button sizes:

	m_ToolBarCtrl.AutoSize();

//	Finally, add our ComboBox to the toolbar. We add it to the 
//	left edge to make things easy. The buttons are spaced over
//      using a bunch of TBSTYLE_SEP buttons.
// 
//	The ComboBox will be created with a standard string height for the 
//	visible portion. The rect.bottom specifies the dropdown part.
//	We set the height of the top part later...

	rect.top = 2; rect.left = 5; rect.bottom = 200; rect.right = 100;

	if (m_ComboBox.Create( WS_CHILD | WS_BORDER | WS_VISIBLE |
		CBS_HASSTRINGS | CBS_DROPDOWN, rect, (CWnd *)&m_ToolBarCtrl, 124) == 0)
	{// Real applications would have to perhaps recover from this error:
                TRACE("Could not create combobox\n");
	}
	else
	{
//		Set the ComboBox's edit area's height to the height of 
//		the button's bitmap size!

		m_ComboBox.SetItemHeight(-1, 45);

//		Add (some dummy) strings to the ComboBox: 

		m_ComboBox.AddString("asdf");
		m_ComboBox.AddString("qwer");
		m_ComboBox.AddString("zxcv");

//		Set the current selection to the (zero based) second item

		m_ComboBox.SetCurSel(1);
	}

	rect.top = 2; rect.left = 5; rect.bottom = 45; rect.right = 100;
	CToolTipCtrl * tt;
	tt = m_ToolBarCtrl.GetToolTips();

	if (tt->AddTool(&m_ComboBox, IDC_COMBO_BOX) == 0)
	{
		TRACE("AddTool() failed!!!!!\n");
	}


	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 19
0
// id 0 is the basestream
void CInputDocView::addPanel(CResultStream* pStream, int id)
{
	CRect r;//(0,0, 100, 100);
	GetClientRect(&r);
	r.top = 25;
	r.right -= 5;
	r.bottom -= 5;
	CRichEditCtrl* pEC = new CRichEditCtrl;//CPanelRichEditCtrl;//
//	CEdit* pEC = new CEdit;
	m_pEditCtrls.Add(pEC);



	DWORD dwFlags = ECO_SAVESEL | ES_AUTOVSCROLL | ES_MULTILINE |
				ES_NOHIDESEL   | WS_BORDER | WS_VSCROLL | WS_CHILD | WS_VISIBLE | ES_WANTRETURN;

#ifndef jdhhab621
	// a hack to get a scrollbar for pc-patr.  This could be generalized or put in the user's
	// control, but not without work that seems unjustified if it's just for pcpatr.

	if (pStream->getDescriptor()->getTabLabel().Find("PATR") != -1)
		dwFlags |= WS_HSCROLL | ES_AUTOHSCROLL;
#endif // jdhhab261

	pEC->Create(dwFlags,
				(RECT&)r,
				&m_tabCtrl,
				id);

	CFont* test = pStream->getFont();
	pEC->SetFont(test);

	// NOTE: I'm not clear on whether StreamIn is done with the stream when it returns;
	// it doesn't seem to delete it, but you'd think it would need
	// to keep it around so it can get at large files when the user
	// scrolls down; maybe not.  Why it matters is, what if the cwCOOKIE
	// member points to a CResultsStream that I've deleted?
	// For now, I'm going to go on the assumption that the whole
	// file is read right here.
	pEC->StreamIn(SF_TEXT, pStream->getEditStreamIn()); // icon may be set in here
	// Set editing flags and limit

	CInputDoc* pDoc = (CInputDoc*) GetDocument();
	if(id==kBasePanelID && pDoc->m_bBaseIsEditable)
	{
		pEC->SetReadOnly(FALSE);
		const long kMaxAddableChars = 2000;
		long l = pEC->GetTextLength() + kMaxAddableChars;
		pEC->LimitText(l);
		pEC->SetEventMask( ENM_KEYEVENTS| ENM_CHANGE );// want to know when the user changes something
	}
	else
		pEC->SetReadOnly(TRUE);


/*	ALL THIS WAS FOR CEDIT, NOT CRICHEDIT
	EDITSTREAM es =  pStream->getEditStreamIn();
	long sz = pEC->GetLimitText()-10;
	char* buff = new char [sz+1];
	ASSERTX(buff);
	long actual;
	(es.pfnCallback)((DWORD)(pStream), (unsigned char*)buff, sz, &actual);
	buff[actual] = '\0';
	CString sOverflowMsg = pStream->getOverflowMsg();
	if(actual > sz - sOverflowMsg.GetLength())
	{
		buff[sz-sOverflowMsg.GetLength()] = '\0';
		CString s = buff;
		s += sOverflowMsg;
		pEC->SetWindowText(s);
	}
	else
		pEC->SetWindowText(buff);


	// make it close
	(es.pfnCallback)((DWORD)(pStream), (unsigned char*)buff, 0, &actual);
	delete buff;
*/

	// make the tab for this item
	TC_ITEM tie;
	tie.mask = TCIF_TEXT |TCIF_PARAM ;
	tie.lParam = (LPARAM)pStream;
	tie.pszText = (char*)  LPCTSTR(pStream->getDescriptor()->getTabLabel());
	int iconEnum = pStream->getTabIconEnum();
	if(iconEnum>=0)
	{
		tie.mask |= TCIF_IMAGE;
		tie.iImage = iconEnum;
	}

	if (-1 == m_tabCtrl.InsertItem(99, &tie ))
	{
		ASSERTX(FALSE);
	}
	else
	{
		//CToolTipCtrl* pTip = new CToolTipCtrl;
		//pTip->Create(this); // <--- or should it be the tab bar?
		//pTip->
		CToolTipCtrl* pTip = m_tabCtrl.GetToolTips();
		ASSERT(pTip);
		CRect r;
		m_tabCtrl.GetItemRect(m_tabCtrl.GetItemCount()-1, &r);
		CString s;
		s.Format("%s", pStream->getToolTipText());
		pTip->AddTool(&m_tabCtrl, s, &r, id);
	}
}
Exemplo n.º 20
0
void CSearchDlg::SetToolTipsDelay(UINT uDelay)
{
	CToolTipCtrl* tooltip = m_pwndResults->searchlistctrl.GetToolTips();
	if (tooltip)
		tooltip->SetDelayTime(TTDT_INITIAL, uDelay);
}
Exemplo n.º 21
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	GlobalToolTips_G.Create(this);

	m_bCreated=TRUE;

	if (!m_wndToolBar.Create(this) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}
	if (!m_wndToolBarFullScreen.Create(this) ||
		!m_wndToolBarFullScreen.LoadToolBar(IDR_FULLSCREENTOOLBAR))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}
	CString CS;
	CS.LoadString(IDS_STANDARD);
	m_wndToolBar.SetWindowText(CS);
	CS.LoadString(IDS_FULLSCREEN);
	m_wndToolBarFullScreen.SetWindowText(CS);
	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}
	m_dataView.Create(this,IDD_OVERALLDATAVIEW,CBRS_LEFT,0xe004);


	// TODO: Remove this if you don't want tool tips or a resizeable toolbar
	m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
		CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	m_wndToolBarFullScreen.EnableDocking(0);
	CPoint pt(10,10);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);
	FloatControlBar(&m_wndToolBarFullScreen,pt);
	ShowControlBar(&m_wndToolBarFullScreen,FALSE,FALSE);
	int i;
	for (i=1;i<4;i++) //This assumes that the separators do not count as indicators
	{
		m_wndStatusBar.SetPaneInfo(i,indicators[i],SBPS_NORMAL,STATUS_POS_PANE_WIDTH);
	}
	m_wndStatusBar.SetPaneInfo(4,indicators[4],SBPS_NORMAL,STATUS_SPIN_PANE_WIDTH);
	m_wndStatusBar.SetPaneInfo(5,indicators[5],SBPS_NORMAL,STATUS_TILT_PANE_WIDTH);
	m_wndStatusBar.SetPaneInfo(6,indicators[6],SBPS_NORMAL,STATUS_SIZE_PANE_WIDTH);

	InitializeTreeImageList();	//used by all the tree controls


	CRect rect2;
	rect2.left=0;
	rect2.right=0;
	rect2.bottom=64;
	rect2.right=64;
	if (!m_wndRuler.Create(this,WS_CHILD|WS_VISIBLE,AFX_IDW_CONTROLBAR_FIRST+4))
	{
		TRACE0("Failed to create ruler\n");
	}
	CAppSettings *Set=theApp.GetSettings();
	if (!Set->m_bRuler)
	{
		m_wndRuler.ShowWindow(SW_HIDE);
	}
	m_viewTab.AddString(IDS_FREEFORM,ID_MOVEMENT_FREEFORMVIEW,FALSE);
	m_viewTab.AddString(IDS_PLAN,ID_MOVEMENT_PLANVIEW,FALSE);
	m_viewTab.AddString(IDS_PROFILE,ID_MOVEMENT_PROFILEVIEW,FALSE);
	m_viewTab.AddString(IDS_MIXED,ID_MOVEMENT_MIXEDVIEW,FALSE);
	if (!m_viewTab.Create(this,this,WS_CHILD|WS_VISIBLE,AFX_IDW_CONTROLBAR_FIRST+5))
	{
		TRACE0("Failed to create view tab\n");
	}
	if (!Set->m_bBottomTabs)
	{
		m_viewTab.ShowWindow(SW_HIDE);
	}
	SetActiveViewTab(VT_FREEFORM);

	m_wndStatusBar.ShowWindow(Set->m_bStatusBar?SW_SHOW:SW_HIDE);
	m_wndToolBar.ShowWindow(Set->m_bToolBar?SW_SHOW:SW_HIDE);

	// CG: The following line was added by the Splash Screen component.
	CSplashWnd::ShowSplashScreen(this);
	return 0;
}
Exemplo n.º 22
0
LRESULT CToolBarPopup::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
    if ( WM_MOUSEFIRST <= message && message <= WM_MOUSELAST )
    {
        DWORD dwPos = ::GetMessagePos();
        CPoint ptScreen( LOWORD( dwPos ), HIWORD( dwPos ) );
        CWnd* pWnd = WindowFromPoint( ptScreen );
        if ( pWnd != 0 )
        {
            CPoint ptClient( ptScreen );
            pWnd->ScreenToClient( &ptClient );

            switch ( message )
            {
                case WM_MOUSEMOVE:
                {
                    // Check if hot item should be changed
                    bool bOverTbCtrl = ( pWnd == &m_tbCtrl );
                    if ( bOverTbCtrl )
                    {
                        int nHit = m_tbCtrl.HitTest( &ptClient );
                        m_tbCtrl.SetHotItem( nHit );

                        // Let tooltip control process mouse event
                        CToolTipCtrl* pTtCtrl = m_tbCtrl.GetToolTips();
                        if ( pTtCtrl != 0 )
                        {
                            MSG msg;
                            msg.hwnd    = m_tbCtrl.m_hWnd;
                            msg.message = WM_MOUSEMOVE;
                            msg.wParam  = wParam;
                            msg.lParam  = MAKELPARAM( ptClient.x, ptClient.y );
                            msg.pt      = ptScreen;
                            msg.time    = ::GetMessageTime();
                            pTtCtrl->RelayEvent( &msg );
                        }
                    }
                    else if ( m_bOverTbCtrl )
                    {
                        m_tbCtrl.SetHotItem( -1 );
                    }

                    m_bOverTbCtrl = bOverTbCtrl;
                    return 0L;
                }
                case WM_LBUTTONDOWN:
                    if ( pWnd != this )
                    {
                        // Dismiss menu if user has clicked outside the window
                        if ( pWnd != &m_tbCtrl )
                        {
                            SendMessage( WM_TB_ENDMODALLOOP );
                        }

                        // Forward this mouse event to the window that was clicked
                        LPARAM nPosition = MAKELPARAM( ptScreen.x, ptScreen.y );
                        WPARAM nHitTest  = pWnd->SendMessage( WM_NCHITTEST, 0, nPosition );
                        if ( nHitTest == HTCLIENT )
                        {
                            nPosition = MAKELPARAM( ptClient.x, ptClient.y );
                            pWnd->PostMessage( WM_LBUTTONDOWN, wParam, nPosition );
                        }
                        else
                        {
                            pWnd->PostMessage( WM_NCLBUTTONDOWN, nHitTest, nPosition );
                        }
                    }
                    return 0L;

                default:
                    break;
            }
        }
    }

    return CWnd::WindowProc( message, wParam, lParam );
}
Exemplo n.º 23
0
void COXScrollTip::AdjustColorsFontsMetrics()
	// --- In  : 
	// --- Out : 
	// --- Returns : 
	// --- Effect : Adjust the colors, fonts etc. to the new WIndows settings
	{
	// Get the tooltip frame, background and text color
	if (m_framePen.m_hObject != NULL)
		// ... Destroy previous pen
		m_framePen.DeleteObject();
	if (m_backgroundBrush.m_hObject != NULL)
		// ... Destroy previous brush
		m_backgroundBrush.DeleteObject();
	VERIFY(m_framePen.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_WINDOWFRAME)));
	VERIFY(m_backgroundBrush.CreateSolidBrush(::GetSysColor(COLOR_INFOBK)));
	m_textColor = ::GetSysColor(COLOR_INFOTEXT);

	// Get the tooltip font
	if ((HFONT)m_font != NULL)
		// ... Destroy previous font
		m_font.DeleteObject();

	// ... Although the tooltip font can be specified through control panel
	//     there seems to be no way to retrieve this information.
	//	   So we will crete a temporary tooltip to get its font
	CToolTipCtrl toolTip;

	// ... Tooltip control can be created with NULL parent
	//     We only need it for the font, so this will arm nobody
	if (toolTip.Create(NULL))
		{
		CFont* pFont = toolTip.GetFont();
		if (pFont != NULL)
			{
			LOGFONT logFont;
			::ZeroMemory(&logFont, sizeof(logFont));
			pFont->GetLogFont(&logFont);
			m_font.CreateFontIndirect(&logFont);
			}
		toolTip.DestroyWindow();
		}

	if ((HFONT)m_font == NULL)
		{
		TRACE0("COXScrollTip::AdjustColorsFontsMetrics : Could not establish correct font, using default");
		LOGFONT logFont;
		::ZeroMemory(&logFont, sizeof(logFont));
		logFont.lfHeight = -11;
		logFont.lfWeight = 400;
		UTBStr::tcscpy(logFont.lfFaceName, 14, _T("MS Sans Serif"));
		VERIFY(m_font.CreateFontIndirect(&logFont));
		}

	// Use the font in this control
	SetFont(&m_font);

	// The font may have changed, re-align the text within the control
	CString sText;
	GetWindowText(sText);
	SetWindowText(sText);

	// Get the width of the scroll arrow of horizontal scrollbar and
	// the height of the scroll arrow of vertical scrollbar and
	m_cxHScroll = ::GetSystemMetrics(SM_CXHSCROLL);
	m_cyVScroll = ::GetSystemMetrics(SM_CYVSCROLL);
	}
Exemplo n.º 24
0
void CWnd::FilterToolTipMessage(MSG* pMsg)
{
    // this CWnd has tooltips enabled
    UINT message = pMsg->message;
    if ((message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE ||
            message == WM_LBUTTONUP || message == WM_RBUTTONUP ||
            message == WM_MBUTTONUP) &&
            (GetKeyState(VK_LBUTTON) >= 0 && GetKeyState(VK_RBUTTON) >= 0 &&
             GetKeyState(VK_MBUTTON) >= 0))
    {
        AFX_MODULE_THREAD_STATE* pModuleThreadState = AfxGetModuleThreadState();

        // make sure that tooltips are not already being handled
        CWnd* pWnd = CWnd::FromHandle(pMsg->hwnd);
        while (pWnd != NULL && !(pWnd->m_nFlags & (WF_TOOLTIPS|WF_TRACKINGTOOLTIPS)))
        {
            pWnd = pWnd->GetParent();
        }
        if (pWnd != this)
        {
            if (pWnd == NULL)
            {
                // tooltips not enabled on this CWnd, clear last state data
                pModuleThreadState->m_pLastHit = NULL;
                pModuleThreadState->m_nLastHit = static_cast<INT_PTR>(-1);
            }
            return;
        }

        CToolTipCtrl* pToolTip = pModuleThreadState->m_pToolTip;
        CWnd* pOwner = GetParentOwner();
        if (pToolTip != NULL && pToolTip->GetOwner() != pOwner)
        {
            pToolTip->DestroyWindow();
            delete pToolTip;
            pModuleThreadState->m_pToolTip = NULL;
            pToolTip = NULL;
        }
        if (pToolTip == NULL)
        {
            pToolTip = new CToolTipCtrl;
            if (!pToolTip->Create(pOwner, TTS_ALWAYSTIP))
            {
                delete pToolTip;
                return;
            }
            pToolTip->SendMessage(TTM_ACTIVATE, FALSE);
            pModuleThreadState->m_pToolTip = pToolTip;
        }

        ASSERT_VALID(pToolTip);
        ASSERT(::IsWindow(pToolTip->m_hWnd));

        TOOLINFO ti;
        memset(&ti, 0, sizeof(TOOLINFO));

        // determine which tool was hit
        CPoint point = pMsg->pt;
        ::ScreenToClient(m_hWnd, &point);
        TOOLINFO tiHit;
        memset(&tiHit, 0, sizeof(TOOLINFO));
        tiHit.cbSize = sizeof(AFX_OLDTOOLINFO);
        INT_PTR nHit = OnToolHitTest(point, &tiHit);

        // build new toolinfo and if different than current, register it
        CWnd* pHitWnd = nHit == -1 ? NULL : this;
        if (pModuleThreadState->m_nLastHit != nHit || pModuleThreadState->m_pLastHit != pHitWnd)
        {
            if (nHit != -1)
            {
                // add new tool and activate the tip
                ti = tiHit;
                ti.uFlags &= ~(TTF_NOTBUTTON|TTF_ALWAYSTIP);
                if (m_nFlags & WF_TRACKINGTOOLTIPS)
                    ti.uFlags |= TTF_TRACK;
                VERIFY(pToolTip->SendMessage(TTM_ADDTOOL, 0, (LPARAM)&ti));
                if ((tiHit.uFlags & TTF_ALWAYSTIP) || IsTopParentActive())
                {
                    // allow the tooltip to popup when it should
                    pToolTip->SendMessage(TTM_ACTIVATE, TRUE);
                    if (m_nFlags & WF_TRACKINGTOOLTIPS)
                        pToolTip->SendMessage(TTM_TRACKACTIVATE, TRUE, (LPARAM)&ti);

                    // bring the tooltip window above other popup windows
                    ::SetWindowPos(pToolTip->m_hWnd, HWND_TOP, 0, 0, 0, 0,
                                   SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOOWNERZORDER);
                }
            }
            else
            {
                pToolTip->SendMessage(TTM_ACTIVATE, FALSE);
            }

            // relay mouse event before deleting old tool
            _AfxRelayToolTipMessage(pToolTip, pMsg);

            // now safe to delete the old tool
            if (pModuleThreadState->m_pLastInfo != NULL &&
                    pModuleThreadState->m_pLastInfo->cbSize >= sizeof(AFX_OLDTOOLINFO))
                pToolTip->SendMessage(TTM_DELTOOL, 0, (LPARAM)pModuleThreadState->m_pLastInfo);

            pModuleThreadState->m_pLastHit = pHitWnd;
            pModuleThreadState->m_nLastHit = nHit;
            if (pModuleThreadState->m_pLastInfo == NULL)
            {
                pModuleThreadState->m_pLastInfo = new TOOLINFO;
                memset(pModuleThreadState->m_pLastInfo, 0, sizeof(TOOLINFO));
            }
            *pModuleThreadState->m_pLastInfo = tiHit;
        }
        else
        {
            if (m_nFlags & WF_TRACKINGTOOLTIPS)
            {
                POINT pt;

                ::GetCursorPos( &pt );
                pToolTip->SendMessage(TTM_TRACKPOSITION, 0, MAKELPARAM(pt.x, pt.y));
            }
            else
            {
                // relay mouse events through the tooltip
                if (nHit != -1)
                    _AfxRelayToolTipMessage(pToolTip, pMsg);
            }
        }

        if ((tiHit.lpszText != LPSTR_TEXTCALLBACK) && (tiHit.hinst == 0))
            free(tiHit.lpszText);
    }
    else if (m_nFlags & (WF_TOOLTIPS|WF_TRACKINGTOOLTIPS))
    {
        // make sure that tooltips are not already being handled
        CWnd* pWnd = CWnd::FromHandle(pMsg->hwnd);
        while (pWnd != NULL && pWnd != this && !(pWnd->m_nFlags & (WF_TOOLTIPS|WF_TRACKINGTOOLTIPS)))
            pWnd = pWnd->GetParent();
        if (pWnd != this)
            return;

        BOOL bKeys = (message >= WM_KEYFIRST && message <= WM_KEYLAST) ||
                     (message >= WM_SYSKEYFIRST && message <= WM_SYSKEYLAST);
        if ((m_nFlags & WF_TRACKINGTOOLTIPS) == 0 &&
                (bKeys ||
                 (message == WM_LBUTTONDOWN || message == WM_LBUTTONDBLCLK) ||
                 (message == WM_RBUTTONDOWN || message == WM_RBUTTONDBLCLK) ||
                 (message == WM_MBUTTONDOWN || message == WM_MBUTTONDBLCLK) ||
                 (message == WM_NCLBUTTONDOWN || message == WM_NCLBUTTONDBLCLK) ||
                 (message == WM_NCRBUTTONDOWN || message == WM_NCRBUTTONDBLCLK) ||
                 (message == WM_NCMBUTTONDOWN || message == WM_NCMBUTTONDBLCLK)))
        {
            CWnd::CancelToolTips(bKeys);
        }
    }
}