| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/views/non_client_view.h" | 5 #include "chrome/views/non_client_view.h" |
| 6 #include "chrome/views/widget.h" |
| 6 | 7 |
| 7 namespace views { | 8 namespace views { |
| 8 | 9 |
| 9 const int NonClientView::kFrameShadowThickness = 1; | 10 const int NonClientView::kFrameShadowThickness = 1; |
| 10 const int NonClientView::kClientEdgeThickness = 1; | 11 const int NonClientView::kClientEdgeThickness = 1; |
| 11 | 12 |
| 13 //////////////////////////////////////////////////////////////////////////////// |
| 14 // NonClientView, public: |
| 15 |
| 16 NonClientView::NonClientView() : paint_as_active_(false) { |
| 17 } |
| 18 |
| 19 NonClientView::~NonClientView() { |
| 20 } |
| 21 |
| 22 bool NonClientView::CanClose() const { |
| 23 return client_view_->CanClose(); |
| 24 } |
| 25 |
| 26 void NonClientView::WindowClosing() { |
| 27 client_view_->WindowClosing(); |
| 28 } |
| 29 |
| 30 gfx::Rect NonClientView::CalculateClientAreaBounds(int width, |
| 31 int height) const { |
| 32 return gfx::Rect(); |
| 33 } |
| 34 |
| 35 gfx::Size NonClientView::CalculateWindowSizeForClientSize(int width, |
| 36 int height) const { |
| 37 return gfx::Size(); |
| 38 } |
| 39 |
| 40 gfx::Point NonClientView::GetSystemMenuPoint() const { |
| 41 CPoint temp(0, -kFrameShadowThickness); |
| 42 MapWindowPoints(GetWidget()->GetHWND(), HWND_DESKTOP, &temp, 1); |
| 43 return gfx::Point(temp); |
| 44 } |
| 45 |
| 46 int NonClientView::NonClientHitTest(const gfx::Point& point) { |
| 47 return client_view_->NonClientHitTest(point); |
| 48 } |
| 49 |
| 50 void NonClientView::GetWindowMask(const gfx::Size& size, |
| 51 gfx::Path* window_mask) { |
| 52 } |
| 53 |
| 54 void NonClientView::EnableClose(bool enable) { |
| 55 } |
| 56 |
| 57 void NonClientView::ResetWindowControls() { |
| 58 } |
| 59 |
| 60 |
| 61 //////////////////////////////////////////////////////////////////////////////// |
| 62 // NonClientView, View overrides: |
| 63 |
| 64 gfx::Size NonClientView::GetPreferredSize() { |
| 65 return client_view_->GetPreferredSize(); |
| 66 } |
| 67 |
| 68 void NonClientView::Layout() { |
| 69 client_view_->SetBounds(0, 0, width(), height()); |
| 70 } |
| 71 |
| 72 void NonClientView::ViewHierarchyChanged(bool is_add, View* parent, |
| 73 View* child) { |
| 74 // Add our Client View as we are added to the Widget so that if we are |
| 75 // subsequently resized all the parent-child relationships are established. |
| 76 if (is_add && GetWidget() && child == this) |
| 77 AddChildView(client_view_); |
| 78 } |
| 79 |
| 80 //////////////////////////////////////////////////////////////////////////////// |
| 81 // NonClientView, protected: |
| 82 |
| 12 int NonClientView::GetHTComponentForFrame(const gfx::Point& point, | 83 int NonClientView::GetHTComponentForFrame(const gfx::Point& point, |
| 13 int top_resize_border_height, | 84 int top_resize_border_height, |
| 14 int resize_border_thickness, | 85 int resize_border_thickness, |
| 15 int top_resize_corner_height, | 86 int top_resize_corner_height, |
| 16 int resize_corner_width, | 87 int resize_corner_width, |
| 17 bool can_resize) { | 88 bool can_resize) { |
| 18 // Tricky: In XP, native behavior is to return HTTOPLEFT and HTTOPRIGHT for | 89 // Tricky: In XP, native behavior is to return HTTOPLEFT and HTTOPRIGHT for |
| 19 // a |resize_corner_size|-length strip of both the side and top borders, but | 90 // a |resize_corner_size|-length strip of both the side and top borders, but |
| 20 // only to return HTBOTTOMLEFT/HTBOTTOMRIGHT along the bottom border + corner | 91 // only to return HTBOTTOMLEFT/HTBOTTOMRIGHT along the bottom border + corner |
| 21 // (not the side border). Vista goes further and doesn't return these on any | 92 // (not the side border). Vista goes further and doesn't return these on any |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 return HTNOWHERE; | 124 return HTNOWHERE; |
| 54 } | 125 } |
| 55 | 126 |
| 56 // If the window can't be resized, there are no resize boundaries, just | 127 // If the window can't be resized, there are no resize boundaries, just |
| 57 // window borders. | 128 // window borders. |
| 58 return can_resize ? component : HTBORDER; | 129 return can_resize ? component : HTBORDER; |
| 59 } | 130 } |
| 60 | 131 |
| 61 } // namespace views | 132 } // namespace views |
| 62 | 133 |
| OLD | NEW |