Chromium Code Reviews| 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 | 9 |
| 10 namespace gfx { | 10 namespace gfx { |
| 11 class Path; | 11 class Path; |
| 12 } | 12 } |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 | 15 |
| 16 class ClientView; | 16 class ClientView; |
| 17 | 17 |
| 18 //////////////////////////////////////////////////////////////////////////////// | 18 //////////////////////////////////////////////////////////////////////////////// |
| 19 // NonClientFrameView | 19 // NonClientFrameView |
| 20 // | 20 // |
| 21 // An object that subclasses NonClientFrameView is a View that renders and | 21 // 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 | 22 // 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 | 23 // window. This view does _not_ contain the ClientView, but rather is a sibling |
| 24 // of it. | 24 // of it. |
| 25 class VIEWS_EXPORT NonClientFrameView : public View { | 25 class VIEWS_EXPORT NonClientFrameView : public View { |
| 26 public: | 26 public: |
| 27 // Internal class name. | 27 // Internal class name. |
| 28 static const char kViewClassName[]; | 28 static const char kViewClassName[]; |
| 29 | 29 |
| 30 virtual ~NonClientFrameView(); | |
|
sky
2014/01/06 19:13:49
nit: after enum.
| |
| 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 |
| 36 // frame border. | 38 // frame border. |
| 37 kClientEdgeThickness = 1, | 39 kClientEdgeThickness = 1, |
| 38 }; | 40 }; |
| 39 | 41 |
| 40 // Sets whether the window should be rendered as active regardless of the | 42 // Sets whether the window should be rendered as active regardless of the |
| 41 // actual active state. Used when bubbles become active to make their parent | 43 // actual active state. Used when bubbles become active to make their parent |
| 42 // appear active. A value of true makes the window render as active always, | 44 // appear active. A value of true makes the window render as active always, |
| 43 // false gives normal behavior. | 45 // false gives normal behavior. |
| 44 void SetInactiveRenderingDisabled(bool disable); | 46 void SetInactiveRenderingDisabled(bool disable); |
| 45 | 47 |
| 48 // Used to determine if the frame should be painted as active. Keyed off the | |
| 49 // window's actual active state and |inactive_rendering_disabled_|. | |
| 50 bool ShouldPaintAsActive() const; | |
| 51 | |
| 46 // Helper for non-client view implementations to determine which area of the | 52 // Helper for non-client view implementations to determine which area of the |
| 47 // window border the specified |point| falls within. The other parameters are | 53 // window border the specified |point| falls within. The other parameters are |
| 48 // the size of the sizing edges, and whether or not the window can be | 54 // the size of the sizing edges, and whether or not the window can be |
| 49 // resized. | 55 // resized. |
| 50 int GetHTComponentForFrame(const gfx::Point& point, | 56 int GetHTComponentForFrame(const gfx::Point& point, |
| 51 int top_resize_border_height, | 57 int top_resize_border_height, |
| 52 int resize_border_thickness, | 58 int resize_border_thickness, |
| 53 int top_resize_corner_height, | 59 int top_resize_corner_height, |
| 54 int resize_corner_width, | 60 int resize_corner_width, |
| 55 bool can_resize); | 61 bool can_resize); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 73 virtual void UpdateWindowTitle() = 0; | 79 virtual void UpdateWindowTitle() = 0; |
| 74 | 80 |
| 75 // Overridden from View: | 81 // Overridden from View: |
| 76 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | 82 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; |
| 77 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 83 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 78 virtual const char* GetClassName() const OVERRIDE; | 84 virtual const char* GetClassName() const OVERRIDE; |
| 79 | 85 |
| 80 protected: | 86 protected: |
| 81 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 87 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
| 82 | 88 |
| 83 NonClientFrameView() : paint_as_active_(false) {} | 89 NonClientFrameView(); |
| 84 | |
| 85 // Used to determine if the frame should be painted as active. Keyed off the | |
| 86 // window's actual active state and the override, see | |
| 87 // SetInactiveRenderingDisabled() above. | |
| 88 bool ShouldPaintAsActive() const; | |
| 89 | |
| 90 // Invoked from SetInactiveRenderingDisabled(). This implementation invokes | |
| 91 // SchedulesPaint as necessary. | |
| 92 virtual void ShouldPaintAsActiveChanged(); | |
| 93 | 90 |
| 94 private: | 91 private: |
| 95 // True when the non-client view should always be rendered as if the window | 92 // Prevents the non-client frame view from being rendered as inactive when |
| 96 // were active, regardless of whether or not the top level window actually | 93 // true. |
| 97 // is active. | 94 bool inactive_rendering_disabled_; |
| 98 bool paint_as_active_; | |
| 99 }; | 95 }; |
| 100 | 96 |
| 101 //////////////////////////////////////////////////////////////////////////////// | 97 //////////////////////////////////////////////////////////////////////////////// |
| 102 // NonClientView | 98 // NonClientView |
| 103 // | 99 // |
| 104 // The NonClientView is the logical root of all Views contained within a | 100 // The NonClientView is the logical root of all Views contained within a |
| 105 // Window, except for the RootView which is its parent and of which it is the | 101 // Window, except for the RootView which is its parent and of which it is the |
| 106 // sole child. The NonClientView has two children, the NonClientFrameView which | 102 // sole child. The NonClientView has two children, the NonClientFrameView which |
| 107 // is responsible for painting and responding to events from the non-client | 103 // is responsible for painting and responding to events from the non-client |
| 108 // portions of the window, and the ClientView, which is responsible for the | 104 // portions of the window, and the ClientView, which is responsible for the |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 // Called by the containing Window when it is closed. | 155 // Called by the containing Window when it is closed. |
| 160 void WindowClosing(); | 156 void WindowClosing(); |
| 161 | 157 |
| 162 // Replaces the frame view with a new one. Used when switching window theme | 158 // Replaces the frame view with a new one. Used when switching window theme |
| 163 // or frame style. | 159 // or frame style. |
| 164 void UpdateFrame(); | 160 void UpdateFrame(); |
| 165 | 161 |
| 166 // Prevents the window from being rendered as deactivated when |disable| is | 162 // Prevents the window from being rendered as deactivated when |disable| is |
| 167 // true, until called with |disable| false. Used when a sub-window is to be | 163 // true, until called with |disable| false. Used when a sub-window is to be |
| 168 // shown that shouldn't visually de-activate the window. | 164 // shown that shouldn't visually de-activate the window. |
| 169 // Subclasses can override this to perform additional actions when this value | |
| 170 // changes. | |
| 171 void SetInactiveRenderingDisabled(bool disable); | 165 void SetInactiveRenderingDisabled(bool disable); |
| 172 | 166 |
| 173 // Returns the bounds of the window required to display the content area at | 167 // Returns the bounds of the window required to display the content area at |
| 174 // the specified bounds. | 168 // the specified bounds. |
| 175 gfx::Rect GetWindowBoundsForClientBounds(const gfx::Rect client_bounds) const; | 169 gfx::Rect GetWindowBoundsForClientBounds(const gfx::Rect client_bounds) const; |
| 176 | 170 |
| 177 // Determines the windows HT* code when the mouse cursor is at the | 171 // Determines the windows HT* code when the mouse cursor is at the |
| 178 // specified point, in window coordinates. | 172 // specified point, in window coordinates. |
| 179 int NonClientHitTest(const gfx::Point& point); | 173 int NonClientHitTest(const gfx::Point& point); |
| 180 | 174 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 | 238 |
| 245 // The accessible name of this view. | 239 // The accessible name of this view. |
| 246 base::string16 accessible_name_; | 240 base::string16 accessible_name_; |
| 247 | 241 |
| 248 DISALLOW_COPY_AND_ASSIGN(NonClientView); | 242 DISALLOW_COPY_AND_ASSIGN(NonClientView); |
| 249 }; | 243 }; |
| 250 | 244 |
| 251 } // namespace views | 245 } // namespace views |
| 252 | 246 |
| 253 #endif // UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_ | 247 #endif // UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_ |
| OLD | NEW |