bool FCEFWebBrowserWindow::OnBeforeUnloadDialog(const CefString& MessageText, bool IsReload, CefRefPtr<CefJSDialogCallback> Callback)
{
	bool Retval = false;
	if ( OnShowDialog().IsBound() )
	{
		TSharedPtr<IWebBrowserDialog> Dialog(new FCEFWebBrowserDialog(MessageText, IsReload, Callback));
		EWebBrowserDialogEventResponse EventResponse = OnShowDialog().Execute(TWeakPtr<IWebBrowserDialog>(Dialog));
		switch (EventResponse)
		{
		case EWebBrowserDialogEventResponse::Handled:
			Retval = true;
			break;
		case EWebBrowserDialogEventResponse::Continue:
			Callback->Continue(true, CefString());
			Retval = true;
			break;
		case EWebBrowserDialogEventResponse::Ignore:
			Callback->Continue(false, CefString());
			Retval = true;
			break;
		case EWebBrowserDialogEventResponse::Unhandled:
		default:
			Retval = false;
			break;
		}
	}
	return Retval;
}
Exemplo n.º 2
0
/*-------------------------------------------
  window procedure
---------------------------------------------*/
LRESULT CALLBACK WndProcTimer(HWND hwnd, UINT message,
	WPARAM wParam, LPARAM lParam)
{
	switch(message)
	{
		case WM_CREATE:
			OnCreate(hwnd);
			return 0;
		case WM_DESTROY:
			OnDestroy(hwnd);
			return 0;
		case WM_TIMER:
			switch(wParam)
			{
				case IDTIMER_TIMER:
					OnTimerTimer(hwnd);
					break;
			}
			return 0;
		// show dialog box
		case TIMERM_SHOWDLG:
			OnShowDialog(hwnd);
			return 0;
		// add item to tcmenu*.txt
		case TIMERM_REQUESTMENU:
			OnRequestMenu(hwnd, FALSE);
			return 0;
		// stop running timer
		case TIMERM_STOP:
			OnStopTimer(hwnd, (int)lParam);
			return 0;
	}
	return DefWindowProc(hwnd, message, wParam, lParam);
}
Exemplo n.º 3
0
/*-------------------------------------------
  window procedure
---------------------------------------------*/
LRESULT CALLBACK WndProcPlayer(HWND hwnd, UINT message,
	WPARAM wParam, LPARAM lParam)
{
	switch(message)
	{
		case WM_CREATE:
			OnCreate(hwnd);
			return 0;
		case WM_DESTROY:
			OnDestroy(hwnd);
			return 0;
		case WM_TIMER:
			switch(wParam)
			{
				case IDTIMER_PLAYER:
					OnTimerPlayer(hwnd);
					break;
			}
			return 0;
		// show dialog box
		case PLAYERM_SHOWDLG:
			OnShowDialog(hwnd);
			return 0;
		// add item to tcmenu*.txt
		case PLAYERM_REQUESTMENU:
			OnRequestMenu(hwnd, FALSE);
			return 0;
		case PLAYERM_STOP:
			StopPlayer(hwnd);
			PostMessage(hwnd, WM_CLOSE, 0, 0);
			return 0;
		case PLAYERM_PAUSE:
			PausePlayer(hwnd);
			return 0;
		case PLAYERM_NEXT:
			PrevNextPlayer(hwnd, TRUE);
			return 0;
		case PLAYERM_PREV:
			PrevNextPlayer(hwnd, FALSE);
			return 0;
		
		case MM_MCINOTIFY:
			OnMCINotifyPlayer(hwnd, wParam, (LONG)lParam);
			return 0;
		
		case WM_COPYDATA:
			OnCopyData(hwnd, (HWND)wParam, (COPYDATASTRUCT*)lParam);
			return 0;
	}
	return DefWindowProc(hwnd, message, wParam, lParam);
}
bool FCEFWebBrowserWindow::OnJSDialog(CefJSDialogHandler::JSDialogType DialogType, const CefString& MessageText, const CefString& DefaultPromptText, CefRefPtr<CefJSDialogCallback> Callback, bool& OutSuppressMessage)
{
	bool Retval = false;
	if ( OnShowDialog().IsBound() )
	{
		TSharedPtr<IWebBrowserDialog> Dialog(new FCEFWebBrowserDialog(DialogType, MessageText, DefaultPromptText, Callback));
		EWebBrowserDialogEventResponse EventResponse = OnShowDialog().Execute(TWeakPtr<IWebBrowserDialog>(Dialog));
		switch (EventResponse)
		{
		case EWebBrowserDialogEventResponse::Handled:
			Retval = true;
			break;
		case EWebBrowserDialogEventResponse::Continue:
			if (DialogType == JSDIALOGTYPE_ALERT)
			{
				// Alert dialogs don't return a value, so treat Continue the same way as Ingore
				OutSuppressMessage = true;
				Retval = false;
			}
			else
			{
				Callback->Continue(true, DefaultPromptText);
				Retval = true;
			}
			break;
		case EWebBrowserDialogEventResponse::Ignore:
			OutSuppressMessage = true;
			Retval = false;
			break;
		case EWebBrowserDialogEventResponse::Unhandled:
		default:
			Retval = false;
			break;
		}
	}
	return Retval;
}