Esempio n. 1
0
LRESULT CMainDlg::OnKeyDownMsg(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	int inow = m_tabTitle.GetCurSel();
	int isum = m_tabTitle.GetItemCount();
	switch (wParam)
	{
	case KeyDownMsg::GoForward:
		m_vetdlgs[inow]->ShowWindow(SW_HIDE);
		inow = inow == 0 ? (isum - 1) : (inow - 1);
		m_tabTitle.SetCurSel(inow);
		m_vetdlgs[inow]->ShowWindow(SW_SHOW);
		m_back.EnableWindow(CanGoBack() ? TRUE : FALSE);
		m_forward.EnableWindow(CanGoForward() ? TRUE : FALSE);
		break;
	case KeyDownMsg::GoNext:
		m_vetdlgs[inow]->ShowWindow(SW_HIDE);
		inow = inow == isum - 1 ? 0 : (inow + 1);
		m_tabTitle.SetCurSel(inow);
		m_vetdlgs[inow]->ShowWindow(SW_SHOW);
		m_back.EnableWindow(CanGoBack() ? TRUE : FALSE);
		m_forward.EnableWindow(CanGoForward() ? TRUE : FALSE);
		break;
	case KeyDownMsg::GoCreate:
		AddWebDlg(m_strDefaultUrl);
		break;
	case KeyDownMsg::GoClose:
		CloseItem(inow);
		break;
	default:
		break;
	}
	return 0;
}
Esempio n. 2
0
FString FHistoryManager::GetBackDesc() const
{
	if ( CanGoBack() )
	{
		return HistoryData[CurrentHistoryIndex - 1].HistoryDesc;
	}
	else
	{
		return FString();
	}
}
Esempio n. 3
0
void CMainDlg::CloseItem(int item)
{
	m_vetdlgs[item]->DestroyWindow();
	delete m_vetdlgs[item];
	vector<CChildDlg*>::iterator itr = m_vetdlgs.begin();
	for (int i = 0; itr != m_vetdlgs.end(); i++)
	{
		if (i == item)
		{
			itr = m_vetdlgs.erase(itr);
		}
		else
		{
			itr++;
		}
	}
	m_tabTitle.DeleteItem(item);
	m_labelNum--;
	if (item)
	{
		m_tabTitle.SetCurSel(item - 1);
		m_vetdlgs[item - 1]->ShowWindow(SW_SHOW);
		m_back.EnableWindow(CanGoBack() ? TRUE : FALSE);
		m_forward.EnableWindow(CanGoForward() ? TRUE : FALSE);
	}
	else if (!item && !m_labelNum)
	{
		AddWebDlg(m_strDefaultUrl);
	}
	else if(!item && m_labelNum)
	{
		m_tabTitle.SetCurSel(item);
		m_vetdlgs[m_labelNum - 1]->ShowWindow(SW_SHOW);
		m_back.EnableWindow(CanGoBack() ? TRUE : FALSE);
		m_forward.EnableWindow(CanGoForward() ? TRUE : FALSE);
	}
}
Esempio n. 4
0
LRESULT CMainDlg::OnTcnSelchangeTab(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/)
{
	// TODO: 在此添加控件通知处理程序代码
	int nItem = m_tabTitle.GetCurSel();
	for (int i = 0; i < m_vetdlgs.size(); i++)
	{
		if (i != nItem)
		{
			m_vetdlgs[i]->ShowWindow(SW_HIDE);
		}
	}
	m_vetdlgs[nItem]->ShowWindow(SW_SHOW);
	m_back.EnableWindow(CanGoBack() ? TRUE : FALSE);
	m_forward.EnableWindow(CanGoForward() ? TRUE : FALSE);
	return 0;
}
Esempio n. 5
0
//返回的网页标题消息
LRESULT CMainDlg::OnWebTitle(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
{
	// unregister message filtering and idle updates
	std::wstring *precv = (std::wstring *)wParam;
	int titleId = (int)lParam;
	WCHAR wcTitle[MAX_PATH] = { 0 };
	wcscat(wcTitle, precv->c_str());
	TCITEM item = { 0 };
	item.mask = TCIF_TEXT;
	item.pszText = wcTitle;
	m_tabTitle.SetItem(titleId, &item);
	m_tabTitle.SetCurSel(titleId);
	m_back.EnableWindow(CanGoBack() ? TRUE : FALSE);
	m_forward.EnableWindow(CanGoForward() ? TRUE : FALSE);
	delete precv;
	return 0;
}
Esempio n. 6
0
bool FHistoryManager::GoBack()
{
	if ( CanGoBack() )
	{
		// Update the current history data
		UpdateCurrentHistoryData();

		// if its possible to go back, decrement the index we are at
		--CurrentHistoryIndex;

		// Update the owner
		ApplyCurrentHistoryData();

		return true;
	}

	return false;
}
FReply FCEFWebBrowserWindow::OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, bool bIsPopup)
{
	FReply Reply = FReply::Unhandled();
	if (IsValid())
	{
		FKey Button = MouseEvent.GetEffectingButton();
		// CEF only supports left, right, and middle mouse buttons
		bool bIsCefSupportedButton = (Button == EKeys::LeftMouseButton || Button == EKeys::RightMouseButton || Button == EKeys::MiddleMouseButton);

		if(bIsCefSupportedButton)
		{
		CefBrowserHost::MouseButtonType Type =
			(Button == EKeys::LeftMouseButton ? MBT_LEFT : (
			Button == EKeys::RightMouseButton ? MBT_RIGHT : MBT_MIDDLE));

		CefMouseEvent Event = GetCefMouseEvent(MyGeometry, MouseEvent, bIsPopup);
		InternalCefBrowser->GetHost()->SendMouseClickEvent(Event, Type, true, 1);
			Reply = FReply::Handled();
		}
		else if(Button == EKeys::ThumbMouseButton && bThumbMouseButtonNavigation)
		{
			if(CanGoBack())
			{
				GoBack();
				Reply = FReply::Handled();
			}

		}
		else if(Button == EKeys::ThumbMouseButton2 && bThumbMouseButtonNavigation)
		{
			if(CanGoForward())
			{
				GoForward();
				Reply = FReply::Handled();
			}

		}
	}
	return Reply;
}