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/utf_string_conversions.h" | 7 #include "base/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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(TouchEditingMenuButtonBorder); | 55 DISALLOW_COPY_AND_ASSIGN(TouchEditingMenuButtonBorder); |
56 }; | 56 }; |
57 | 57 |
58 TouchEditingMenuView::TouchEditingMenuView( | 58 TouchEditingMenuView::TouchEditingMenuView( |
59 TouchEditingMenuController* controller, | 59 TouchEditingMenuController* controller, |
60 gfx::Rect anchor_rect, | 60 gfx::Rect anchor_rect, |
61 gfx::NativeView context) | 61 gfx::NativeView context) |
62 : BubbleDelegateView(NULL, views::BubbleBorder::BOTTOM_CENTER), | 62 : BubbleDelegateView(NULL, views::BubbleBorder::BOTTOM_CENTER), |
63 controller_(controller) { | 63 controller_(controller) { |
64 set_anchor_point(anchor_rect.CenterPoint()); | 64 set_anchor_rect(anchor_rect); |
65 set_anchor_insets(gfx::Insets(-anchor_rect.height() / 2, | |
66 -anchor_rect.width() / 2, | |
67 -anchor_rect.height() / 2, | |
68 -anchor_rect.width() / 2)); | |
69 set_shadow(views::BubbleBorder::SMALL_SHADOW); | 65 set_shadow(views::BubbleBorder::SMALL_SHADOW); |
70 set_parent_window(context); | 66 set_parent_window(context); |
71 set_margins(gfx::Insets()); | 67 set_margins(gfx::Insets()); |
72 set_use_focusless(true); | 68 set_use_focusless(true); |
73 set_adjust_if_offscreen(true); | 69 set_adjust_if_offscreen(true); |
74 | 70 |
75 SetLayoutManager(new BoxLayout(BoxLayout::kHorizontal, 0, 0, | 71 SetLayoutManager(new BoxLayout(BoxLayout::kHorizontal, 0, 0, |
76 kSpacingBetweenButtons)); | 72 kSpacingBetweenButtons)); |
77 CreateButtons(); | 73 CreateButtons(); |
78 views::BubbleDelegateView::CreateBubble(this); | 74 views::BubbleDelegateView::CreateBubble(this); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 button->set_focusable(true); | 138 button->set_focusable(true); |
143 button->set_request_focus_on_press(false); | 139 button->set_request_focus_on_press(false); |
144 button->set_border(new TouchEditingMenuButtonBorder(button->style())); | 140 button->set_border(new TouchEditingMenuButtonBorder(button->style())); |
145 button->SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( | 141 button->SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( |
146 ui::ResourceBundle::SmallFont)); | 142 ui::ResourceBundle::SmallFont)); |
147 button->set_tag(tag); | 143 button->set_tag(tag); |
148 return button; | 144 return button; |
149 } | 145 } |
150 | 146 |
151 } // namespace views | 147 } // namespace views |
OLD | NEW |