| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(TouchEditingMenuButtonBorder); | 60 DISALLOW_COPY_AND_ASSIGN(TouchEditingMenuButtonBorder); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 TouchEditingMenuView::TouchEditingMenuView( | 63 TouchEditingMenuView::TouchEditingMenuView( |
| 64 TouchEditingMenuController* controller, | 64 TouchEditingMenuController* controller, |
| 65 gfx::Rect anchor_rect, | 65 gfx::Rect anchor_rect, |
| 66 gfx::NativeView context) | 66 gfx::NativeView context) |
| 67 : BubbleDelegateView(NULL, views::BubbleBorder::BOTTOM_CENTER), | 67 : BubbleDelegateView(NULL, views::BubbleBorder::BOTTOM_CENTER), |
| 68 controller_(controller) { | 68 controller_(controller) { |
| 69 set_anchor_rect(anchor_rect); | 69 SetAnchorRect(anchor_rect); |
| 70 set_shadow(views::BubbleBorder::SMALL_SHADOW); | 70 set_shadow(views::BubbleBorder::SMALL_SHADOW); |
| 71 set_parent_window(context); | 71 set_parent_window(context); |
| 72 set_margins(gfx::Insets(kMenuMargin, kMenuMargin, kMenuMargin, kMenuMargin)); | 72 set_margins(gfx::Insets(kMenuMargin, kMenuMargin, kMenuMargin, kMenuMargin)); |
| 73 set_use_focusless(true); | 73 set_use_focusless(true); |
| 74 set_adjust_if_offscreen(true); | 74 set_adjust_if_offscreen(true); |
| 75 | 75 |
| 76 SetLayoutManager(new BoxLayout(BoxLayout::kHorizontal, 0, 0, | 76 SetLayoutManager(new BoxLayout(BoxLayout::kHorizontal, 0, 0, |
| 77 kSpacingBetweenButtons)); | 77 kSpacingBetweenButtons)); |
| 78 CreateButtons(); | 78 CreateButtons(); |
| 79 views::BubbleDelegateView::CreateBubble(this); | 79 views::BubbleDelegateView::CreateBubble(this); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 int v_border = (kMenuButtonHeight - font.GetHeight()) / 2; | 159 int v_border = (kMenuButtonHeight - font.GetHeight()) / 2; |
| 160 int h_border = (kMenuButtonWidth - font.GetStringWidth(label)) / 2; | 160 int h_border = (kMenuButtonWidth - font.GetStringWidth(label)) / 2; |
| 161 button->set_border(new TouchEditingMenuButtonBorder(button->style(), | 161 button->set_border(new TouchEditingMenuButtonBorder(button->style(), |
| 162 gfx::Insets(v_border, h_border, v_border, h_border))); | 162 gfx::Insets(v_border, h_border, v_border, h_border))); |
| 163 button->SetFont(font); | 163 button->SetFont(font); |
| 164 button->set_tag(tag); | 164 button->set_tag(tag); |
| 165 return button; | 165 return button; |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace views | 168 } // namespace views |
| OLD | NEW |