2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2014 GitHub, Inc.
|
2014-07-16 07:33:40 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_UI_VIEWS_FRAMELESS_VIEW_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_UI_VIEWS_FRAMELESS_VIEW_H_
|
2014-07-16 07:33:40 +00:00
|
|
|
|
2023-05-11 20:07:39 +00:00
|
|
|
#include "base/memory/raw_ptr.h"
|
2024-02-21 20:27:05 +00:00
|
|
|
#include "ui/base/metadata/metadata_header_macros.h"
|
2014-07-16 07:33:40 +00:00
|
|
|
#include "ui/views/window/non_client_view.h"
|
|
|
|
|
|
|
|
namespace views {
|
|
|
|
class Widget;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace electron {
|
|
|
|
|
|
|
|
class NativeWindowViews;
|
|
|
|
|
|
|
|
class FramelessView : public views::NonClientFrameView {
|
2024-02-21 20:27:05 +00:00
|
|
|
METADATA_HEADER(FramelessView, views::NonClientFrameView)
|
|
|
|
|
2014-07-16 07:33:40 +00:00
|
|
|
public:
|
|
|
|
FramelessView();
|
2018-05-03 14:04:22 +00:00
|
|
|
~FramelessView() override;
|
2014-07-16 07:33:40 +00:00
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
FramelessView(const FramelessView&) = delete;
|
|
|
|
FramelessView& operator=(const FramelessView&) = delete;
|
|
|
|
|
2014-07-16 07:33:40 +00:00
|
|
|
virtual void Init(NativeWindowViews* window, views::Widget* frame);
|
|
|
|
|
|
|
|
// Returns whether the |point| is on frameless window's resizing border.
|
2022-01-26 21:59:09 +00:00
|
|
|
virtual int ResizingBorderHitTest(const gfx::Point& point);
|
2014-07-16 07:33:40 +00:00
|
|
|
|
2024-06-27 12:56:36 +00:00
|
|
|
// Tells the NonClientView to invalidate caption buttons
|
|
|
|
// and forces a re-layout and re-paint.
|
refactor: put empty virtual function definitions in header (#43285)
* refactor: in FramelessView, move empty function decls to header
* refactor: in electron::api::WebContents, move empty function decls to header
* refactor: in electron::api::NativeWindow, move empty function decls to header
* refactor: in electron::OffScreenWebContentsView, move empty function decls to header
* refactor: in electron::OffScreenRenderWidgetHostView, move empty function decls to header
* refactor: in auto_updater::AutoUpdater, move empty function decls to header
* refactor: in electorn::api::FrameSubscriber, move empty function decls to header
* refactor: in electorn::api::SimpleURLLoaderWrapper, move empty function decls to header
* refactor: in electorn::InspectableWebContents, move empty function decls to header
* refactor: in electorn::OffScreenVideoConsumer, move empty function decls to header
* refactor: in electron::OffScreenWebContentsView, move empty function decls to header
* refactor: in electron::TrayIcon, move empty function decls to header
* refactor: in electron::ViewsDelegate, move empty function decls to header
* refactor: in electron::MediaCaptureDevicesDispatcher, move empty function decls to header
* refactor: in electron::UsbChooserContext::DeviceObserver, move empty function decls to header
* refactor: in electron::ProxyingWebSocket, move empty function decls to header
* refactor: in electron::Notification, move empty function decls to header
* refactor: in electron::PlatformNotificationService, move empty function decls to header
* Revert "refactor: in electron::PlatformNotificationService, move empty function decls to header"
This reverts commit 9103750d03b9ba1ceccba43d11dfdc2404ff6191.
* refactor: in electron::ElectronPDFDocumentHelperClient, move empty function decls to header
* refactor: in electron::api::SpellCheckClient, move empty function decls to header
* refactor: in electron::ElectronExtensionHostDelegate, move empty function decls to header
* refactor: in electron::PlatformNotificationService, move empty function decls to header
* refactor: in electron::NativeWindowViews, move empty function decls to header
* chore: move SetTouchBar() back to cc
* Revert "refactor: in auto_updater::AutoUpdater, move empty function decls to header"
This reverts commit c43d6862d32c74f63f82700a7546a732ac05ecb8.
2024-08-12 07:56:51 +00:00
|
|
|
virtual void InvalidateCaptionButtons() {}
|
2024-06-27 12:56:36 +00:00
|
|
|
|
|
|
|
NativeWindowViews* window() const { return window_; }
|
|
|
|
views::Widget* frame() const { return frame_; }
|
|
|
|
|
2014-07-16 07:33:40 +00:00
|
|
|
protected:
|
2022-01-26 21:59:09 +00:00
|
|
|
// Helper function for subclasses to implement ResizingBorderHitTest with a
|
|
|
|
// custom resize inset.
|
|
|
|
int ResizingBorderHitTestImpl(const gfx::Point& point,
|
|
|
|
const gfx::Insets& resize_border);
|
|
|
|
|
2014-07-16 07:33:40 +00:00
|
|
|
// views::NonClientFrameView:
|
2014-11-16 07:54:40 +00:00
|
|
|
gfx::Rect GetBoundsForClientView() const override;
|
|
|
|
gfx::Rect GetWindowBoundsForClientBounds(
|
|
|
|
const gfx::Rect& client_bounds) const override;
|
|
|
|
int NonClientHitTest(const gfx::Point& point) override;
|
refactor: put empty virtual function definitions in header (#43285)
* refactor: in FramelessView, move empty function decls to header
* refactor: in electron::api::WebContents, move empty function decls to header
* refactor: in electron::api::NativeWindow, move empty function decls to header
* refactor: in electron::OffScreenWebContentsView, move empty function decls to header
* refactor: in electron::OffScreenRenderWidgetHostView, move empty function decls to header
* refactor: in auto_updater::AutoUpdater, move empty function decls to header
* refactor: in electorn::api::FrameSubscriber, move empty function decls to header
* refactor: in electorn::api::SimpleURLLoaderWrapper, move empty function decls to header
* refactor: in electorn::InspectableWebContents, move empty function decls to header
* refactor: in electorn::OffScreenVideoConsumer, move empty function decls to header
* refactor: in electron::OffScreenWebContentsView, move empty function decls to header
* refactor: in electron::TrayIcon, move empty function decls to header
* refactor: in electron::ViewsDelegate, move empty function decls to header
* refactor: in electron::MediaCaptureDevicesDispatcher, move empty function decls to header
* refactor: in electron::UsbChooserContext::DeviceObserver, move empty function decls to header
* refactor: in electron::ProxyingWebSocket, move empty function decls to header
* refactor: in electron::Notification, move empty function decls to header
* refactor: in electron::PlatformNotificationService, move empty function decls to header
* Revert "refactor: in electron::PlatformNotificationService, move empty function decls to header"
This reverts commit 9103750d03b9ba1ceccba43d11dfdc2404ff6191.
* refactor: in electron::ElectronPDFDocumentHelperClient, move empty function decls to header
* refactor: in electron::api::SpellCheckClient, move empty function decls to header
* refactor: in electron::ElectronExtensionHostDelegate, move empty function decls to header
* refactor: in electron::PlatformNotificationService, move empty function decls to header
* refactor: in electron::NativeWindowViews, move empty function decls to header
* chore: move SetTouchBar() back to cc
* Revert "refactor: in auto_updater::AutoUpdater, move empty function decls to header"
This reverts commit c43d6862d32c74f63f82700a7546a732ac05ecb8.
2024-08-12 07:56:51 +00:00
|
|
|
void GetWindowMask(const gfx::Size& size, SkPath* window_mask) override {}
|
|
|
|
void ResetWindowControls() override {}
|
|
|
|
void UpdateWindowIcon() override {}
|
|
|
|
void UpdateWindowTitle() override {}
|
|
|
|
void SizeConstraintsChanged() override {}
|
2014-07-16 07:33:40 +00:00
|
|
|
|
2022-04-29 00:34:12 +00:00
|
|
|
// views::ViewTargeterDelegate:
|
|
|
|
views::View* TargetForRect(views::View* root, const gfx::Rect& rect) override;
|
|
|
|
|
|
|
|
// views::View:
|
2024-06-07 21:18:35 +00:00
|
|
|
gfx::Size CalculatePreferredSize(
|
|
|
|
const views::SizeBounds& available_size) const override;
|
2014-11-16 07:54:40 +00:00
|
|
|
gfx::Size GetMinimumSize() const override;
|
|
|
|
gfx::Size GetMaximumSize() const override;
|
2014-07-16 07:33:40 +00:00
|
|
|
|
|
|
|
// Not owned.
|
2023-05-11 20:07:39 +00:00
|
|
|
raw_ptr<NativeWindowViews> window_ = nullptr;
|
|
|
|
raw_ptr<views::Widget> frame_ = nullptr;
|
2014-07-16 07:33:40 +00:00
|
|
|
|
2021-08-11 18:07:36 +00:00
|
|
|
friend class NativeWindowsViews;
|
2014-07-16 07:33:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace electron
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_UI_VIEWS_FRAMELESS_VIEW_H_
|