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.
|
|
|
|
|
2019-06-19 20:56:58 +00:00
|
|
|
#ifndef SHELL_BROWSER_UI_VIEWS_FRAMELESS_VIEW_H_
|
|
|
|
#define SHELL_BROWSER_UI_VIEWS_FRAMELESS_VIEW_H_
|
2014-07-16 07:33:40 +00:00
|
|
|
|
|
|
|
#include "ui/views/window/non_client_view.h"
|
|
|
|
|
|
|
|
namespace views {
|
|
|
|
class Widget;
|
|
|
|
}
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
namespace electron {
|
2014-07-16 07:33:40 +00:00
|
|
|
|
|
|
|
class NativeWindowViews;
|
|
|
|
|
|
|
|
class FramelessView : public views::NonClientFrameView {
|
|
|
|
public:
|
2018-05-15 18:49:27 +00:00
|
|
|
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
|
|
|
|
|
|
|
virtual void Init(NativeWindowViews* window, views::Widget* frame);
|
|
|
|
|
|
|
|
// Returns whether the |point| is on frameless window's resizing border.
|
|
|
|
int ResizingBorderHitTest(const gfx::Point& point);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// 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;
|
2019-01-31 22:14:32 +00:00
|
|
|
void GetWindowMask(const gfx::Size& size, SkPath* window_mask) override;
|
2014-11-16 07:54:40 +00:00
|
|
|
void ResetWindowControls() override;
|
|
|
|
void UpdateWindowIcon() override;
|
|
|
|
void UpdateWindowTitle() override;
|
2014-12-10 00:52:11 +00:00
|
|
|
void SizeConstraintsChanged() override;
|
2014-07-16 07:33:40 +00:00
|
|
|
|
|
|
|
// Overridden from View:
|
2017-09-12 15:32:11 +00:00
|
|
|
gfx::Size CalculatePreferredSize() const override;
|
2014-11-16 07:54:40 +00:00
|
|
|
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.
|
2018-05-21 22:18:38 +00:00
|
|
|
NativeWindowViews* window_ = nullptr;
|
|
|
|
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
|
|
|
private:
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(FramelessView);
|
|
|
|
};
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
} // namespace electron
|
2014-07-16 07:33:40 +00:00
|
|
|
|
2019-06-19 20:56:58 +00:00
|
|
|
#endif // SHELL_BROWSER_UI_VIEWS_FRAMELESS_VIEW_H_
|