Пример #1
0
void CVideoFrame::OnPrepare(TNotifyUI& msg)
{
	CVerticalLayoutUI* pVideoLayoutUI = static_cast<CVerticalLayoutUI*>(m_PaintManager.FindControl(_T("videoViewLayout")));

	if (pVideoLayoutUI)
	{
		CDuiRect rcWindow;
		GetWindowRect(m_hWnd, &rcWindow);
		rcWindow.top += 80;
		LONG height = rcWindow.bottom - rcWindow.top;
		LONG width = rcWindow.right - rcWindow.left;

		int nControlWidth = pVideoLayoutUI->GetFixedWidth();//pActiveXUI->GetWidth();
		int nControlHeight = pVideoLayoutUI->GetFixedHeight();//pActiveXUI->GetHeight();
		RECT posRect;
		posRect = rcWindow;
		posRect.top = (height - nControlHeight)/2;
		posRect.left= (width - nControlWidth) /2;
		posRect.bottom = posRect.top + nControlHeight;
		posRect.right = posRect.left + nControlWidth;

		pVideoLayoutUI->SetVisible(true);
		pVideoLayoutUI->SetPos(posRect);
	}
	
	CWebBrowserUI* pActiveXUI = static_cast<CWebBrowserUI*>(m_PaintManager.FindControl(_T("htmlView")));
	if( pActiveXUI ) 
	{
		pActiveXUI->SetVisible(true);

		pActiveXUI->SetDelayCreate(true);
		CWebEventHandlerEx *pWebHandle = new CWebEventHandlerEx;
		pActiveXUI->SetWebBrowserEventHandler(pWebHandle);
		//这行代码,如果注释掉,就不会去掉边框,IE有bug,第二次加载网页才会让事件处理器有效
		pActiveXUI->Navigate2(L"about:blank");    

		std::wstring strHtml = CPaintManagerUI::GetInstancePath() + _T("UIRes\\html\\video.html");
		pActiveXUI->Navigate2(strHtml.c_str());
		//pActiveXUI->Navigate2(L"http://www.baidu.com/");
	}
}
Пример #2
0
	LUA_METHOD_IMPL(CWebBrowserUI, Navigate2)
	{
		try
		{
			CWebBrowserUI* self;
			self = static_cast<CWebBrowserUI*>(LuaStatic::CheckUserData(l, 1));
			CDuiString pstrText;
			lua_op_t<CDuiString>::lua_to_value(l, 2, pstrText);

			self->Navigate2(pstrText);
			return 0;
		}
		catch (...)
		{
			DuiException(_T("LuaCWebBrowserUI::Navigate2"));
			return 0;
		}
	}
Пример #3
0
int CMainWnd::CreateNewTab(int nIndex, LPCTSTR pstrUrl)
{
	TabInfo* pInfo = new TabInfo();
	pInfo->nID = m_nTabID++;
	
	CBrowserTab* pTab = new CBrowserTab();
	pTab->SetName(_T("browsertab"));
	m_pBrowserTabBar->AddAt(pTab, nIndex);
	pTab->SetAttribute(_T("style"), _T("tabbtn_style"));

	CWebBrowserUI* pWeb = new CWebBrowserUI();
	m_pBrowserTabBody->AddAt(pWeb, nIndex);
	pWeb->SetHomePage(_T("about:blank"));
	pWeb->SetAutoNavigation(true);
	pWeb->SetDelayCreate(false);
	pWeb->SetWebBrowserEventHandler(this);

	if(pstrUrl == NULL) {
		lstrcpy(pInfo->szUrl, _T("about:blank"));
		lstrcpy(pInfo->szTitle, _T("空白页"));
		pTab->SetText(_T("空白页"));
	}
	else {
		lstrcpy(pInfo->szUrl, pstrUrl);
		lstrcpy(pInfo->szTitle, pstrUrl);
		pTab->SetText(pstrUrl);
		pWeb->Navigate2(pstrUrl);
	}

	pInfo->pTab = pTab;
	pInfo->pWebBrowser = pWeb;

	m_vTabs.push_back(pInfo);

	return nIndex;
}
Пример #4
0
void CMainWnd::Home()
{
	CWebBrowserUI* pWeb = GetCurWeb();
	pWeb->Navigate2(sHomePage);
}
Пример #5
0
void CMainWnd::AddressGo()
{
	CDuiString sUrl = m_pAddressEdit->GetText();
	CWebBrowserUI* pWeb = GetCurWeb();
	pWeb->Navigate2(sUrl);
}