views: Use default theme background color for all controls (see #3671)

Add new CefViewDelegate::OnThemeChanged callback for optionally overriding
default theme colors when the current theme changes.
This commit is contained in:
Marshall Greenblatt
2024-03-22 19:51:00 -04:00
parent a13b6dc7f6
commit 19ba8b2b8d
43 changed files with 510 additions and 102 deletions

View File

@@ -83,7 +83,6 @@ CefRefPtr<CefMenuModel> ViewsMenuBar::CreateMenuModel(const CefString& label,
CefRefPtr<CefMenuButton> button =
CefMenuButton::CreateMenuButton(this, label);
button->SetID(new_menu_id);
views_style::ApplyTo(button.get());
button->SetInkDropEnabled(true);
// Assign a group ID to allow focus traversal between MenuButtons using the
@@ -283,13 +282,17 @@ void ViewsMenuBar::MenuClosed(CefRefPtr<CefMenuModel> menu_model) {
}
}
void ViewsMenuBar::OnThemeChanged(CefRefPtr<CefView> view) {
// Apply colors when the theme changes.
views_style::ApplyTo(view);
}
void ViewsMenuBar::EnsureMenuPanel() {
if (panel_) {
return;
}
panel_ = CefPanel::CreatePanel(nullptr);
views_style::ApplyTo(panel_);
panel_ = CefPanel::CreatePanel(this);
// Use a horizontal box layout.
CefBoxLayoutSettings top_panel_layout_settings;