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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 // Then the arrow. | 93 // Then the arrow. |
94 int x = width() / 2; | 94 int x = width() / 2; |
95 int y = (height() - config.scroll_arrow_height) / 2; | 95 int y = (height() - config.scroll_arrow_height) / 2; |
96 int delta_y = 1; | 96 int delta_y = 1; |
97 if (!is_up_) { | 97 if (!is_up_) { |
98 delta_y = -1; | 98 delta_y = -1; |
99 y += config.scroll_arrow_height; | 99 y += config.scroll_arrow_height; |
100 } | 100 } |
101 for (int i = 0; i < config.scroll_arrow_height; ++i, --x, y += delta_y) | 101 for (int i = 0; i < config.scroll_arrow_height; ++i, --x, y += delta_y) |
102 canvas->FillRectInt(arrow_color, x, y, (i * 2) + 1, 1); | 102 canvas->FillRect(arrow_color, gfx::Rect(x, y, (i * 2) + 1, 1)); |
103 } | 103 } |
104 | 104 |
105 private: | 105 private: |
106 // SubmenuView we were created for. | 106 // SubmenuView we were created for. |
107 SubmenuView* host_; | 107 SubmenuView* host_; |
108 | 108 |
109 // Direction of the button. | 109 // Direction of the button. |
110 bool is_up_; | 110 bool is_up_; |
111 | 111 |
112 // Preferred height. | 112 // Preferred height. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 void MenuScrollViewContainer::OnBoundsChanged( | 239 void MenuScrollViewContainer::OnBoundsChanged( |
240 const gfx::Rect& previous_bounds) { | 240 const gfx::Rect& previous_bounds) { |
241 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); | 241 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); |
242 scroll_up_button_->SetVisible(content_pref.height() > height()); | 242 scroll_up_button_->SetVisible(content_pref.height() > height()); |
243 scroll_down_button_->SetVisible(content_pref.height() > height()); | 243 scroll_down_button_->SetVisible(content_pref.height() > height()); |
244 Layout(); | 244 Layout(); |
245 } | 245 } |
246 | 246 |
247 } // namespace views | 247 } // namespace views |
OLD | NEW |