OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_ | 5 #ifndef UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_ |
6 #define UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_ | 6 #define UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_ |
7 | 7 |
8 #include "ui/views/view.h" | 8 #include "ui/views/view.h" |
| 9 #include "ui/views/view_targeter_delegate.h" |
9 | 10 |
10 namespace gfx { | 11 namespace gfx { |
11 class Path; | 12 class Path; |
12 } | 13 } |
13 | 14 |
14 namespace views { | 15 namespace views { |
15 | 16 |
16 class ClientView; | 17 class ClientView; |
17 | 18 |
18 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
19 // NonClientFrameView | 20 // NonClientFrameView |
20 // | 21 // |
21 // An object that subclasses NonClientFrameView is a View that renders and | 22 // An object that subclasses NonClientFrameView is a View that renders and |
22 // responds to events within the frame portions of the non-client area of a | 23 // responds to events within the frame portions of the non-client area of a |
23 // window. This view does _not_ contain the ClientView, but rather is a sibling | 24 // window. This view does _not_ contain the ClientView, but rather is a sibling |
24 // of it. | 25 // of it. |
25 class VIEWS_EXPORT NonClientFrameView : public View { | 26 class VIEWS_EXPORT NonClientFrameView : public View, |
| 27 public ViewTargeterDelegate { |
26 public: | 28 public: |
27 // Internal class name. | 29 // Internal class name. |
28 static const char kViewClassName[]; | 30 static const char kViewClassName[]; |
29 | 31 |
30 enum { | 32 enum { |
31 // Various edges of the frame border have a 1 px shadow along their edges; | 33 // Various edges of the frame border have a 1 px shadow along their edges; |
32 // in a few cases we shift elements based on this amount for visual appeal. | 34 // in a few cases we shift elements based on this amount for visual appeal. |
33 kFrameShadowThickness = 1, | 35 kFrameShadowThickness = 1, |
34 | 36 |
35 // In restored mode, we draw a 1 px edge around the content area inside the | 37 // In restored mode, we draw a 1 px edge around the content area inside the |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // the parent NonClientView because that makes it more difficult to calculate | 73 // the parent NonClientView because that makes it more difficult to calculate |
72 // hittests for regions that are partially obscured by the ClientView, e.g. | 74 // hittests for regions that are partially obscured by the ClientView, e.g. |
73 // HTSYSMENU. | 75 // HTSYSMENU. |
74 virtual int NonClientHitTest(const gfx::Point& point) = 0; | 76 virtual int NonClientHitTest(const gfx::Point& point) = 0; |
75 virtual void GetWindowMask(const gfx::Size& size, | 77 virtual void GetWindowMask(const gfx::Size& size, |
76 gfx::Path* window_mask) = 0; | 78 gfx::Path* window_mask) = 0; |
77 virtual void ResetWindowControls() = 0; | 79 virtual void ResetWindowControls() = 0; |
78 virtual void UpdateWindowIcon() = 0; | 80 virtual void UpdateWindowIcon() = 0; |
79 virtual void UpdateWindowTitle() = 0; | 81 virtual void UpdateWindowTitle() = 0; |
80 | 82 |
81 // Overridden from View: | 83 // View: |
82 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | |
83 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 84 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
84 virtual const char* GetClassName() const OVERRIDE; | 85 virtual const char* GetClassName() const OVERRIDE; |
85 | 86 |
| 87 // ViewTargeterDelegate: |
| 88 virtual bool DoesIntersectRect(const View* target, |
| 89 const gfx::Rect& rect) const OVERRIDE; |
| 90 |
86 protected: | 91 protected: |
87 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 92 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
88 | 93 |
89 NonClientFrameView(); | 94 NonClientFrameView(); |
90 | 95 |
91 private: | 96 private: |
92 // Prevents the non-client frame view from being rendered as inactive when | 97 // Prevents the non-client frame view from being rendered as inactive when |
93 // true. | 98 // true. |
94 bool inactive_rendering_disabled_; | 99 bool inactive_rendering_disabled_; |
95 }; | 100 }; |
(...skipping 27 matching lines...) Expand all Loading... |
123 // | | | +----------------------------------------+ | | | | 128 // | | | +----------------------------------------+ | | | |
124 // | | +--------------------------------------------+ | | | 129 // | | +--------------------------------------------+ | | |
125 // | +------------------------------------------------+ | | 130 // | +------------------------------------------------+ | |
126 // +----------------------------------------------------+ | 131 // +----------------------------------------------------+ |
127 // | 132 // |
128 // The NonClientFrameView and ClientView are siblings because due to theme | 133 // The NonClientFrameView and ClientView are siblings because due to theme |
129 // changes the NonClientFrameView may be replaced with different | 134 // changes the NonClientFrameView may be replaced with different |
130 // implementations (e.g. during the switch from DWM/Aero-Glass to Vista Basic/ | 135 // implementations (e.g. during the switch from DWM/Aero-Glass to Vista Basic/ |
131 // Classic rendering). | 136 // Classic rendering). |
132 // | 137 // |
133 class VIEWS_EXPORT NonClientView : public View { | 138 class VIEWS_EXPORT NonClientView : public View, public ViewTargeterDelegate { |
134 public: | 139 public: |
135 // Internal class name. | 140 // Internal class name. |
136 static const char kViewClassName[]; | 141 static const char kViewClassName[]; |
137 | 142 |
138 NonClientView(); | 143 NonClientView(); |
139 virtual ~NonClientView(); | 144 virtual ~NonClientView(); |
140 | 145 |
141 // Returns the current NonClientFrameView instance, or NULL if | 146 // Returns the current NonClientFrameView instance, or NULL if |
142 // it does not exist. | 147 // it does not exist. |
143 NonClientFrameView* frame_view() const { return frame_view_.get(); } | 148 NonClientFrameView* frame_view() const { return frame_view_.get(); } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 void SetAccessibleName(const base::string16& name); | 210 void SetAccessibleName(const base::string16& name); |
206 | 211 |
207 // NonClientView, View overrides: | 212 // NonClientView, View overrides: |
208 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 213 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
209 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 214 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
210 virtual gfx::Size GetMaximumSize() const OVERRIDE; | 215 virtual gfx::Size GetMaximumSize() const OVERRIDE; |
211 virtual void Layout() OVERRIDE; | 216 virtual void Layout() OVERRIDE; |
212 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 217 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
213 virtual const char* GetClassName() const OVERRIDE; | 218 virtual const char* GetClassName() const OVERRIDE; |
214 | 219 |
215 virtual views::View* GetEventHandlerForRect(const gfx::Rect& rect) OVERRIDE; | |
216 virtual views::View* GetTooltipHandlerForPoint( | 220 virtual views::View* GetTooltipHandlerForPoint( |
217 const gfx::Point& point) OVERRIDE; | 221 const gfx::Point& point) OVERRIDE; |
218 | 222 |
219 protected: | 223 protected: |
220 // NonClientView, View overrides: | 224 // NonClientView, View overrides: |
221 virtual void ViewHierarchyChanged( | 225 virtual void ViewHierarchyChanged( |
222 const ViewHierarchyChangedDetails& details) OVERRIDE; | 226 const ViewHierarchyChangedDetails& details) OVERRIDE; |
223 | 227 |
224 private: | 228 private: |
| 229 // ViewTargeterDelegate: |
| 230 virtual View* TargetForRect(View* root, |
| 231 const gfx::Rect& rect) OVERRIDE; |
| 232 |
225 // A ClientView object or subclass, responsible for sizing the contents view | 233 // A ClientView object or subclass, responsible for sizing the contents view |
226 // of the window, hit testing and perhaps other tasks depending on the | 234 // of the window, hit testing and perhaps other tasks depending on the |
227 // implementation. | 235 // implementation. |
228 ClientView* client_view_; | 236 ClientView* client_view_; |
229 | 237 |
230 // The NonClientFrameView that renders the non-client portions of the window. | 238 // The NonClientFrameView that renders the non-client portions of the window. |
231 // This object is not owned by the view hierarchy because it can be replaced | 239 // This object is not owned by the view hierarchy because it can be replaced |
232 // dynamically as the system settings change. | 240 // dynamically as the system settings change. |
233 scoped_ptr<NonClientFrameView> frame_view_; | 241 scoped_ptr<NonClientFrameView> frame_view_; |
234 | 242 |
235 // The overlay view, when non-NULL and visible, takes up the entire widget and | 243 // The overlay view, when non-NULL and visible, takes up the entire widget and |
236 // is placed on top of the ClientView and NonClientFrameView. | 244 // is placed on top of the ClientView and NonClientFrameView. |
237 View* overlay_view_; | 245 View* overlay_view_; |
238 | 246 |
239 // The accessible name of this view. | 247 // The accessible name of this view. |
240 base::string16 accessible_name_; | 248 base::string16 accessible_name_; |
241 | 249 |
242 DISALLOW_COPY_AND_ASSIGN(NonClientView); | 250 DISALLOW_COPY_AND_ASSIGN(NonClientView); |
243 }; | 251 }; |
244 | 252 |
245 } // namespace views | 253 } // namespace views |
246 | 254 |
247 #endif // UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_ | 255 #endif // UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_ |
OLD | NEW |