| 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 "views/controls/scrollbar/native_scroll_bar.h" | 5 #include "views/controls/scrollbar/native_scroll_bar.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlapp.h> | 8 #include <atlapp.h> |
| 9 #include <atlwin.h> | 9 #include <atlwin.h> |
| 10 #include <atlcrack.h> | 10 #include <atlcrack.h> |
| 11 #include <atlframe.h> | 11 #include <atlframe.h> |
| 12 #include <atlmisc.h> | 12 #include <atlmisc.h> |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
| 16 #include "views/controls/hwnd_view.h" | 16 #include "views/controls/native/native_view_host.h" |
| 17 #include "views/widget/widget.h" | 17 #include "views/widget/widget.h" |
| 18 | 18 |
| 19 namespace views { | 19 namespace views { |
| 20 | 20 |
| 21 ///////////////////////////////////////////////////////////////////////////// | 21 ///////////////////////////////////////////////////////////////////////////// |
| 22 // | 22 // |
| 23 // ScrollBarContainer | 23 // ScrollBarContainer |
| 24 // | 24 // |
| 25 // Since windows scrollbar only send notifications to their parent hwnd, we | 25 // Since windows scrollbar only send notifications to their parent hwnd, we |
| 26 // use instance of this class to wrap native scrollbars. | 26 // use instance of this class to wrap native scrollbars. |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // widget tree. | 224 // widget tree. |
| 225 ::DestroyWindow(*sb_container_); | 225 ::DestroyWindow(*sb_container_); |
| 226 delete sb_container_; | 226 delete sb_container_; |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 void NativeScrollBar::ViewHierarchyChanged(bool is_add, View *parent, | 230 void NativeScrollBar::ViewHierarchyChanged(bool is_add, View *parent, |
| 231 View *child) { | 231 View *child) { |
| 232 Widget* widget; | 232 Widget* widget; |
| 233 if (is_add && (widget = GetWidget()) && !sb_view_) { | 233 if (is_add && (widget = GetWidget()) && !sb_view_) { |
| 234 sb_view_ = new HWNDView(); | 234 sb_view_ = new NativeViewHost; |
| 235 AddChildView(sb_view_); | 235 AddChildView(sb_view_); |
| 236 sb_container_ = new ScrollBarContainer(this); | 236 sb_container_ = new ScrollBarContainer(this); |
| 237 sb_view_->Attach(*sb_container_); | 237 sb_view_->Attach(*sb_container_); |
| 238 Layout(); | 238 Layout(); |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 void NativeScrollBar::Layout() { | 242 void NativeScrollBar::Layout() { |
| 243 if (sb_view_) | 243 if (sb_view_) |
| 244 sb_view_->SetBounds(GetLocalBounds(true)); | 244 sb_view_->SetBounds(GetLocalBounds(true)); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 int NativeScrollBar::GetHorizontalScrollBarHeight() { | 348 int NativeScrollBar::GetHorizontalScrollBarHeight() { |
| 349 return ::GetSystemMetrics(SM_CYHSCROLL); | 349 return ::GetSystemMetrics(SM_CYHSCROLL); |
| 350 } | 350 } |
| 351 | 351 |
| 352 //static | 352 //static |
| 353 int NativeScrollBar::GetVerticalScrollBarWidth() { | 353 int NativeScrollBar::GetVerticalScrollBarWidth() { |
| 354 return ::GetSystemMetrics(SM_CXVSCROLL); | 354 return ::GetSystemMetrics(SM_CXVSCROLL); |
| 355 } | 355 } |
| 356 | 356 |
| 357 } // namespace views | 357 } // namespace views |
| OLD | NEW |