OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 virtual void OnDragExited() { | 72 virtual void OnDragExited() { |
73 DCHECK(host_->GetMenuItem()->GetMenuController()); | 73 DCHECK(host_->GetMenuItem()->GetMenuController()); |
74 host_->GetMenuItem()->GetMenuController()->OnDragExitedScrollButton(host_); | 74 host_->GetMenuItem()->GetMenuController()->OnDragExitedScrollButton(host_); |
75 } | 75 } |
76 | 76 |
77 virtual int OnPerformDrop(const DropTargetEvent& event) { | 77 virtual int OnPerformDrop(const DropTargetEvent& event) { |
78 return DragDropTypes::DRAG_NONE; | 78 return DragDropTypes::DRAG_NONE; |
79 } | 79 } |
80 | 80 |
81 virtual void Paint(gfx::Canvas* canvas) { | 81 virtual void Paint(gfx::Canvas* canvas) { |
| 82 const MenuConfig& config = MenuConfig::instance(); |
| 83 |
82 #if defined(OS_WIN) | 84 #if defined(OS_WIN) |
83 const MenuConfig& config = MenuConfig::instance(); | |
84 HDC dc = canvas->beginPlatformPaint(); | 85 HDC dc = canvas->beginPlatformPaint(); |
85 | 86 |
86 // The background. | 87 // The background. |
87 RECT item_bounds = { 0, 0, width(), height() }; | 88 RECT item_bounds = { 0, 0, width(), height() }; |
88 NativeTheme::instance()->PaintMenuItemBackground( | 89 NativeTheme::instance()->PaintMenuItemBackground( |
89 NativeTheme::MENU, dc, MENU_POPUPITEM, MPI_NORMAL, false, | 90 NativeTheme::MENU, dc, MENU_POPUPITEM, MPI_NORMAL, false, |
90 &item_bounds); | 91 &item_bounds); |
| 92 canvas->endPlatformPaint(); |
| 93 |
| 94 SkColor arrow_color = color_utils::GetSysSkColor(COLOR_MENUTEXT); |
| 95 #else |
| 96 SkColor arrow_color = SK_ColorBLACK; |
| 97 #endif |
91 | 98 |
92 // Then the arrow. | 99 // Then the arrow. |
93 int x = width() / 2; | 100 int x = width() / 2; |
94 int y = (height() - config.scroll_arrow_height) / 2; | 101 int y = (height() - config.scroll_arrow_height) / 2; |
95 int delta_y = 1; | 102 int delta_y = 1; |
96 if (!is_up_) { | 103 if (!is_up_) { |
97 delta_y = -1; | 104 delta_y = -1; |
98 y += config.scroll_arrow_height; | 105 y += config.scroll_arrow_height; |
99 } | 106 } |
100 SkColor arrow_color = color_utils::GetSysSkColor(COLOR_MENUTEXT); | |
101 for (int i = 0; i < config.scroll_arrow_height; ++i, --x, y += delta_y) | 107 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); | 108 canvas->FillRectInt(arrow_color, x, y, (i * 2) + 1, 1); |
103 | |
104 canvas->endPlatformPaint(); | |
105 #else | |
106 NOTIMPLEMENTED(); | |
107 #endif | |
108 } | 109 } |
109 | 110 |
110 private: | 111 private: |
111 // SubmenuView we were created for. | 112 // SubmenuView we were created for. |
112 SubmenuView* host_; | 113 SubmenuView* host_; |
113 | 114 |
114 // Direction of the button. | 115 // Direction of the button. |
115 bool is_up_; | 116 bool is_up_; |
116 | 117 |
117 // Preferred height. | 118 // Preferred height. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 226 } |
226 | 227 |
227 gfx::Size MenuScrollViewContainer::GetPreferredSize() { | 228 gfx::Size MenuScrollViewContainer::GetPreferredSize() { |
228 gfx::Size prefsize = scroll_view_->GetContents()->GetPreferredSize(); | 229 gfx::Size prefsize = scroll_view_->GetContents()->GetPreferredSize(); |
229 gfx::Insets insets = GetInsets(); | 230 gfx::Insets insets = GetInsets(); |
230 prefsize.Enlarge(insets.width(), insets.height()); | 231 prefsize.Enlarge(insets.width(), insets.height()); |
231 return prefsize; | 232 return prefsize; |
232 } | 233 } |
233 | 234 |
234 } // namespace views | 235 } // namespace views |
OLD | NEW |