当前位置: 首页>>代码示例>>C++>>正文


C++ CefWindowInfo::SetAsOffScreen方法代码示例

本文整理汇总了C++中CefWindowInfo::SetAsOffScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ CefWindowInfo::SetAsOffScreen方法的具体用法?C++ CefWindowInfo::SetAsOffScreen怎么用?C++ CefWindowInfo::SetAsOffScreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CefWindowInfo的用法示例。


在下文中一共展示了CefWindowInfo::SetAsOffScreen方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: NewWindow

TSharedPtr<IWebBrowserWindow> FWebBrowserSingleton::CreateBrowserWindow(void* OSWindowHandle, FString InitialURL, uint32 Width, uint32 Height, bool bUseTransparency, TOptional<FString> ContentsToLoad, bool ShowErrorMessage)
{
#if WITH_CEF3
	// Create new window
	TSharedPtr<FWebBrowserWindow> NewWindow(new FWebBrowserWindow(FIntPoint(Width, Height), InitialURL, ContentsToLoad, ShowErrorMessage));

	// WebBrowserHandler implements browser-level callbacks.
	CefRefPtr<FWebBrowserHandler> NewHandler(new FWebBrowserHandler);
	NewWindow->SetHandler(NewHandler);

	// Information used when creating the native window.
	CefWindowHandle WindowHandle = (CefWindowHandle)OSWindowHandle; // TODO: check this is correct for all platforms
	CefWindowInfo WindowInfo;

	// Always use off screen rendering so we can integrate with our windows
	WindowInfo.SetAsOffScreen(WindowHandle);
	WindowInfo.SetTransparentPainting(bUseTransparency);

	// Specify CEF browser settings here.
	CefBrowserSettings BrowserSettings;

	CefString URL = *InitialURL;

	// Create the CEF browser window.
	if (CefBrowserHost::CreateBrowser(WindowInfo, NewHandler.get(), URL, BrowserSettings, NULL))
	{
		WindowInterfaces.Add(NewWindow);
		return NewWindow;
	}
#endif
	return NULL;
}
开发者ID:johndpope,项目名称:UE4,代码行数:32,代码来源:WebBrowserSingleton.cpp

示例2: NPP_SetWindowImpl

NPError NPP_SetWindowImpl(NPP instance, NPWindow* window_info) {
  if (instance == NULL)
    return NPERR_INVALID_INSTANCE_ERROR;

  if (window_info == NULL)
    return NPERR_GENERIC_ERROR;

  ClientPlugin* plugin = reinterpret_cast<ClientPlugin*>(instance->pdata);
  HWND parent_hwnd = reinterpret_cast<HWND>(window_info->window);

  if (plugin->hWnd == NULL) {
    WNDCLASS wc;
    HINSTANCE hInstance = GetModuleHandle(NULL);

    // Register the window class.
    wc.style = CS_OWNDC;
    wc.lpfnWndProc = PluginWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = L"ClientOSRPlugin";
    RegisterClass(&wc);

    // Create the main window.
    plugin->hWnd = CreateWindow(L"ClientOSRPlugin", L"Client OSR Plugin",
        WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, 0, 0, 0, 0, parent_hwnd, NULL,
        hInstance, NULL);

    SetWindowLongPtr(plugin->hWnd, GWLP_USERDATA,
        reinterpret_cast<LONG_PTR>(plugin));

    // Enable GL drawing for the window.
    EnableGL(plugin->hWnd, &(plugin->hDC), &(plugin->hRC));

    // Create the off-screen rendering window.
    CefWindowInfo windowInfo;
    CefBrowserSettings settings;
    windowInfo.SetAsOffScreen(plugin->hWnd);
    if (g_offscreenTransparent)
      windowInfo.SetTransparentPainting(TRUE);
    CefBrowser::CreateBrowser(windowInfo, new ClientOSRHandler(plugin),
        "http://www.google.com", settings);
  }

  // Position the plugin window and make sure it's visible.
  RECT parent_rect;
  GetClientRect(parent_hwnd, &parent_rect);
  SetWindowPos(plugin->hWnd, NULL, parent_rect.left, parent_rect.top,
      parent_rect.right - parent_rect.left,
      parent_rect.bottom - parent_rect.top, SWP_SHOWWINDOW);

  UpdateWindow(plugin->hWnd);
  ShowWindow(plugin->hWnd, SW_SHOW);

  return NPERR_NO_ERROR;
}
开发者ID:AlloyTeam,项目名称:webtop,代码行数:60,代码来源:osrplugin.cpp

示例3: Create

bool WindowlessBoltBrowser::Create( HWND hHostWnd )
{
	assert(hHostWnd);
	assert(::IsWindow(hHostWnd));

	CefWindowInfo info;
	info.SetAsOffScreen(hHostWnd);
	info.SetTransparentPainting(m_transparent? TRUE : FALSE);
	
	return BaseBoltBrowser::Create(info);
}
开发者ID:FlowShell,项目名称:BXF,代码行数:11,代码来源:WindowlessBoltBrowser.cpp

