Skip to content

CefButton

Header: cef_button.h
Category: Views Framework

Overview

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

CefButton

Source File: include/views/cef_button.h

Process / Thread Context: Browser Process / UI Thread.

Purpose: Base class for button views. Depending on the concrete type, a

Methods

virtual CefRefPtr<CefLabelButton> AsLabelButton() = 0

Parameters:

  • none.

Return Value: This button as a CefLabelButton, or NULL.

Usage Instruction: Down-cast helper.

Threading Constraint: Browser process UI thread.

virtual void SetState(cef_button_state_t state) = 0

Parameters:

  • state: One of CEF_BUTTON_STATE_NORMAL, CEF_BUTTON_STATE_HOVERED,

Return Value: void.

Usage Instruction: Programmatically set the visual state.

Threading Constraint: Browser process UI thread.

virtual cef_button_state_t GetState() = 0

Parameters:

  • none.

Return Value: Current display state. Default

Usage Instruction: Query the current state.

Threading Constraint: Browser process UI thread.

virtual void SetInkDropEnabled(bool enabled) = 0

Parameters:

  • enabled: True to enable the ink-drop ripple effect on state changes.

Return Value: void.

Usage Instruction: Material-style visual feedback.

Threading Constraint: Browser process UI thread.

virtual void SetTooltipText(const CefString& tooltip_text) = 0

Parameters:

  • tooltip_text: Tooltip text shown on hover.

Return Value: void.

Usage Instruction: Add tooltips to buttons.

Threading Constraint: Browser process UI thread.

virtual void SetAccessibleName(const CefString& name) = 0

Parameters:

  • name: The accessible name exposed to assistive technology (AT).

Return Value: void.

Usage Instruction: Screen-reader support.

Threading Constraint: Browser process UI thread.

Usage Example

cpp
auto btn = CefLabelButton::CreateLabelButton(btn_del, "Save");
btn->SetTooltipText("Save the current document");
btn->SetAccessibleName("Save button");
btn->SetInkDropEnabled(true);

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