class MyApp : public CefApp, public CefRenderProcessHandler, public CefBrowserProcessHandler
CefContextMenuHandler::OnBeforeContextMenu
class MyApp : public CefApp, public CefRenderProcessHandler, public CefBrowserProcessHandler, public CefContextMenuHandler
virtual bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
int command_id,
EventFlags event_flags) OVERRIDE;
virtual void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model) OVERRIDE;
bool MyApp::OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
int command_id,
EventFlags event_flags)
{
if(command_id == MENU_ID_VIEW_SOURCE)
return true;
return false;
}
void MyApp::OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model)
{
model->Remove(MENU_ID_VIEW_SOURCE); //tried also Clear() and RemoveAt(3)
return;
}
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() OVERRIDE;
model_->AddItem(MENU_ID_VIEW_SOURCE, GetLabel(IDS_MENU_VIEW_SOURCE));
CefContextMenuHandler::OnBeforeContextMenu
class MyApp : public CefApp, public CefRenderProcessHandler, public CefBrowserProcessHandler
lkitrossky wrote:But our main class is not derived from CefClient. So, is there some other way to do it still?
void ClientHandler::OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model) {
CEF_REQUIRE_UI_THREAD();
model->Clear();
...
Users browsing this forum: Google [Bot] and 102 guests