| 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 29 matching lines...) Expand all Loading... |
| 40 TouchEditingMenuView::TouchEditingMenuView( | 40 TouchEditingMenuView::TouchEditingMenuView( |
| 41 TouchEditingMenuController* controller, | 41 TouchEditingMenuController* controller, |
| 42 const gfx::Rect& anchor_rect, | 42 const gfx::Rect& anchor_rect, |
| 43 const gfx::Size& handle_image_size, | 43 const gfx::Size& handle_image_size, |
| 44 gfx::NativeView context) | 44 gfx::NativeView context) |
| 45 : BubbleDelegateView(NULL, views::BubbleBorder::BOTTOM_CENTER), | 45 : BubbleDelegateView(NULL, views::BubbleBorder::BOTTOM_CENTER), |
| 46 controller_(controller) { | 46 controller_(controller) { |
| 47 set_shadow(views::BubbleBorder::SMALL_SHADOW); | 47 set_shadow(views::BubbleBorder::SMALL_SHADOW); |
| 48 set_parent_window(context); | 48 set_parent_window(context); |
| 49 set_margins(gfx::Insets(kMenuMargin, kMenuMargin, kMenuMargin, kMenuMargin)); | 49 set_margins(gfx::Insets(kMenuMargin, kMenuMargin, kMenuMargin, kMenuMargin)); |
| 50 set_use_focusless(true); | 50 set_can_activate(false); |
| 51 set_adjust_if_offscreen(true); | 51 set_adjust_if_offscreen(true); |
| 52 | 52 |
| 53 SetLayoutManager(new BoxLayout(BoxLayout::kHorizontal, 0, 0, | 53 SetLayoutManager(new BoxLayout(BoxLayout::kHorizontal, 0, 0, |
| 54 kSpacingBetweenButtons)); | 54 kSpacingBetweenButtons)); |
| 55 CreateButtons(); | 55 CreateButtons(); |
| 56 | 56 |
| 57 // After buttons are created, check if there is enough room between handles to | 57 // After buttons are created, check if there is enough room between handles to |
| 58 // show the menu and adjust anchor rect properly if needed, just in case the | 58 // show the menu and adjust anchor rect properly if needed, just in case the |
| 59 // menu is needed to be shown under the selection. | 59 // menu is needed to be shown under the selection. |
| 60 gfx::Rect adjusted_anchor_rect(anchor_rect); | 60 gfx::Rect adjusted_anchor_rect(anchor_rect); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.PassAs<Border>()); |
| 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 |