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 #include "views/window/non_client_view.h" | 5 #include "views/window/non_client_view.h" |
6 | 6 |
7 #include "ui/base/accessibility/accessible_view_state.h" | 7 #include "ui/base/accessibility/accessible_view_state.h" |
8 #include "views/widget/root_view.h" | 8 #include "views/widget/root_view.h" |
9 #include "views/widget/widget.h" | 9 #include "views/widget/widget.h" |
10 #include "views/window/client_view.h" | 10 #include "views/window/client_view.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 void NonClientView::UpdateFrame() { | 65 void NonClientView::UpdateFrame() { |
66 Widget* widget = GetWidget(); | 66 Widget* widget = GetWidget(); |
67 SetFrameView(widget->CreateNonClientFrameView()); | 67 SetFrameView(widget->CreateNonClientFrameView()); |
68 widget->ThemeChanged(); | 68 widget->ThemeChanged(); |
69 Layout(); | 69 Layout(); |
70 SchedulePaint(); | 70 SchedulePaint(); |
71 widget->UpdateFrameAfterFrameChange(); | 71 widget->UpdateFrameAfterFrameChange(); |
72 } | 72 } |
73 | 73 |
74 void NonClientView::DisableInactiveRendering(bool disable) { | 74 void NonClientView::SetInactiveRenderingDisabled(bool disable) { |
75 frame_view_->DisableInactiveRendering(disable); | 75 frame_view_->SetInactiveRenderingDisabled(disable); |
76 } | 76 } |
77 | 77 |
78 gfx::Rect NonClientView::GetWindowBoundsForClientBounds( | 78 gfx::Rect NonClientView::GetWindowBoundsForClientBounds( |
79 const gfx::Rect client_bounds) const { | 79 const gfx::Rect client_bounds) const { |
80 return frame_view_->GetWindowBoundsForClientBounds(client_bounds); | 80 return frame_view_->GetWindowBoundsForClientBounds(client_bounds); |
81 } | 81 } |
82 | 82 |
83 int NonClientView::NonClientHitTest(const gfx::Point& point) { | 83 int NonClientView::NonClientHitTest(const gfx::Point& point) { |
84 // The NonClientFrameView is responsible for also asking the ClientView. | 84 // The NonClientFrameView is responsible for also asking the ClientView. |
85 return frame_view_->NonClientHitTest(point); | 85 return frame_view_->NonClientHitTest(point); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // return true for area not occupied by the client view. | 177 // return true for area not occupied by the client view. |
178 gfx::Point point_in_child_coords(point); | 178 gfx::Point point_in_child_coords(point); |
179 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); | 179 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); |
180 if (frame_view_->HitTest(point_in_child_coords)) | 180 if (frame_view_->HitTest(point_in_child_coords)) |
181 return frame_view_->GetEventHandlerForPoint(point_in_child_coords); | 181 return frame_view_->GetEventHandlerForPoint(point_in_child_coords); |
182 | 182 |
183 return View::GetEventHandlerForPoint(point); | 183 return View::GetEventHandlerForPoint(point); |
184 } | 184 } |
185 | 185 |
186 //////////////////////////////////////////////////////////////////////////////// | 186 //////////////////////////////////////////////////////////////////////////////// |
| 187 // NonClientFrameView, public: |
| 188 |
| 189 void NonClientFrameView::SetInactiveRenderingDisabled(bool disable) { |
| 190 if (paint_as_active_ == disable) |
| 191 return; |
| 192 |
| 193 paint_as_active_ = disable; |
| 194 ShouldPaintAsActiveChanged(); |
| 195 } |
| 196 |
| 197 //////////////////////////////////////////////////////////////////////////////// |
187 // NonClientFrameView, View overrides: | 198 // NonClientFrameView, View overrides: |
188 | 199 |
189 bool NonClientFrameView::HitTest(const gfx::Point& l) const { | 200 bool NonClientFrameView::HitTest(const gfx::Point& l) const { |
190 // For the default case, we assume the non-client frame view never overlaps | 201 // For the default case, we assume the non-client frame view never overlaps |
191 // the client view. | 202 // the client view. |
192 return !GetWidget()->client_view()->bounds().Contains(l); | 203 return !GetWidget()->client_view()->bounds().Contains(l); |
193 } | 204 } |
194 | 205 |
195 //////////////////////////////////////////////////////////////////////////////// | 206 //////////////////////////////////////////////////////////////////////////////// |
196 // NonClientFrameView, protected: | 207 // NonClientFrameView, protected: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 252 |
242 // If the window can't be resized, there are no resize boundaries, just | 253 // If the window can't be resized, there are no resize boundaries, just |
243 // window borders. | 254 // window borders. |
244 return can_resize ? component : HTBORDER; | 255 return can_resize ? component : HTBORDER; |
245 } | 256 } |
246 | 257 |
247 bool NonClientFrameView::ShouldPaintAsActive() const { | 258 bool NonClientFrameView::ShouldPaintAsActive() const { |
248 return GetWidget()->IsActive() || paint_as_active_; | 259 return GetWidget()->IsActive() || paint_as_active_; |
249 } | 260 } |
250 | 261 |
| 262 void NonClientFrameView::ShouldPaintAsActiveChanged() { |
| 263 if (!paint_as_active_) |
| 264 SchedulePaint(); |
| 265 } |
| 266 |
251 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { | 267 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { |
252 state->role = ui::AccessibilityTypes::ROLE_WINDOW; | 268 state->role = ui::AccessibilityTypes::ROLE_WINDOW; |
253 } | 269 } |
254 | 270 |
255 std::string NonClientFrameView::GetClassName() const { | 271 std::string NonClientFrameView::GetClassName() const { |
256 return kViewClassName; | 272 return kViewClassName; |
257 } | 273 } |
258 | 274 |
259 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 275 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
260 // Overridden to do nothing. The NonClientView manually calls Layout on the | 276 // Overridden to do nothing. The NonClientView manually calls Layout on the |
261 // FrameView when it is itself laid out, see comment in NonClientView::Layout. | 277 // FrameView when it is itself laid out, see comment in NonClientView::Layout. |
262 } | 278 } |
263 | 279 |
264 } // namespace views | 280 } // namespace views |
OLD | NEW |