OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_WINDOW_NON_CLIENT_VIEW_H_ | 5 #ifndef VIEWS_WINDOW_NON_CLIENT_VIEW_H_ |
6 #define VIEWS_WINDOW_NON_CLIENT_VIEW_H_ | 6 #define VIEWS_WINDOW_NON_CLIENT_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "views/view.h" | 9 #include "views/view.h" |
10 #include "views/window/client_view.h" | 10 #include "views/window/client_view.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 public: | 26 public: |
27 // Internal class name. | 27 // Internal class name. |
28 static const char kViewClassName[]; | 28 static const char kViewClassName[]; |
29 // Various edges of the frame border have a 1 px shadow along their edges; in | 29 // Various edges of the frame border have a 1 px shadow along their edges; in |
30 // a few cases we shift elements based on this amount for visual appeal. | 30 // a few cases we shift elements based on this amount for visual appeal. |
31 static const int kFrameShadowThickness; | 31 static const int kFrameShadowThickness; |
32 // In restored mode, we draw a 1 px edge around the content area inside the | 32 // In restored mode, we draw a 1 px edge around the content area inside the |
33 // frame border. | 33 // frame border. |
34 static const int kClientEdgeThickness; | 34 static const int kClientEdgeThickness; |
35 | 35 |
36 // Prevent the frame view from painting its inactive state. Prevents a related | 36 // Sets whether the window should be rendered as active regardless of the |
37 // window from causing its owner to appear deactivated. Used for windows like | 37 // actual active state. Used when bubbles become active to make their parent |
38 // bubbles. | 38 // appear active. A value of true makes the window render as active always, |
39 void DisableInactiveRendering(bool disable) { | 39 // false gives normal behavior. |
40 paint_as_active_ = disable; | 40 void SetInactiveRenderingDisabled(bool disable); |
41 if (!paint_as_active_) | |
42 SchedulePaint(); | |
43 } | |
44 | 41 |
45 // Returns the bounds (in this View's parent's coordinates) that the client | 42 // Returns the bounds (in this View's parent's coordinates) that the client |
46 // view should be laid out within. | 43 // view should be laid out within. |
47 virtual gfx::Rect GetBoundsForClientView() const = 0; | 44 virtual gfx::Rect GetBoundsForClientView() const = 0; |
48 | 45 |
49 virtual gfx::Rect GetWindowBoundsForClientBounds( | 46 virtual gfx::Rect GetWindowBoundsForClientBounds( |
50 const gfx::Rect& client_bounds) const = 0; | 47 const gfx::Rect& client_bounds) const = 0; |
51 | 48 |
52 // This function must ask the ClientView to do a hittest. We don't do this in | 49 // This function must ask the ClientView to do a hittest. We don't do this in |
53 // the parent NonClientView because that makes it more difficult to calculate | 50 // the parent NonClientView because that makes it more difficult to calculate |
(...skipping 22 matching lines...) Expand all Loading... |
76 // resized. | 73 // resized. |
77 int GetHTComponentForFrame(const gfx::Point& point, | 74 int GetHTComponentForFrame(const gfx::Point& point, |
78 int top_resize_border_height, | 75 int top_resize_border_height, |
79 int resize_border_thickness, | 76 int resize_border_thickness, |
80 int top_resize_corner_height, | 77 int top_resize_corner_height, |
81 int resize_corner_width, | 78 int resize_corner_width, |
82 bool can_resize); | 79 bool can_resize); |
83 | 80 |
84 // Used to determine if the frame should be painted as active. Keyed off the | 81 // Used to determine if the frame should be painted as active. Keyed off the |
85 // window's actual active state and the override, see | 82 // window's actual active state and the override, see |
86 // DisableInactiveRendering() above. | 83 // SetInactiveRenderingDisabled() above. |
87 bool ShouldPaintAsActive() const; | 84 bool ShouldPaintAsActive() const; |
88 | 85 |
| 86 // Invoked from SetInactiveRenderingDisabled(). This implementation invokes |
| 87 // SchedulesPaint as necessary. |
| 88 virtual void ShouldPaintAsActiveChanged(); |
| 89 |
89 private: | 90 private: |
90 // True when the non-client view should always be rendered as if the window | 91 // True when the non-client view should always be rendered as if the window |
91 // were active, regardless of whether or not the top level window actually | 92 // were active, regardless of whether or not the top level window actually |
92 // is active. | 93 // is active. |
93 bool paint_as_active_; | 94 bool paint_as_active_; |
94 }; | 95 }; |
95 | 96 |
96 //////////////////////////////////////////////////////////////////////////////// | 97 //////////////////////////////////////////////////////////////////////////////// |
97 // NonClientView | 98 // NonClientView |
98 // | 99 // |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 154 |
154 // Changes the frame from native to custom depending on the value of | 155 // Changes the frame from native to custom depending on the value of |
155 // |use_native_frame|. | 156 // |use_native_frame|. |
156 void UpdateFrame(); | 157 void UpdateFrame(); |
157 | 158 |
158 // Prevents the window from being rendered as deactivated when |disable| is | 159 // Prevents the window from being rendered as deactivated when |disable| is |
159 // true, until called with |disable| false. Used when a sub-window is to be | 160 // true, until called with |disable| false. Used when a sub-window is to be |
160 // shown that shouldn't visually de-activate the window. | 161 // shown that shouldn't visually de-activate the window. |
161 // Subclasses can override this to perform additional actions when this value | 162 // Subclasses can override this to perform additional actions when this value |
162 // changes. | 163 // changes. |
163 void DisableInactiveRendering(bool disable); | 164 void SetInactiveRenderingDisabled(bool disable); |
164 | 165 |
165 // Returns the bounds of the window required to display the content area at | 166 // Returns the bounds of the window required to display the content area at |
166 // the specified bounds. | 167 // the specified bounds. |
167 gfx::Rect GetWindowBoundsForClientBounds(const gfx::Rect client_bounds) const; | 168 gfx::Rect GetWindowBoundsForClientBounds(const gfx::Rect client_bounds) const; |
168 | 169 |
169 // Determines the windows HT* code when the mouse cursor is at the | 170 // Determines the windows HT* code when the mouse cursor is at the |
170 // specified point, in window coordinates. | 171 // specified point, in window coordinates. |
171 int NonClientHitTest(const gfx::Point& point); | 172 int NonClientHitTest(const gfx::Point& point); |
172 | 173 |
173 // Returns a mask to be used to clip the top level window for the given | 174 // Returns a mask to be used to clip the top level window for the given |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 231 |
231 // The accessible name of this view. | 232 // The accessible name of this view. |
232 string16 accessible_name_; | 233 string16 accessible_name_; |
233 | 234 |
234 DISALLOW_COPY_AND_ASSIGN(NonClientView); | 235 DISALLOW_COPY_AND_ASSIGN(NonClientView); |
235 }; | 236 }; |
236 | 237 |
237 } // namespace views | 238 } // namespace views |
238 | 239 |
239 #endif // #ifndef VIEWS_WINDOW_NON_CLIENT_VIEW_H_ | 240 #endif // #ifndef VIEWS_WINDOW_NON_CLIENT_VIEW_H_ |
OLD | NEW |