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/controls/menu/menu_scroll_view_container.h" | 5 #include "views/controls/menu/menu_scroll_view_container.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <uxtheme.h> | 9 #include <uxtheme.h> |
10 #include <Vssym32.h> | 10 #include <Vssym32.h> |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Convert rect.y() to view's coordinates and make sure we don't show past | 143 // Convert rect.y() to view's coordinates and make sure we don't show past |
144 // the bottom of the view. | 144 // the bottom of the view. |
145 View* child = GetContents(); | 145 View* child = GetContents(); |
146 child->SetY(-std::max(0, std::min( | 146 child->SetY(-std::max(0, std::min( |
147 child->GetPreferredSize().height() - this->height(), | 147 child->GetPreferredSize().height() - this->height(), |
148 rect.y() - child->y()))); | 148 rect.y() - child->y()))); |
149 } | 149 } |
150 | 150 |
151 // Returns the contents, which is the SubmenuView. | 151 // Returns the contents, which is the SubmenuView. |
152 View* GetContents() { | 152 View* GetContents() { |
153 return GetChildViewAt(0); | 153 return child_at(0); |
154 } | 154 } |
155 | 155 |
156 private: | 156 private: |
157 DISALLOW_COPY_AND_ASSIGN(MenuScrollView); | 157 DISALLOW_COPY_AND_ASSIGN(MenuScrollView); |
158 }; | 158 }; |
159 | 159 |
160 // MenuScrollViewContainer ---------------------------------------------------- | 160 // MenuScrollViewContainer ---------------------------------------------------- |
161 | 161 |
162 MenuScrollViewContainer::MenuScrollViewContainer(SubmenuView* content_view) | 162 MenuScrollViewContainer::MenuScrollViewContainer(SubmenuView* content_view) |
163 : content_view_(content_view) { | 163 : content_view_(content_view) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 272 |
273 void MenuScrollViewContainer::OnBoundsChanged( | 273 void MenuScrollViewContainer::OnBoundsChanged( |
274 const gfx::Rect& previous_bounds) { | 274 const gfx::Rect& previous_bounds) { |
275 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); | 275 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); |
276 scroll_up_button_->SetVisible(content_pref.height() > height()); | 276 scroll_up_button_->SetVisible(content_pref.height() > height()); |
277 scroll_down_button_->SetVisible(content_pref.height() > height()); | 277 scroll_down_button_->SetVisible(content_pref.height() > height()); |
278 Layout(); | 278 Layout(); |
279 } | 279 } |
280 | 280 |
281 } // namespace views | 281 } // namespace views |
OLD | NEW |