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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 SkXfermode::kSrc_Mode); | 223 SkXfermode::kSrc_Mode); |
224 #endif | 224 #endif |
225 } | 225 } |
226 | 226 |
227 void MenuScrollViewContainer::Layout() { | 227 void MenuScrollViewContainer::Layout() { |
228 gfx::Insets insets = GetInsets(); | 228 gfx::Insets insets = GetInsets(); |
229 int x = insets.left(); | 229 int x = insets.left(); |
230 int y = insets.top(); | 230 int y = insets.top(); |
231 int width = View::width() - insets.width(); | 231 int width = View::width() - insets.width(); |
232 int content_height = height() - insets.height(); | 232 int content_height = height() - insets.height(); |
233 if (!scroll_up_button_->IsVisible()) { | 233 if (!scroll_up_button_->visible()) { |
234 scroll_view_->SetBounds(x, y, width, content_height); | 234 scroll_view_->SetBounds(x, y, width, content_height); |
235 scroll_view_->Layout(); | 235 scroll_view_->Layout(); |
236 return; | 236 return; |
237 } | 237 } |
238 | 238 |
239 gfx::Size pref = scroll_up_button_->GetPreferredSize(); | 239 gfx::Size pref = scroll_up_button_->GetPreferredSize(); |
240 scroll_up_button_->SetBounds(x, y, width, pref.height()); | 240 scroll_up_button_->SetBounds(x, y, width, pref.height()); |
241 content_height -= pref.height(); | 241 content_height -= pref.height(); |
242 | 242 |
243 const int scroll_view_y = y + pref.height(); | 243 const int scroll_view_y = y + pref.height(); |
(...skipping 28 matching lines...) Expand all 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 |