| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/menu/menu_item_view.h" | 5 #include "ui/views/controls/menu/menu_item_view.h" |
| 6 | 6 |
| 7 #include <uxtheme.h> | 7 #include <uxtheme.h> |
| 8 #include <Vssym32.h> | 8 #include <Vssym32.h> |
| 9 | 9 |
| 10 #include "grit/ui_strings.h" | 10 #include "grit/ui_strings.h" |
| 11 #include "ui/gfx/canvas_skia.h" | 11 #include "ui/gfx/canvas_skia.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 const gfx::Font& font = GetFont(); | 85 const gfx::Font& font = GetFont(); |
| 86 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); | 86 int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); |
| 87 int width = this->width() - item_right_margin_ - label_start_ - accel_width; | 87 int width = this->width() - item_right_margin_ - label_start_ - accel_width; |
| 88 gfx::Rect text_bounds(label_start_, top_margin, width, font.GetHeight()); | 88 gfx::Rect text_bounds(label_start_, top_margin, width, font.GetHeight()); |
| 89 text_bounds.set_x(GetMirroredXForRect(text_bounds)); | 89 text_bounds.set_x(GetMirroredXForRect(text_bounds)); |
| 90 if (mode == PB_FOR_DRAG) { | 90 if (mode == PB_FOR_DRAG) { |
| 91 // With different themes, it's difficult to tell what the correct | 91 // With different themes, it's difficult to tell what the correct |
| 92 // foreground and background colors are for the text to draw the correct | 92 // foreground and background colors are for the text to draw the correct |
| 93 // halo. Instead, just draw black on white, which will look good in most | 93 // halo. Instead, just draw black on white, which will look good in most |
| 94 // cases. | 94 // cases. |
| 95 canvas->AsCanvasSkia()->DrawStringWithHalo( | 95 canvas->DrawStringWithHalo( |
| 96 title(), font, 0x00000000, 0xFFFFFFFF, text_bounds.x(), | 96 title(), font, 0x00000000, 0xFFFFFFFF, text_bounds.x(), |
| 97 text_bounds.y(), text_bounds.width(), text_bounds.height(), | 97 text_bounds.y(), text_bounds.width(), text_bounds.height(), |
| 98 GetRootMenuItem()->GetDrawStringFlags()); | 98 GetRootMenuItem()->GetDrawStringFlags()); |
| 99 } else { | 99 } else { |
| 100 canvas->DrawStringInt(title(), font, fg_color, | 100 canvas->DrawStringInt(title(), font, fg_color, |
| 101 text_bounds.x(), text_bounds.y(), text_bounds.width(), | 101 text_bounds.x(), text_bounds.y(), text_bounds.width(), |
| 102 text_bounds.height(), | 102 text_bounds.height(), |
| 103 GetRootMenuItem()->GetDrawStringFlags()); | 103 GetRootMenuItem()->GetDrawStringFlags()); |
| 104 } | 104 } |
| 105 | 105 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 NativeTheme::kMenuCheckBackground, state, bg_bounds, extra); | 162 NativeTheme::kMenuCheckBackground, state, bg_bounds, extra); |
| 163 | 163 |
| 164 // And the check. | 164 // And the check. |
| 165 gfx::Rect icon_bounds(icon_x / 2, icon_y, icon_width, icon_height); | 165 gfx::Rect icon_bounds(icon_x / 2, icon_y, icon_width, icon_height); |
| 166 AdjustBoundsForRTLUI(&icon_bounds); | 166 AdjustBoundsForRTLUI(&icon_bounds); |
| 167 NativeTheme::instance()->Paint(canvas->GetSkCanvas(), | 167 NativeTheme::instance()->Paint(canvas->GetSkCanvas(), |
| 168 NativeTheme::kMenuCheck, state, bg_bounds, extra); | 168 NativeTheme::kMenuCheck, state, bg_bounds, extra); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace views | 171 } // namespace views |
| OLD | NEW |