OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "ui/views/controls/button/image_button.h" | 10 #include "ui/views/controls/button/image_button.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // Using the member function ShowDropDownMenu for the actual display. | 43 // Using the member function ShowDropDownMenu for the actual display. |
44 virtual void ShowContextMenu(const gfx::Point& p, | 44 virtual void ShowContextMenu(const gfx::Point& p, |
45 bool is_mouse_gesture) OVERRIDE; | 45 bool is_mouse_gesture) OVERRIDE; |
46 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 46 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
47 | 47 |
48 protected: | 48 protected: |
49 // Overridden from CustomButton. Returns true if the button should become | 49 // Overridden from CustomButton. Returns true if the button should become |
50 // pressed when a user holds the mouse down over the button. For this | 50 // pressed when a user holds the mouse down over the button. For this |
51 // implementation, both left and right mouse buttons can trigger a change | 51 // implementation, both left and right mouse buttons can trigger a change |
52 // to the PUSHED state. | 52 // to the PUSHED state. |
53 virtual bool ShouldEnterPushedState(const MouseEvent& event) OVERRIDE; | 53 virtual bool ShouldEnterPushedState(const Event& event) OVERRIDE; |
54 | 54 |
55 private: | 55 private: |
56 // Internal function to show the dropdown menu | 56 // Internal function to show the dropdown menu |
57 void ShowDropDownMenu(gfx::NativeView window); | 57 void ShowDropDownMenu(gfx::NativeView window); |
58 | 58 |
59 // The model that populates the attached menu. | 59 // The model that populates the attached menu. |
60 ui::MenuModel* model_; | 60 ui::MenuModel* model_; |
61 | 61 |
62 // Y position of mouse when left mouse button is pressed | 62 // Y position of mouse when left mouse button is pressed |
63 int y_position_on_lbuttondown_; | 63 int y_position_on_lbuttondown_; |
64 | 64 |
65 // A factory for tasks that show the dropdown context menu for the button. | 65 // A factory for tasks that show the dropdown context menu for the button. |
66 base::WeakPtrFactory<ButtonDropDown> show_menu_factory_; | 66 base::WeakPtrFactory<ButtonDropDown> show_menu_factory_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); | 68 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); |
69 }; | 69 }; |
70 | 70 |
71 } // namespace views | 71 } // namespace views |
72 | 72 |
73 #endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 73 #endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
OLD | NEW |