Skip to content

CefBoxLayout

Header: cef_box_layout.h
Category: Views Framework

Overview

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

CefBoxLayout

Source File: include/views/cef_box_layout.h

Process / Thread Context: Browser Process / UI Thread.

Purpose: A layout manager that arranges children vertically or

Methods

virtual void SetFlexForView(CefRefPtr<CefView> view, int flex) = 0

Parameters:

  • view: A child view of the panel that owns this layout.
  • flex: Flex weight; 0 means the view will not be resized. Negative

Return Value: void.

Usage Instruction: Use to make specific children absorb or shed free

Threading Constraint: Browser process UI thread.

virtual void ClearFlexForView(CefRefPtr<CefView> view) = 0

Parameters:

  • view: A child view whose flex should be cleared.

Return Value: void. After this call, the view uses the default flex

Usage Instruction: Reset a per-view flex override.

Threading Constraint: Browser process UI thread.

Usage Example

cpp
CefBoxLayoutSettings settings;
settings.horizontal = true;       // lay children out left-to-right
settings.between_child_spacing = 8;
CefRefPtr<CefBoxLayout> box = panel->SetToBoxLayout(settings);

panel->AddChildView(label_button);
panel->AddChildView(text_field);
box->SetFlexForView(text_field, 1);  // text field takes the slack

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