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 #ifndef UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
6 #define UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "ui/views/controls/button/image_button.h" | 9 #include "ui/views/controls/button/image_button.h" |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 ButtonDropDown(ButtonListener* listener, ui::MenuModel* model); | 33 ButtonDropDown(ButtonListener* listener, ui::MenuModel* model); |
34 virtual ~ButtonDropDown(); | 34 virtual ~ButtonDropDown(); |
35 | 35 |
36 // If menu is currently pending for long press - stop it. | 36 // If menu is currently pending for long press - stop it. |
37 void ClearPendingMenu(); | 37 void ClearPendingMenu(); |
38 | 38 |
39 // Indicates if menu is currently showing. | 39 // Indicates if menu is currently showing. |
40 bool IsMenuShowing() const; | 40 bool IsMenuShowing() const; |
41 | 41 |
42 // Overridden from views::View | 42 // Overridden from views::View |
43 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; | 43 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
44 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; | 44 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
45 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; | 45 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
46 virtual std::string GetClassName() const OVERRIDE; | 46 virtual std::string GetClassName() const OVERRIDE; |
47 // Showing the drop down results in a MouseCaptureLost, we need to ignore it. | 47 // Showing the drop down results in a MouseCaptureLost, we need to ignore it. |
48 virtual void OnMouseCaptureLost() OVERRIDE {} | 48 virtual void OnMouseCaptureLost() OVERRIDE {} |
49 virtual void OnMouseExited(const MouseEvent& event) OVERRIDE; | 49 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
50 // Display the right-click menu, as triggered by the keyboard, for instance. | 50 // Display the right-click menu, as triggered by the keyboard, for instance. |
51 // Using the member function ShowDropDownMenu for the actual display. | 51 // Using the member function ShowDropDownMenu for the actual display. |
52 virtual void ShowContextMenu(const gfx::Point& p, | 52 virtual void ShowContextMenu(const gfx::Point& p, |
53 bool is_mouse_gesture) OVERRIDE; | 53 bool is_mouse_gesture) OVERRIDE; |
54 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 54 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
55 | 55 |
56 protected: | 56 protected: |
57 // Overridden from CustomButton. Returns true if the button should become | 57 // Overridden from CustomButton. Returns true if the button should become |
58 // pressed when a user holds the mouse down over the button. For this | 58 // pressed when a user holds the mouse down over the button. For this |
59 // implementation, both left and right mouse buttons can trigger a change | 59 // implementation, both left and right mouse buttons can trigger a change |
(...skipping 21 matching lines...) Expand all Loading... |
81 | 81 |
82 // A factory for tasks that show the dropdown context menu for the button. | 82 // A factory for tasks that show the dropdown context menu for the button. |
83 base::WeakPtrFactory<ButtonDropDown> show_menu_factory_; | 83 base::WeakPtrFactory<ButtonDropDown> show_menu_factory_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); | 85 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace views | 88 } // namespace views |
89 | 89 |
90 #endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 90 #endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
OLD | NEW |