CefMenuButtonDelegate
Header: cef_menu_button_delegate.h
Interfaces: CefMenuButtonPressedLock, CefMenuButtonDelegate
Category: Views Framework
Overview
Browser-process UI toolkit: windows, panels, layouts, buttons, textfields, and their delegates.
CefMenuButtonPressedLock
Source File: include/views/cef_menu_button_delegate.h
Process / Thread Context: Browser Process / UI Thread.
Purpose: A small ref-counted token. When destroyed, the menu button
Usage Example
cpp
// Inside OnMenuButtonPressed, store the lock in a member so the button stays
// "pressed" until the popup is hidden.
class MyMenuBtnDelegate : public CefMenuButtonDelegate {
CefRefPtr<CefMenuButtonPressedLock> lock_;
public:
void OnMenuButtonPressed(CefRefPtr<CefMenuButton> btn,
const CefPoint& pt,
CefRefPtr<CefMenuButtonPressedLock> l) override {
lock_ = l;
btn->ShowMenu(menu_, pt, CEF_MENU_ANCHOR_TOPLEFT);
}
void OnPopupHidden() { lock_ = nullptr; } // releases the lock
};CefMenuButtonDelegate
Source File: include/views/cef_menu_button_delegate.h
Process / Thread Context: Browser Process / UI Thread.
Purpose: Client-implemented delegate for MenuButton press events.
Methods
virtual void OnMenuButtonPressed(CefRefPtr<CefMenuButton> menu_button, const CefPoint& screen_point, CefRefPtr<CefMenuButtonPressedLock> button_pressed_lock) = 0
Parameters:
menu_button: The button that was pressed.screen_point: Suggested menu position in screen coordinates (typicallybutton_pressed_lock: Hold a reference to keep the button visually
Return Value: void.
Usage Instruction: Pure virtual — must be implemented. Call
Threading Constraint: Browser process UI thread.