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


C++ ExtensionString::size方法代码示例

本文整理汇总了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;
}
开发者ID:116356754,项目名称:brackets-shell,代码行数:10,代码来源:appshell_extensions.cpp

示例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);
}
开发者ID:MagnusNordin,项目名称:brackets-shell,代码行数:86,代码来源:client_handler_win.cpp

示例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
开发者ID:DennisKehrig,项目名称:brackets-shell,代码行数:67,代码来源:cefclient_win.cpp


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