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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 virtual void OnPaint(gfx::Canvas* canvas) { | 81 virtual void OnPaint(gfx::Canvas* canvas) { |
82 const MenuConfig& config = MenuConfig::instance(); | 82 const MenuConfig& config = MenuConfig::instance(); |
83 | 83 |
84 #if defined(OS_WIN) | 84 #if defined(OS_WIN) |
85 // The background. | 85 // The background. |
86 gfx::Rect item_bounds(0, 0, width(), height()); | 86 gfx::Rect item_bounds(0, 0, width(), height()); |
87 NativeTheme::ExtraParams extra; | 87 NativeTheme::ExtraParams extra; |
88 extra.menu_item.is_selected = false; | 88 extra.menu_item.is_selected = false; |
89 NativeTheme::instance()->Paint(canvas->AsCanvasSkia(), | 89 NativeTheme::instance()->Paint(canvas->AsCanvasSkia()->skia_canvas(), |
90 NativeTheme::kMenuItemBackground, | 90 NativeTheme::kMenuItemBackground, |
91 NativeTheme::kNormal, item_bounds, extra); | 91 NativeTheme::kNormal, item_bounds, extra); |
92 SkColor arrow_color = color_utils::GetSysSkColor(COLOR_MENUTEXT); | 92 SkColor arrow_color = color_utils::GetSysSkColor(COLOR_MENUTEXT); |
93 #else | 93 #else |
94 SkColor arrow_color = SK_ColorBLACK; | 94 SkColor arrow_color = SK_ColorBLACK; |
95 #endif | 95 #endif |
96 | 96 |
97 // Then the arrow. | 97 // Then the arrow. |
98 int x = width() / 2; | 98 int x = width() / 2; |
99 int y = (height() - config.scroll_arrow_height) / 2; | 99 int y = (height() - config.scroll_arrow_height) / 2; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 void MenuScrollViewContainer::OnPaintBackground(gfx::Canvas* canvas) { | 179 void MenuScrollViewContainer::OnPaintBackground(gfx::Canvas* canvas) { |
180 if (background()) { | 180 if (background()) { |
181 View::OnPaintBackground(canvas); | 181 View::OnPaintBackground(canvas); |
182 return; | 182 return; |
183 } | 183 } |
184 | 184 |
185 #if defined(OS_WIN) | 185 #if defined(OS_WIN) |
186 HDC dc = canvas->BeginPlatformPaint(); | 186 HDC dc = canvas->BeginPlatformPaint(); |
187 gfx::Rect bounds(0, 0, width(), height()); | 187 gfx::Rect bounds(0, 0, width(), height()); |
188 NativeTheme::ExtraParams extra; | 188 NativeTheme::ExtraParams extra; |
189 NativeTheme::instance()->Paint(canvas->AsCanvasSkia(), | 189 NativeTheme::instance()->Paint(canvas->AsCanvasSkia()->skia_canvas(), |
190 NativeTheme::kMenuPopupBackground, NativeTheme::kNormal, bounds, extra); | 190 NativeTheme::kMenuPopupBackground, NativeTheme::kNormal, bounds, extra); |
191 canvas->EndPlatformPaint(); | 191 canvas->EndPlatformPaint(); |
192 #elif defined(OS_CHROMEOS) | 192 #elif defined(OS_CHROMEOS) |
193 static const SkColor kGradientColors[2] = { | 193 static const SkColor kGradientColors[2] = { |
194 SK_ColorWHITE, | 194 SK_ColorWHITE, |
195 SkColorSetRGB(0xF0, 0xF0, 0xF0) | 195 SkColorSetRGB(0xF0, 0xF0, 0xF0) |
196 }; | 196 }; |
197 | 197 |
198 static const SkScalar kGradientPoints[2] = { | 198 static const SkScalar kGradientPoints[2] = { |
199 SkIntToScalar(0), | 199 SkIntToScalar(0), |
(...skipping 72 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 |