OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/controls/button/button_dropdown.h" | 5 #include "ui/views/controls/button/button_dropdown.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 bool ButtonDropDown::OnMousePressed(const ui::MouseEvent& event) { | 61 bool ButtonDropDown::OnMousePressed(const ui::MouseEvent& event) { |
62 if (enabled() && ShouldShowMenu() && | 62 if (enabled() && ShouldShowMenu() && |
63 IsTriggerableEvent(event) && HitTestPoint(event.location())) { | 63 IsTriggerableEvent(event) && HitTestPoint(event.location())) { |
64 // Store the y pos of the mouse coordinates so we can use them later to | 64 // Store the y pos of the mouse coordinates so we can use them later to |
65 // determine if the user dragged the mouse down (which should pop up the | 65 // determine if the user dragged the mouse down (which should pop up the |
66 // drag down menu immediately, instead of waiting for the timer) | 66 // drag down menu immediately, instead of waiting for the timer) |
67 y_position_on_lbuttondown_ = event.y(); | 67 y_position_on_lbuttondown_ = event.y(); |
68 | 68 |
69 // Schedule a task that will show the menu. | 69 // Schedule a task that will show the menu. |
70 MessageLoop::current()->PostDelayedTask( | 70 base::MessageLoop::current()->PostDelayedTask( |
71 FROM_HERE, | 71 FROM_HERE, |
72 base::Bind(&ButtonDropDown::ShowDropDownMenu, | 72 base::Bind(&ButtonDropDown::ShowDropDownMenu, |
73 show_menu_factory_.GetWeakPtr()), | 73 show_menu_factory_.GetWeakPtr()), |
74 base::TimeDelta::FromMilliseconds(kMenuTimerDelay)); | 74 base::TimeDelta::FromMilliseconds(kMenuTimerDelay)); |
75 } | 75 } |
76 return ImageButton::OnMousePressed(event); | 76 return ImageButton::OnMousePressed(event); |
77 } | 77 } |
78 | 78 |
79 bool ButtonDropDown::OnMouseDragged(const ui::MouseEvent& event) { | 79 bool ButtonDropDown::OnMouseDragged(const ui::MouseEvent& event) { |
80 bool result = ImageButton::OnMouseDragged(event); | 80 bool result = ImageButton::OnMouseDragged(event); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 SetState(STATE_NORMAL); | 219 SetState(STATE_NORMAL); |
220 } | 220 } |
221 | 221 |
222 //////////////////////////////////////////////////////////////////////////////// | 222 //////////////////////////////////////////////////////////////////////////////// |
223 // | 223 // |
224 // ButtonDropDown - Accessibility | 224 // ButtonDropDown - Accessibility |
225 // | 225 // |
226 //////////////////////////////////////////////////////////////////////////////// | 226 //////////////////////////////////////////////////////////////////////////////// |
227 | 227 |
228 } // namespace views | 228 } // namespace views |
OLD | NEW |