mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-04-13 02:12:07 +02:00
This is intended for usage with frameless windows that show the standard window buttons, where resizing the title bar height changes the button offset. Returning a different value from CefWindowDelegate::GetTitlebarHeight and forcing a resize of the NSWindow's theme frame (see ViewsWindow::NudgeWindow) will update the title bar height. To test: 1. Run `cefclient --use-views --hide-frame --show-window-buttons --url=http://tests/window` 2. Enter a new value for title bar height and click the "Set Titlebar Height" button
40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
// Copyright 2023 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_LIBCEF_BROWSER_VIEWS_NATIVE_WIDGET_MAC_H_
|
|
#define CEF_LIBCEF_BROWSER_VIEWS_NATIVE_WIDGET_MAC_H_
|
|
#pragma once
|
|
|
|
#include "include/internal/cef_ptr.h"
|
|
|
|
#include "ui/views/widget/native_widget_mac.h"
|
|
|
|
class CefWindow;
|
|
class CefWindowDelegate;
|
|
|
|
class CefNativeWidgetMac : public views::NativeWidgetMac {
|
|
public:
|
|
CefNativeWidgetMac(views::internal::NativeWidgetDelegate* delegate,
|
|
CefRefPtr<CefWindow> window,
|
|
CefWindowDelegate* window_delegate);
|
|
~CefNativeWidgetMac() override = default;
|
|
|
|
CefNativeWidgetMac(const CefNativeWidgetMac&) = delete;
|
|
CefNativeWidgetMac& operator=(const CefNativeWidgetMac&) = delete;
|
|
|
|
protected:
|
|
// NativeWidgetMac:
|
|
NativeWidgetMacNSWindow* CreateNSWindow(
|
|
const remote_cocoa::mojom::CreateWindowParams* params) override;
|
|
|
|
void GetWindowFrameTitlebarHeight(bool* override_titlebar_height,
|
|
float* titlebar_height) override;
|
|
|
|
private:
|
|
const CefRefPtr<CefWindow> window_;
|
|
CefWindowDelegate* const window_delegate_;
|
|
};
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_VIEWS_NATIVE_WIDGET_MAC_H_
|