示例4: ClientAppCreateBrowser

CefRefPtr< CefBrowser > ClientAppCreateBrowser(std::shared_ptr<ofxCEFBrowser> ofx, std::string startResource) {
	// OSR Browser =======================================================
	CefBrowserSettings settings;

	// Create the single static handler class instance
	HWND hWnd = WindowFromDC(wglGetCurrentDC());
	
	CefWindowInfo info;
	info.width = ofx->getWidth();
	info.height = ofx->getHeight();
	info.SetAsOffScreen(hWnd);
	info.SetTransparentPainting(true);
	//info.SetAsChild(hWnd, rect); 
	//info.SetAsPopup(hWnd, "hehe"); 

	// Create the new child browser window using an offscreen window
	auto browser =  CefBrowserHost::CreateBrowserSync(info, ofx->getClientHandler().get(), CefString(startResource), settings);

	return browser;
}
开发者ID:dublet,项目名称:ofxCEFClient,代码行数:20,代码来源:client_win.cpp

示例5: initBrowser

void BrowserClient::initBrowser(const std::string& url)
{
    //Setup our main view that will show the cef ui
    setupMainView( _width, _height );
    _viewer->addView( _mainView );

    {
        CefWindowInfo windowInfo;
        CefBrowserSettings browserSettings;

        // in linux set a gtk widget, in windows a hwnd. If not available set nullptr - may cause some render errors, in context-menu and plugins.
        windowInfo.SetAsOffScreen(0L);
        windowInfo.SetTransparentPainting(true);
        //windowInfo.SetAsWindowless(0L, true);

        _browser = CefBrowserHost::CreateBrowserSync(windowInfo, this, url.c_str(), browserSettings, 0L);
        _browser->GetHost()->SendFocusEvent(true);
    }

    addExecuteCallback(new MapExecuteCallback(this));
    _mainView->addEventHandler(new BrowserEventHandler(_mainView.get(), this, _browser));
}
开发者ID:remoe,项目名称:osgearth-cef,代码行数:22,代码来源:BrowserClient.cpp

示例6: WndProc


//.........这里部分代码省略.........
                              WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
                              | WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
                              hWnd, (HMENU) IDC_NAV_STOP, hInst, 0);
      x += BUTTON_WIDTH;

      editWnd = CreateWindow(L"EDIT", 0,
                              WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
                              ES_AUTOVSCROLL | ES_AUTOHSCROLL| WS_DISABLED,
                              x, 0, rect.right - BUTTON_WIDTH * 4,
                              URLBAR_HEIGHT, hWnd, 0, hInst, 0);

      // Assign the edit window's WNDPROC to this function so that we can
      // capture the enter key
      editWndOldProc =
          reinterpret_cast<WNDPROC>(GetWindowLongPtr(editWnd, GWLP_WNDPROC));
      SetWindowLongPtr(editWnd, GWLP_WNDPROC,
          reinterpret_cast<LONG_PTR>(WndProc));
      g_handler->SetEditHwnd(editWnd);
      g_handler->SetButtonHwnds(backWnd, forwardWnd, reloadWnd, stopWnd);

      rect.top += URLBAR_HEIGHT;

      CefWindowInfo info;
      CefBrowserSettings settings;

      if (AppIsOffScreenRenderingEnabled()) {
        CefRefPtr<CefCommandLine> cmd_line = AppGetCommandLine();
        bool transparent =
            cmd_line->HasSwitch(cefclient::kTransparentPaintingEnabled);

        CefRefPtr<OSRWindow> osr_window =
            OSRWindow::Create(&g_main_browser_provider, transparent);
        osr_window->CreateWidget(hWnd, rect, hInst, szOSRWindowClass);
        info.SetAsOffScreen(osr_window->hwnd());
        info.SetTransparentPainting(transparent ? TRUE : FALSE);
        g_handler->SetOSRHandler(osr_window.get());
      } else {
        // Initialize window info to the defaults for a child window.
        info.SetAsChild(hWnd, rect);
      }

      // Creat the new child browser window
      CefBrowserHost::CreateBrowser(info, g_handler.get(),
          g_handler->GetStartupURL(), settings, NULL);

      return 0;
    }

    case WM_COMMAND: {
      CefRefPtr<CefBrowser> browser;
      if (g_handler.get())
        browser = g_handler->GetBrowser();

      wmId    = LOWORD(wParam);
      wmEvent = HIWORD(wParam);
      // Parse the menu selections:
      switch (wmId) {
      case IDM_ABOUT:
        DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
        return 0;
      case IDM_EXIT:
        if (g_handler.get())
          g_handler->CloseAllBrowsers(false);
        return 0;
      case ID_WARN_CONSOLEMESSAGE:
        if (g_handler.get()) {
开发者ID:johndpope,项目名称:UE4,代码行数:67,代码来源:cefclient_win.cpp


注:本文中的CefWindowInfo::SetAsOffScreen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。