转载:
转载:
转载:
cef如何禁用右键属性:
让自己的MyClientHandler来继承 CefContextMenuHandler这个抽象类,然对其下面的纯虚函数进行重写
1.获得事件处理器
virtual CefRefPtrGetContextMenuHandler() { return this;}
2. 重写CefContextMenuHandler 的方法
void OnBeforeContextMenu(CefRefPtrbrowser, CefRefPtr frame, CefRefPtr params, CefRefPtr model) OVERRIDE;
实现
void MyClientHandler::OnBeforeContextMenu( CefRefPtr browser, CefRefPtr frame, CefRefPtr params, CefRefPtr model) { if ((params->GetTypeFlags() & (CM_TYPEFLAG_PAGE | CM_TYPEFLAG_FRAME)) != 0) { // Add a separator if the menu already has items. if (model->GetCount() > 0){ model->Clear();//model->AddSeparator();} }}