mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
views: Add support for absolute positioned overlay views.
To test: Run `cefclient.exe --use-views --hide-frame --hide-controls` Add `--enable-chrome-runtime` for the same behavior using the Chrome location bar instead of a text field.
This commit is contained in:
71
tests/cefclient/browser/views_overlay_controls.h
Normal file
71
tests/cefclient/browser/views_overlay_controls.h
Normal file
@ -0,0 +1,71 @@
|
||||
// Copyright (c) 2021 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_VIEWS_OVERLAY_CONTROLS_H_
|
||||
#define CEF_TESTS_CEFCLIENT_BROWSER_VIEWS_OVERLAY_CONTROLS_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/views/cef_button_delegate.h"
|
||||
#include "include/views/cef_label_button.h"
|
||||
#include "include/views/cef_menu_button.h"
|
||||
#include "include/views/cef_overlay_controller.h"
|
||||
#include "include/views/cef_panel.h"
|
||||
|
||||
namespace client {
|
||||
|
||||
// Implements window overlay controls that receive absolute positioning on top
|
||||
// of the browser view. All methods must be called on the browser process UI
|
||||
// thread.
|
||||
class ViewsOverlayControls : public CefButtonDelegate {
|
||||
public:
|
||||
enum class Command {
|
||||
kMinimize = 1,
|
||||
kMaximize,
|
||||
kClose,
|
||||
};
|
||||
|
||||
ViewsOverlayControls();
|
||||
|
||||
void Initialize(CefRefPtr<CefWindow> window,
|
||||
CefRefPtr<CefMenuButton> menu_button,
|
||||
CefRefPtr<CefView> location_bar,
|
||||
bool is_chrome_toolbar);
|
||||
void Destroy();
|
||||
|
||||
// Update window control button state and location bar bounds.
|
||||
void UpdateControls();
|
||||
|
||||
// Exclude all regions obscured by overlays.
|
||||
void UpdateDraggableRegions(std::vector<CefDraggableRegion>& window_regions);
|
||||
|
||||
private:
|
||||
// CefButtonDelegate methods:
|
||||
void OnButtonPressed(CefRefPtr<CefButton> button) override;
|
||||
|
||||
CefRefPtr<CefLabelButton> CreateButton(Command command);
|
||||
|
||||
void MaybeUpdateMaximizeButton();
|
||||
|
||||
CefRefPtr<CefWindow> window_;
|
||||
bool window_maximized_;
|
||||
|
||||
// Window control buttons.
|
||||
CefRefPtr<CefPanel> panel_;
|
||||
CefRefPtr<CefOverlayController> panel_controller_;
|
||||
|
||||
// Location bar.
|
||||
CefRefPtr<CefView> location_bar_;
|
||||
bool is_chrome_toolbar_;
|
||||
CefRefPtr<CefOverlayController> location_controller_;
|
||||
|
||||
// Menu button.
|
||||
CefRefPtr<CefOverlayController> menu_controller_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ViewsOverlayControls);
|
||||
DISALLOW_COPY_AND_ASSIGN(ViewsOverlayControls);
|
||||
};
|
||||
|
||||
} // namespace client
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_BROWSER_VIEWS_OVERLAY_CONTROLS_H_
|
Reference in New Issue
Block a user