OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/touchui/touch_editing_menu.h" | 5 #include "ui/views/touchui/touch_editing_menu.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/base/l10n/l10n_util.h" | 8 #include "ui/base/l10n/l10n_util.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 button->set_request_focus_on_press(false); | 147 button->set_request_focus_on_press(false); |
148 const gfx::FontList& font_list = | 148 const gfx::FontList& font_list = |
149 ui::ResourceBundle::GetSharedInstance().GetFontList( | 149 ui::ResourceBundle::GetSharedInstance().GetFontList( |
150 ui::ResourceBundle::SmallFont); | 150 ui::ResourceBundle::SmallFont); |
151 scoped_ptr<LabelButtonBorder> button_border( | 151 scoped_ptr<LabelButtonBorder> button_border( |
152 new LabelButtonBorder(button->style())); | 152 new LabelButtonBorder(button->style())); |
153 int v_border = (kMenuButtonHeight - font_list.GetHeight()) / 2; | 153 int v_border = (kMenuButtonHeight - font_list.GetHeight()) / 2; |
154 int h_border = (kMenuButtonWidth - gfx::GetStringWidth(label, font_list)) / 2; | 154 int h_border = (kMenuButtonWidth - gfx::GetStringWidth(label, font_list)) / 2; |
155 button_border->set_insets( | 155 button_border->set_insets( |
156 gfx::Insets(v_border, h_border, v_border, h_border)); | 156 gfx::Insets(v_border, h_border, v_border, h_border)); |
157 button->SetBorder(button_border.PassAs<Border>()); | 157 button->SetBorder(button_border.Pass()); |
158 button->SetFontList(font_list); | 158 button->SetFontList(font_list); |
159 button->set_tag(tag); | 159 button->set_tag(tag); |
160 return button; | 160 return button; |
161 } | 161 } |
162 | 162 |
163 } // namespace views | 163 } // namespace views |
OLD | NEW |