| 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 "grit/ui_strings.h" | 8 #include "grit/ui_strings.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 // Finally, add ellipses button. | 122 // Finally, add ellipses button. |
| 123 AddChildView(CreateButton( | 123 AddChildView(CreateButton( |
| 124 UTF8ToUTF16(kEllipsesButtonText), kEllipsesButtonTag)); | 124 UTF8ToUTF16(kEllipsesButtonText), kEllipsesButtonTag)); |
| 125 Layout(); | 125 Layout(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 Button* TouchEditingMenuView::CreateButton(const string16& title, int tag) { | 128 Button* TouchEditingMenuView::CreateButton(const string16& title, int tag) { |
| 129 string16 label = gfx::RemoveAcceleratorChar(title, '&', NULL, NULL); | 129 string16 label = gfx::RemoveAcceleratorChar(title, '&', NULL, NULL); |
| 130 LabelButton* button = new LabelButton(this, label); | 130 LabelButton* button = new LabelButton(this, label); |
| 131 button->set_focusable(true); | 131 button->SetFocusable(true); |
| 132 button->set_request_focus_on_press(false); | 132 button->set_request_focus_on_press(false); |
| 133 gfx::Font font = ui::ResourceBundle::GetSharedInstance().GetFont( | 133 gfx::Font font = ui::ResourceBundle::GetSharedInstance().GetFont( |
| 134 ui::ResourceBundle::SmallFont); | 134 ui::ResourceBundle::SmallFont); |
| 135 scoped_ptr<LabelButtonBorder> button_border( | 135 scoped_ptr<LabelButtonBorder> button_border( |
| 136 new LabelButtonBorder(button->style())); | 136 new LabelButtonBorder(button->style())); |
| 137 int v_border = (kMenuButtonHeight - font.GetHeight()) / 2; | 137 int v_border = (kMenuButtonHeight - font.GetHeight()) / 2; |
| 138 int h_border = (kMenuButtonWidth - font.GetStringWidth(label)) / 2; | 138 int h_border = (kMenuButtonWidth - font.GetStringWidth(label)) / 2; |
| 139 button_border->set_insets( | 139 button_border->set_insets( |
| 140 gfx::Insets(v_border, h_border, v_border, h_border)); | 140 gfx::Insets(v_border, h_border, v_border, h_border)); |
| 141 button->set_border(button_border.release()); | 141 button->set_border(button_border.release()); |
| 142 button->SetFont(font); | 142 button->SetFont(font); |
| 143 button->set_tag(tag); | 143 button->set_tag(tag); |
| 144 return button; | 144 return button; |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace views | 147 } // namespace views |
| OLD | NEW |