本文整理汇总了C++中ExtensionString::size方法的典型用法代码示例。如果您正苦于以下问题:C++ ExtensionString::size方法的具体用法?C++ ExtensionString::size怎么用?C++ ExtensionString::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtensionString
的用法示例。
在下文中一共展示了ExtensionString::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fixupKey
//Replace keyStroke with replaceString
bool fixupKey(ExtensionString& key, ExtensionString keyStroke, ExtensionString replaceString)
{
size_t idx = key.find(keyStroke, 0);
if (idx != ExtensionString::npos) {
key = key.replace(idx, keyStroke.size(), replaceString);
return true;
}
return false;
}
示例2: PopupWndProc
//BRACKETS: added so our popup windows can have a menu bar too
//
// FUNCTION: PopupWndProc(HWND, UINT, WPARAM, LPARAM)
//
// PURPOSE: Handle commands from the menus.
LRESULT CALLBACK PopupWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
//For now, we are only interest in WM_COMMAND's that we know are in our menus
//and WM_CLOSE so we can delegate that back to the browser
CefRefPtr<CefBrowser> browser = ClientHandler::GetBrowserForNativeWindow(hWnd);
switch (message)
{
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
int wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_CLOSE:
if (g_handler.get() && browser.get()) {
HWND browserHwnd = browser->GetHost()->GetWindowHandle();
HANDLE closing = GetProp(browserHwnd, CLOSING_PROP);
if (closing) {
RemoveProp(browserHwnd, CLOSING_PROP);
break;
}
CefRefPtr<CommandCallback> callback = new CloseWindowCommandCallback(browser);
g_handler->SendJSCommand(browser, FILE_CLOSE_WINDOW, callback);
}
return 0;
default:
ExtensionString commandId = NativeMenuModel::getInstance(getMenuParent(browser)).getCommandId(wmId);
if (commandId.size() > 0) {
CefRefPtr<CommandCallback> callback = new EditCommandCallback(browser, commandId);
g_handler->SendJSCommand(browser, commandId, callback);
}
}
}
break;
case WM_CLOSE:
if (g_handler.get() && browser.get()) {
HWND browserHwnd = browser->GetHost()->GetWindowHandle();
HANDLE closing = GetProp(browserHwnd, CLOSING_PROP);
if (closing) {
RemoveProp(browserHwnd, CLOSING_PROP);
break;
}
CefRefPtr<CommandCallback> callback = new CloseWindowCommandCallback(browser);
g_handler->SendJSCommand(browser, FILE_CLOSE_WINDOW, callback);
return 0;
}
break;
case WM_DROPFILES:
if (g_handler.get() && browser.get()) {
return HandleDropFiles((HDROP)wParam, g_handler, browser);
}
break;
case WM_INITMENUPOPUP:
HMENU menu = (HMENU)wParam;
int count = GetMenuItemCount(menu);
void* menuParent = getMenuParent(browser);
for (int i = 0; i < count; i++) {
UINT id = GetMenuItemID(menu, i);
bool enabled = NativeMenuModel::getInstance(menuParent).isMenuItemEnabled(id);
UINT flagEnabled = enabled ? MF_ENABLED | MF_BYCOMMAND : MF_DISABLED | MF_BYCOMMAND;
EnableMenuItem(menu, id, flagEnabled);
bool checked = NativeMenuModel::getInstance(menuParent).isMenuItemChecked(id);
UINT flagChecked = checked ? MF_CHECKED | MF_BYCOMMAND : MF_UNCHECKED | MF_BYCOMMAND;
CheckMenuItem(menu, id, flagChecked);
}
break;
}
if (g_popupWndOldProc)
return (LRESULT)::CallWindowProc(g_popupWndOldProc, hWnd, message, wParam, lParam);
return ::DefWindowProc(hWnd, message, wParam, lParam);
}
示例3: WndProc
//.........这里部分代码省略.........
ss << L"File \"" <<
std::wstring(CefString(g_handler->GetLastDownloadFile())) <<
L"\" ";
if (wmId == ID_WARN_DOWNLOADCOMPLETE)
ss << L"downloaded successfully.";
else
ss << L"failed to download.";
MessageBox(hWnd, ss.str().c_str(), L"File Download",
MB_OK | MB_ICONINFORMATION);
}
return 0;
#ifdef SHOW_TOOLBAR_UI
case IDC_NAV_BACK: // Back button
if (browser.get())
browser->GoBack();
return 0;
case IDC_NAV_FORWARD: // Forward button
if (browser.get())
browser->GoForward();
return 0;
case IDC_NAV_RELOAD: // Reload button
if (browser.get())
browser->Reload();
return 0;
case IDC_NAV_STOP: // Stop button
if (browser.get())
browser->StopLoad();
return 0;
#endif // SHOW_TOOLBAR_UI
default:
ExtensionString commandId = NativeMenuModel::getInstance(getMenuParent(g_handler->GetBrowser())).getCommandId(wmId);
if (commandId.size() > 0) {
CefRefPtr<CommandCallback> callback = new EditCommandCallback(g_handler->GetBrowser(), commandId);
g_handler->SendJSCommand(g_handler->GetBrowser(), commandId, callback);
}
}
break;
}
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
return 0;
case WM_SETFOCUS:
if (g_handler.get() && g_handler->GetBrowser()) {
// Pass focus to the browser window
CefWindowHandle hwnd =
g_handler->GetBrowser()->GetHost()->GetWindowHandle();
if (hwnd)
PostMessage(hwnd, WM_SETFOCUS, wParam, NULL);
}
return 0;
case WM_SIZE:
// Minimizing resizes the window to 0x0 which causes our layout to go all
// screwy, so we just ignore it.
if (wParam != SIZE_MINIMIZED && g_handler.get() &&
g_handler->GetBrowser()) {
CefWindowHandle hwnd =
g_handler->GetBrowser()->GetHost()->GetWindowHandle();
if (hwnd) {
// Resize the browser window and address bar to match the new frame
// window size