本文整理汇总了C++中CClientWebBrowser类的典型用法代码示例。如果您正苦于以下问题:C++ CClientWebBrowser类的具体用法?C++ CClientWebBrowser怎么用?C++ CClientWebBrowser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CClientWebBrowser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetBrowserVolume
int CLuaFunctionDefs::SetBrowserVolume ( lua_State* luaVM )
{
// bool setBrowserVolume ( float volume )
// bool setBrowserVolume ( browser webBrowser, float volume )
CClientWebBrowser* pWebBrowser; float fVolume;
CScriptArgReader argStream ( luaVM );
if ( argStream.NextIsNumber () )
{
argStream.ReadNumber ( fVolume );
lua_pushboolean ( luaVM, g_pCore->GetWebCore ()->SetGlobalAudioVolume ( fVolume ) );
return 1;
}
argStream.ReadUserData ( pWebBrowser );
argStream.ReadNumber ( fVolume );
if ( !argStream.HasErrors () )
{
lua_pushboolean ( luaVM, pWebBrowser->SetAudioVolume ( fVolume ) );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例2: ToggleBrowserDevTools
int CLuaFunctionDefs::ToggleBrowserDevTools ( lua_State* luaVM )
{
// bool toggleBrowserDevTools ( browser webBrowser, bool visible )
CClientWebBrowser* pWebBrowser; bool visible;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
argStream.ReadBool ( visible );
if ( !argStream.HasErrors () )
{
if ( g_pCore->GetWebCore ()->IsTestModeEnabled () )
{
lua_pushboolean ( luaVM, pWebBrowser->ToggleDevTools ( visible ) );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, "toggleBrowserDevtools can only be used in development mode" );
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例3: FocusBrowser
int CLuaFunctionDefs::FocusBrowser ( lua_State* luaVM )
{
// focusBrowser ( browser webBrowser )
CClientWebBrowser* pWebBrowser;
CScriptArgReader argStream ( luaVM );
if ( argStream.NextIsNil () || argStream.NextIsNone () )
{
g_pCore->GetWebCore ()->SetFocusedWebView ( NULL );
lua_pushboolean ( luaVM, true );
return 1;
}
argStream.ReadUserData ( pWebBrowser );
if ( !argStream.HasErrors () )
{
pWebBrowser->Focus ();
lua_pushboolean ( luaVM, true );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例4: ExecuteBrowserJavascript
int CLuaFunctionDefs::ExecuteBrowserJavascript ( lua_State* luaVM )
{
// bool executeBrowserJavascript ( browser webBrowser, string jsCode )
CClientWebBrowser* pWebBrowser; SString strJavascriptCode;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
argStream.ReadString ( strJavascriptCode );
if ( !argStream.HasErrors () )
{
if ( pWebBrowser->ExecuteJavascript ( strJavascriptCode ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
else
argStream.SetCustomError ( "This function does not work with remote browsers" );
}
if ( argStream.HasErrors () )
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例5: LoadBrowserURL
int CLuaFunctionDefs::LoadBrowserURL ( lua_State* luaVM )
{
// bool loadBrowserURL ( browser webBrowser, string url [, string postData = "", bool postURLEncoded = true ] )
CClientWebBrowser* pWebBrowser; SString strURL; SString strPostData; bool bURLEncoded;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
argStream.ReadString ( strURL );
argStream.ReadString ( strPostData, "" );
argStream.ReadBool ( bURLEncoded, true );
if ( !argStream.HasErrors () )
{
// Are we dealing with a remote website?
if ( strURL.substr ( 0, 7 ) == "http://" || strURL.substr ( 0, 8 ) == "https://" )
{
bool isLocalURL = strURL.substr ( 0, 11 ) == "http://mta/";
if ( pWebBrowser->IsLocal () != isLocalURL )
{
lua_pushboolean ( luaVM, false );
return 1;
}
lua_pushboolean ( luaVM, pWebBrowser->LoadURL ( strURL, !isLocalURL, strPostData, bURLEncoded ) );
return 1;
}
// Are we dealing with a local website? If so, parse resource path. Otherwise, return false and load nothing
// Todo: Add an ACL right which is necessary to load local websites or websites in general
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
SString strAbsPath;
CResource* pResource = pLuaMain->GetResource ();
if ( CResourceManager::ParseResourcePathInput ( strURL, pResource, strAbsPath ) && pWebBrowser->IsLocal () )
{
// Output deprecated warning, TODO: Remove this at a later point
m_pScriptDebugging->LogWarning ( luaVM, "This URL scheme is deprecated and may not work in future versions. Please consider using http://mta/* instead. See https://wiki.mtasa.com/wiki/LoadBrowserURL for details" );
lua_pushboolean ( luaVM, pWebBrowser->LoadURL ( "mtalocal://" + strURL, false, strPostData, bURLEncoded ) );
return 1;
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例6: GetBrowserVolume
int CLuaFunctionDefs::GetBrowserVolume ( lua_State* luaVM )
{
// float getBrowserVolume ( browser webBrowser )
CClientWebBrowser* pWebBrowser;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
if ( !argStream.HasErrors () )
{
lua_pushnumber ( luaVM, pWebBrowser->GetAudioVolume () );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例7: IsBrowserLoading
int CLuaFunctionDefs::IsBrowserLoading ( lua_State* luaVM )
{
// bool isBrowserLoading(browser webBrowser)
CClientWebBrowser* pWebBrowser;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
if ( !argStream.HasErrors () )
{
lua_pushboolean ( luaVM, pWebBrowser->IsLoading () );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushnil ( luaVM );
return 1;
}
示例8: argStream
int CLuaFunctionDefs::CreateBrowser ( lua_State* luaVM )
{
// texture createBrowser ( int width, int height, bool isLocal [, bool transparent = false] )
CVector2D vecSize; bool bIsLocal; bool bTransparent;
CScriptArgReader argStream ( luaVM );
argStream.ReadVector2D ( vecSize );
argStream.ReadBool ( bIsLocal );
argStream.ReadBool ( bTransparent, false );
if ( !argStream.HasErrors () )
{
if ( !bIsLocal && !g_pCore->GetWebCore()->GetRemotePagesEnabled () )
{
lua_pushboolean ( luaVM, false );
return 1;
}
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
CResource* pParentResource = pLuaMain->GetResource ();
CClientWebBrowser* pBrowserTexture = g_pClientGame->GetManager ()->GetRenderElementManager ()->CreateWebBrowser ( (int)vecSize.fX, (int)vecSize.fY, bIsLocal, bTransparent );
if ( pBrowserTexture )
{
// Make it a child of the resource's file root ** CHECK Should parent be pFileResource, and element added to pParentResource's ElementGroup? **
pBrowserTexture->SetParent ( pParentResource->GetResourceDynamicEntity () );
// Set our owner resource
pBrowserTexture->SetResource ( pParentResource );
}
lua_pushelement ( luaVM, pBrowserTexture );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例9: IsBrowserFocused
int CLuaFunctionDefs::IsBrowserFocused ( lua_State* luaVM )
{
// browser isBrowserFocused ()
CClientWebBrowser* pWebBrowser;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
if ( !argStream.HasErrors () )
{
CWebViewInterface* pWebView = g_pCore->GetWebCore ()->GetFocusedWebView ();
lua_pushboolean ( luaVM, pWebBrowser->GetWebView () == pWebView );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );
lua_pushnil ( luaVM );
return 1;
}
示例10: LoadBrowserURL
int CLuaFunctionDefs::LoadBrowserURL ( lua_State* luaVM )
{
// bool loadBrowserURL ( browser webBrowser, string url [, string postData = "", bool postURLEncoded = true ] )
CClientWebBrowser* pWebBrowser; SString strURL; SString strPostData; bool bURLEncoded;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
argStream.ReadString ( strURL );
argStream.ReadString ( strPostData, "" );
argStream.ReadBool ( bURLEncoded, true );
if ( !argStream.HasErrors () )
{
// Are we dealing with a remote website?
if ( strURL.substr ( 0, 7 ) == "http://" || strURL.substr ( 0, 8 ) == "https://" )
{
lua_pushboolean ( luaVM, pWebBrowser->LoadURL ( strURL, true, strPostData, bURLEncoded ) );
return 1;
}
// Are we dealing with a local website? If so, parse resource path. Otherwise, return false and load nothing
// Todo: Add an ACL right which is necessary to load local websites or websites in general
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
SString strAbsPath;
CResource* pResource = pLuaMain->GetResource ();
if ( CResourceManager::ParseResourcePathInput ( strURL, pResource, strAbsPath ) && pWebBrowser->IsLocal () )
{
pWebBrowser->SetTempURL ( strURL );
lua_pushboolean ( luaVM, pWebBrowser->LoadURL ( "mtalocal://" + strURL, false, strPostData, bURLEncoded ) );
return 1;
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例11: SetBrowserRenderingPaused
int CLuaFunctionDefs::SetBrowserRenderingPaused ( lua_State* luaVM )
{
// bool setBrowserRenderingPaused ( browser webBrowser, bool paused )
CClientWebBrowser* pWebBrowser; bool bPaused;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
argStream.ReadBool ( bPaused );
if ( !argStream.HasErrors () )
{
pWebBrowser->SetRenderingPaused ( bPaused );
lua_pushboolean ( luaVM, true );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例12: InjectBrowserMouseMove
int CLuaFunctionDefs::InjectBrowserMouseMove ( lua_State* luaVM )
{
// bool injectBrowserMouseMove(browser webBrowser, int x, int y)
CClientWebBrowser* pWebBrowser; CVector2D vecPosition;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
argStream.ReadVector2D ( vecPosition );
if ( !argStream.HasErrors () )
{
pWebBrowser->InjectMouseMove ( (int)vecPosition.fX, (int)vecPosition.fY );
lua_pushboolean ( luaVM, true );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例13: InjectBrowserMouseUp
int CLuaFunctionDefs::InjectBrowserMouseUp ( lua_State* luaVM )
{
// bool injectBrowserMouseUp ( browser webBrowser, string mouseButton )
CClientWebBrowser* pWebBrowser; eWebBrowserMouseButton mouseButton;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
argStream.ReadEnumString ( mouseButton );
if ( !argStream.HasErrors () )
{
pWebBrowser->InjectMouseUp ( mouseButton );
lua_pushboolean ( luaVM, true );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例14: GetBrowserSource
int CLuaFunctionDefs::GetBrowserSource ( lua_State* luaVM )
{
// bool getBrowserSource ( function callback )
CClientWebBrowser* pWebBrowser; CLuaFunctionRef callbackFunction;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
argStream.ReadFunction ( callbackFunction );
argStream.ReadFunctionComplete ();
if ( !argStream.HasErrors () )
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain && VERIFY_FUNCTION ( callbackFunction ) )
{
pWebBrowser->GetSourceCode ( [callbackFunction, pLuaMain]( const std::string& code ) {
/*
This function should not be called when the resource is about to stop as
stopping the resource destroys the browser element and thus cancels the
CefStringVisitor callback class (see CWebView::GetSourceCode::MyStringVisitor)
*/
if ( VERIFY_FUNCTION ( callbackFunction ) )
{
CLuaArguments arguments;
// TODO: Use SCharStringRef/direct string access instead of copying strings around
arguments.PushString ( code );
arguments.Call ( pLuaMain, callbackFunction );
}
});
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例15: InjectBrowserMouseWheel
int CLuaFunctionDefs::InjectBrowserMouseWheel ( lua_State* luaVM )
{
// bool injectMouseWheel ( browser webBrowser, int scrollVertical, int scrollHorizontal )
CClientWebBrowser* pWebBrowser; int iScrollVert; int iScrollHorz;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWebBrowser );
argStream.ReadNumber ( iScrollVert );
argStream.ReadNumber ( iScrollHorz );
if ( !argStream.HasErrors() )
{
pWebBrowser->InjectMouseWheel ( iScrollVert, iScrollHorz );
lua_pushboolean ( luaVM, true );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}