blob: cae7d8f378301f25e1f4baf5732bb2536ce22b10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
// Copyright (c) 2011 The Chromium 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 UI_AURA_SHELL_TOPLEVEL_FRAME_VIEW_H_
#define UI_AURA_SHELL_TOPLEVEL_FRAME_VIEW_H_
#pragma once
#include "ui/aura_shell/aura_shell_export.h"
#include "ui/views/window/non_client_view.h"
#include "views/controls/button/button.h"
namespace aura_shell {
namespace internal {
class FrameComponent;
class SizingBorder;
class WindowCaption;
// A NonClientFrameView implementation for generic top-level windows in Aura.
// TODO(beng): Find a way to automatically this for all top-level windows in
// Aura. Right now windows have to override CreateNonClientFrameView
// on WidgetDelegate to specify this.
class AURA_SHELL_EXPORT ToplevelFrameView : public views::NonClientFrameView {
public:
ToplevelFrameView();
virtual ~ToplevelFrameView();
private:
// Returns the height of the side/bottom non-client edges.
int NonClientBorderThickness() const;
// Returns the height of the top non-client edge - the caption.
int NonClientTopBorderHeight() const;
// Implementation of NonClientHitTest().
int NonClientHitTestImpl(const gfx::Point& point);
// Shows the specified |sizing_border|, hiding all others.
// If |sizing_border| is NULL, all other sizing borders are hidden.
void ShowFrameComponent(FrameComponent* sizing_border);
// Returns true if the specified point (in FrameView coordinates) hit-tests
// against the specified child.
bool PointIsInChildView(views::View* child, const gfx::Point& point) const;
// Returns the bounds of the specified sizing border for its visible and
// hidden states.
gfx::Rect GetHiddenBoundsForSizingBorder(int frame_component) const;
gfx::Rect GetVisibleBoundsForSizingBorder(int frame_component) const;
// Overridden from views::NonClientFrameView:
virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
virtual gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const OVERRIDE;
virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
virtual void GetWindowMask(const gfx::Size& size,
gfx::Path* window_mask) OVERRIDE;
virtual void EnableClose(bool enable) OVERRIDE;
virtual void ResetWindowControls() OVERRIDE;
virtual void UpdateWindowIcon() OVERRIDE;
// Overridden from views::View:
virtual void Layout() OVERRIDE;
virtual void OnMouseMoved(const views::MouseEvent& event) OVERRIDE;
virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE;
virtual views::View* GetEventHandlerForPoint(
const gfx::Point& point) OVERRIDE;
virtual gfx::NativeCursor GetCursor(const views::MouseEvent& event) OVERRIDE;
gfx::Rect client_view_bounds_;
int current_hittest_code_;
WindowCaption* caption_;
SizingBorder* left_edge_;
SizingBorder* right_edge_;
SizingBorder* bottom_edge_;
DISALLOW_COPY_AND_ASSIGN(ToplevelFrameView);
};
} // namespace internal
} // namespace aura_shell
#endif // #ifndef UI_AURA_SHELL_TOPLEVEL_FRAME_VIEW_H_
|