electron/shell/browser/ui/views/frameless_view.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
2.1 KiB
C
Raw Normal View History

// 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.
#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
#include "base/memory/raw_ptr.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 {
public:
static const char kViewClassName[];
2014-07-16 07:33:40 +00:00
FramelessView();
2018-05-03 14:04:22 +00:00
~FramelessView() override;
2014-07-16 07:33:40 +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.
virtual int ResizingBorderHitTest(const gfx::Point& point);
2014-07-16 07:33:40 +00:00
protected:
// 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:
gfx::Rect GetBoundsForClientView() const override;
gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const override;
int NonClientHitTest(const gfx::Point& point) override;
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
// views::ViewTargeterDelegate:
views::View* TargetForRect(views::View* root, const gfx::Rect& rect) override;
// views::View:
gfx::Size CalculatePreferredSize() const override;
gfx::Size GetMinimumSize() const override;
gfx::Size GetMaximumSize() const override;
const char* GetClassName() const override;
2014-07-16 07:33:40 +00:00
// Not owned.
raw_ptr<NativeWindowViews> window_ = nullptr;
raw_ptr<views::Widget> frame_ = nullptr;
2014-07-16 07:33:40 +00:00
feat: enable windows control overlay on Windows (#29600) * rebase "feat: enable windows control overlay on Windows" * correct compilation error * fix linting errors * modify includes and build file * change `hidden` option to `overlay` * add patch to fix visual layout * add button background color parameter * add button text color parameter * modify `overlay` in docs and modify button hover/press transition color * change `text` to `symbol` * remove todo and fix `text` replacement * add new titleBarOverlay property and remove titleBarStyle `overlay` * update browser and frameless window docs * remove chromium patches * chore: update patches * change button hover color, update trailing `_`, update test file * add dchecks, update title bar drawing checks, update test file * modify for mac and linux builds * update docs with overlayColor and overlaySymbolColor * add corner and side hit test info * modify docs and copyright info * modify `titlebar_overlay_` as boolean or object * move `title_bar_style_ to `NativeWindow` * update docs with boolean and object titlebar_overlay_ * add `IsEmpty` checks * move get options for boolean and object checks * fix linting error * disable `use_lld` for macos * Update docs/api/frameless-window.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Update docs/api/frameless-window.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Update docs/api/frameless-window.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Apply docs suggestions from code review Co-authored-by: Jeremy Rose <jeremya@chromium.org> * modify `true` option description `titleBarOverlay` * ci: cleanup keychain after tests on arm64 mac (#30472) Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-08-11 18:07:36 +00:00
friend class NativeWindowsViews;
2014-07-16 07:33:40 +00:00
};
} // namespace electron
#endif // ELECTRON_SHELL_BROWSER_UI_VIEWS_FRAMELESS_VIEW_H_