示例#1
0
	LRESULT WindowImplBase::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
	{
		POINT pt; pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam);
		::ScreenToClient(*this, &pt);

		RECT rcClient;
		::GetClientRect(*this, &rcClient);

		if (!::IsZoomed(*this))
		{
			RECT rcSizeBox = m_pm.GetSizeBox();
			if (pt.y < rcClient.top + rcSizeBox.top)
			{
				if (pt.x < rcClient.left + rcSizeBox.left) return HTTOPLEFT;
				if (pt.x > rcClient.right - rcSizeBox.right) return HTTOPRIGHT;
				return HTTOP;
			}
			else if (pt.y > rcClient.bottom - rcSizeBox.bottom)
			{
				if (pt.x < rcClient.left + rcSizeBox.left) return HTBOTTOMLEFT;
				if (pt.x > rcClient.right - rcSizeBox.right) return HTBOTTOMRIGHT;
				return HTBOTTOM;
			}

			if (pt.x < rcClient.left + rcSizeBox.left) return HTLEFT;
			if (pt.x > rcClient.right - rcSizeBox.right) return HTRIGHT;
		}

		RECT rcCaption = m_pm.GetCaptionRect();
		if (-1 == rcCaption.bottom)
		{
			rcCaption.bottom = rcClient.bottom;
		}

		if (pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.right - rcCaption.right
			&& pt.y >= rcCaption.top && pt.y < rcCaption.bottom)
		{
			CControlUI* pControl = m_pm.FindControl(pt);
			if (IsInStaticControl(pControl))
			{
				return HTCAPTION;
			}
		}


		return HTCLIENT;
	}
示例#2
0
void CDuiFrameWnd::Notify( TNotifyUI& msg )
{
	if (msg.sType == DUI_MSGTYPE_SELECTCHANGED)
    {
        CTreeViewUI* pTree = static_cast<CTreeViewUI*>(m_PaintManager.FindControl(_T("treePlaylist")));

        if(pTree && -1 != pTree->GetItemIndex(msg.pSender) && U_TAG_PLAYLIST == msg.pSender->GetTag())
        {
            m_iPlaylistIndex = pTree->GetItemIndex(msg.pSender);          
            Play(m_cPlayList.GetPlaylist(GetPlaylistIndex(m_iPlaylistIndex)).szFileName);  //(static_cast<CTreeNodeUI*> (msg.pSender))->GetItemText();
        }
    }
    else if(msg.sType == DUI_MSGTYPE_SELECTCHANGED)
    {
        CDuiString    strName = msg.pSender->GetName();
        CTabLayoutUI* pTab    = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(_T("tabCaption")));
        std::vector<CDuiString> vctString;

        vctString.push_back(_T("tabPlay"));
        vctString.push_back(_T("tabLib"));
        vctString.push_back(_T("tabFind"));
        vctString.push_back(_T("tabMine"));
        vctString.push_back(_T("tabCloud"));

        std::vector<CDuiString>::iterator it = std::find(vctString.begin(), vctString.end(), strName);
        if (vctString.end() != it)
        {
            int iIndex = it - vctString.begin();
            pTab->SelectItem(iIndex);

            // 加载网页
            // 由于加载网页会耗很多内存,所以这里选择动态加载
            if (iIndex > 0)
            {
                std::vector<CDuiString> vctName, vctURL;
                CActiveXUI* pActiveXUI;

                vctName.push_back(_T("ActiveXLib"));
                vctName.push_back(_T("ActiveXFind"));
                vctName.push_back(_T("ActiveXMine"));
                vctName.push_back(_T("ActiveXCloud"));

                vctURL.push_back(_T("http://pianku.xmp.kankan.com/moviestore_index.html"));
                vctURL.push_back(_T("http://search.xmp.kankan.com/index4xmp.shtml"));
                vctURL.push_back(_T("http://pianku.xmp.kankan.com/xmpguess/host.html"));
                vctURL.push_back(_T("http://vod.xunlei.com/page/xmp/home/home.html?init=1"));

                iIndex--;
                pActiveXUI = static_cast<CActiveXUI*>(m_PaintManager.FindControl(vctName[iIndex]));

                if(pActiveXUI) 
                {
                    IWebBrowser2* pWebBrowser = NULL;
                    pActiveXUI->GetControl(IID_IWebBrowser2, (void**)&pWebBrowser);

                    if(pWebBrowser) 
                    {
                        _bstr_t bstrTmp;
                        BSTR    bstr;

                        pWebBrowser->get_LocationURL(&bstr);
                        bstrTmp.Attach(bstr);

                        if (! bstrTmp.length())
                        {
                            pWebBrowser->Navigate(_bstr_t(vctURL[iIndex]), NULL,NULL,NULL,NULL);
                            pWebBrowser->Release();
                        }
                    }
                }
            }
        }
    }
    else if(msg.sType == DUI_MSGTYPE_ITEMCLICK)
    {
        CDuiString strName = msg.pSender->GetName();

        if (strName == _T("menuSequence"))
        {
            m_emPlayMode = EM_PLAY_MODE_SEQUENCE;
        } 
        else if (strName == _T("menuRandom"))
        {
            m_emPlayMode = EM_PLAY_MODE_RANDOM;
        }
        else if (strName == _T("menuSingleCircle"))
        {
            m_emPlayMode = EM_PLAY_MODE_SINGLE_CIRCLE;
        }
    }
    else if( msg.sType == DUI_MSGTYPE_DBCLICK )   
    {
        if (IsInStaticControl(msg.pSender))
        {
            // 这里会传进来很多次双击消息,所以只获取祖先控件的消息
            if (! msg.pSender->GetParent())
            {
                FullScreen(! m_bFullScreenMode);
            }
        }
    }

    __super::Notify(msg);
}