Skip to content

CefButtonDelegate

Header: cef_button_delegate.h
Category: Views Framework

Overview

Browser-process UI toolkit: windows, panels, layouts, buttons, textfields, and their delegates.

CefButtonDelegate

Source File: include/views/cef_button_delegate.h

Process / Thread Context: Browser Process / UI Thread.

Purpose: Client-implemented delegate for button events: press and state

Methods

virtual void OnButtonPressed(CefRefPtr<CefButton> button) = 0

Parameters:

  • button: The button that was pressed.

Return Value: void.

Usage Instruction: Pure virtual — must be implemented. This is the

Threading Constraint: Browser process UI thread.

virtual void OnButtonStateChanged(CefRefPtr<CefButton> button)

Parameters:

  • button: The button whose state changed.

Return Value: void.

Usage Instruction: React to state transitions (e.g., update an icon

Threading Constraint: Browser process UI thread.

Usage Example

cpp
class SaveButtonDelegate : public CefButtonDelegate {
 public:
  void OnButtonPressed(CefRefPtr<CefButton>) override { SaveDocument(); }
  void OnButtonStateChanged(CefRefPtr<CefButton> b) override {
    LOG(INFO) << "Button state: " << b->GetState();
  }
};

Derived from the CEF C++ headers — © Marshall A. Greenblatt, Google Inc. & contributors (BSD-style license). Not an official CEF project.