本文整理汇总了C++中CefRefPtr::GetFocusedFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ CefRefPtr::GetFocusedFrame方法的具体用法?C++ CefRefPtr::GetFocusedFrame怎么用?C++ CefRefPtr::GetFocusedFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CefRefPtr
的用法示例。
在下文中一共展示了CefRefPtr::GetFocusedFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowDevTools
bool FWebBrowserHandler::ShowDevTools(const CefRefPtr<CefBrowser>& Browser)
{
CefPoint Point;
CefString TargetUrl = "chrome-devtools://devtools/devtools.html";
CefString TargetFrameName = "devtools";
CefPopupFeatures PopupFeatures;
CefWindowInfo WindowInfo;
CefRefPtr<CefClient> NewClient;
CefBrowserSettings BrowserSettings;
bool NoJavascriptAccess = false;
PopupFeatures.xSet = false;
PopupFeatures.ySet = false;
PopupFeatures.heightSet = false;
PopupFeatures.widthSet = false;
PopupFeatures.locationBarVisible = false;
PopupFeatures.menuBarVisible = false;
PopupFeatures.toolBarVisible = false;
PopupFeatures.statusBarVisible = false;
PopupFeatures.resizable = true;
PopupFeatures.additionalFeatures = cef_string_list_alloc();
// Override the parent window setting for transparency, as the Dev Tools require a solid background
CefString OverrideTransparencyFeature = "Epic_NoTransparency";
cef_string_list_append(PopupFeatures.additionalFeatures, OverrideTransparencyFeature.GetStruct());
// Set max framerate to maximum supported.
BrowserSettings.windowless_frame_rate = 60;
// Disable plugins
BrowserSettings.plugins = STATE_DISABLED;
// Dev Tools look best with a white background color
BrowserSettings.background_color = CefColorSetARGB(255, 255, 255, 255);
// OnBeforePopup already takes care of all the details required to ask the host application to create a new browser window.
bool bSuppressWindowCreation = OnBeforePopup(Browser, Browser->GetFocusedFrame(), TargetUrl, TargetFrameName, PopupFeatures, WindowInfo, NewClient, BrowserSettings, &NoJavascriptAccess);
if(! bSuppressWindowCreation)
{
Browser->GetHost()->ShowDevTools(WindowInfo, NewClient, BrowserSettings, Point);
}
return !bSuppressWindowCreation;
}
示例2: OnKeyEvent
bool FWebBrowserHandler::OnKeyEvent(CefRefPtr<CefBrowser> Browser,
const CefKeyEvent& Event,
CefEventHandle OsEvent)
{
#if UE_BUILD_DEBUG
// Show dev tools on CMD/CTRL+ALT+I
if( (Event.type == KEYEVENT_RAWKEYDOWN || Event.type == KEYEVENT_KEYDOWN) &&
#if PLATFORM_MAC
(Event.modifiers == (EVENTFLAG_COMMAND_DOWN | EVENTFLAG_SHIFT_DOWN)) &&
#else
(Event.modifiers == (EVENTFLAG_CONTROL_DOWN | EVENTFLAG_SHIFT_DOWN)) &&
#endif
(Event.unmodified_character == 'i' || Event.unmodified_character == 'I')
)
{
return ShowDevTools(Browser);
}
#endif
#if PLATFORM_MAC
// We need to handle standard Copy/Paste/etc... shortcuts on OS X
if( (Event.type == KEYEVENT_RAWKEYDOWN || Event.type == KEYEVENT_KEYDOWN) &&
(Event.modifiers & EVENTFLAG_COMMAND_DOWN) != 0 &&
(Event.modifiers & EVENTFLAG_CONTROL_DOWN) == 0 &&
(Event.modifiers & EVENTFLAG_ALT_DOWN) == 0 &&
( (Event.modifiers & EVENTFLAG_SHIFT_DOWN) == 0 || Event.unmodified_character == 'z' )
)
{
CefRefPtr<CefFrame> Frame = Browser->GetFocusedFrame();
if (Frame)
{
switch (Event.unmodified_character)
{
case 'a':
Frame->SelectAll();
return true;
case 'c':
Frame->Copy();
return true;
case 'v':
Frame->Paste();
return true;
case 'x':
Frame->Cut();
return true;
case 'z':
if( (Event.modifiers & EVENTFLAG_SHIFT_DOWN) == 0 )
{
Frame->Undo();
}
else
{
Frame->Redo();
}
return true;
}
}
}
#endif
TSharedPtr<FWebBrowserWindow> BrowserWindow = BrowserWindowPtr.Pin();
if (BrowserWindow.IsValid())
{
return BrowserWindow->OnUnhandledKeyEvent(Event);
}
return false;
}