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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
60 // to the PUSHED state. | 60 // to the PUSHED state. |
61 virtual bool ShouldEnterPushedState(const Event& event) OVERRIDE; | 61 virtual bool ShouldEnterPushedState(const ui::Event& event) OVERRIDE; |
62 | 62 |
63 // Returns if menu should be shown. Override this to change default behavior. | 63 // Returns if menu should be shown. Override this to change default behavior. |
64 virtual bool ShouldShowMenu(); | 64 virtual bool ShouldShowMenu(); |
65 | 65 |
66 // Function to show the dropdown menu. | 66 // Function to show the dropdown menu. |
67 virtual void ShowDropDownMenu(); | 67 virtual void ShowDropDownMenu(); |
68 | 68 |
69 private: | 69 private: |
70 // The model that populates the attached menu. | 70 // The model that populates the attached menu. |
71 scoped_ptr<ui::MenuModel> model_; | 71 scoped_ptr<ui::MenuModel> model_; |
72 | 72 |
73 // Indicates if menu is currently showing. | 73 // Indicates if menu is currently showing. |
74 bool menu_showing_; | 74 bool menu_showing_; |
75 | 75 |
76 // Y position of mouse when left mouse button is pressed | 76 // Y position of mouse when left mouse button is pressed |
77 int y_position_on_lbuttondown_; | 77 int y_position_on_lbuttondown_; |
78 | 78 |
79 // Menu runner to display drop down menu. | 79 // Menu runner to display drop down menu. |
80 scoped_ptr<MenuRunner> menu_runner_; | 80 scoped_ptr<MenuRunner> menu_runner_; |
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 |