本文整理汇总了C++中NativeWindow::Emit方法的典型用法代码示例。如果您正苦于以下问题:C++ NativeWindow::Emit方法的具体用法?C++ NativeWindow::Emit怎么用?C++ NativeWindow::Emit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NativeWindow
的用法示例。
在下文中一共展示了NativeWindow::Emit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnAfterCreated
void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
REQUIRE_UI_THREAD();
AutoLock lock_scope(this);
if (!browser->IsPopup()) {
if (!mainBrowserHandle.get()) {
mainBrowserHandle = browser;
}
windowCount++;
NativeWindow* window = NativeWindow::GetWindow(browser);
window->SetBrowser(browser);
window->Emit("create");
}
}
示例2: WndProc
// Processes messages for the main window.
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
NativeWindow* window = NativeWindow::GetWindow(hwnd);
CefRefPtr<CefBrowser> browser;
if (window) {
browser = window->GetBrowser();
}
switch (message) {
case WM_CREATE: {
RECT rect;
GetClientRect(hwnd, &rect);
Cef::AddWebView(hwnd, rect, url_, browserSettings);
return 0;
}
case WM_PAINT: {
PAINTSTRUCT ps;
HDC hdc;
hdc = BeginPaint(hwnd, &ps);
EndPaint(hwnd, &ps);
return 0;
}
case WM_SETFOCUS:
if (browser.get()) {
PostMessage(browser->GetWindowHandle(), WM_SETFOCUS, wParam, NULL);
return 0;
}
case WM_SIZE: {
window->UpdatePosition();
if (browser.get()) {
RECT rect;
GetClientRect(hwnd, &rect);
HDWP hdwp = BeginDeferWindowPos(1);
hdwp = DeferWindowPos(hdwp, browser->GetWindowHandle(), NULL,
rect.left, rect.top, rect.right - rect.left,
rect.bottom - rect.top, SWP_NOZORDER);
EndDeferWindowPos(hdwp);
if (emitFullscreen) {
emitFullscreen = false;
window->Emit("fullscreen");
} else {
window->Emit("resize", (int)LOWORD(lParam), (int)HIWORD(lParam));
}
}
break;
}
case WM_WINDOWPOSCHANGING: {
WINDOWPOS *position;
position = (WINDOWPOS*)lParam;
if (position->flags & SWP_STATECHANGED) {
if (IsIconic(window->handle_)) {
window->Emit("minimize");
} else if (IsZoomed(window->handle_)) {
window->Emit("maximize");
} else {
window->Emit("restore");
}
}
break;
}
case WM_MOVE:
window->UpdatePosition();
if (browser.get()) {
window->Emit("move", (int)LOWORD(lParam), (int)HIWORD(lParam));
}
break;
case WM_NCHITTEST: {
LRESULT result;
if (DwmDefWindowProc != NULL) {
if (DwmDefWindowProc(hwnd, message, wParam, lParam, &result)) {
return result;
}
}
break;
}
case WM_ERASEBKGND:
if (browser.get()) {
return 0;
}
break;
case WM_CLOSE:
if (browser.get()) {
browser->ParentWindowWillClose();
}
break;
//case WM_DESTROY:
// PostQuitMessage(0);
}
return DefWindowProc(hwnd, message, wParam, lParam);
}