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_MENU_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ |
6 #define UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 menu_marker_ = menu_marker; | 57 menu_marker_ = menu_marker; |
58 } | 58 } |
59 const gfx::ImageSkia* menu_marker() const { return menu_marker_; } | 59 const gfx::ImageSkia* menu_marker() const { return menu_marker_; } |
60 | 60 |
61 const gfx::Point& menu_offset() const { return menu_offset_; } | 61 const gfx::Point& menu_offset() const { return menu_offset_; } |
62 void set_menu_offset(int x, int y) { menu_offset_.SetPoint(x, y); } | 62 void set_menu_offset(int x, int y) { menu_offset_.SetPoint(x, y); } |
63 | 63 |
64 // Activate the button (called when the button is pressed). | 64 // Activate the button (called when the button is pressed). |
65 bool Activate(); | 65 bool Activate(); |
66 | 66 |
67 // Called to signal that the action will not be activated. | |
68 void WillNotActivate(); | |
69 | |
70 // Overridden from View: | 67 // Overridden from View: |
71 gfx::Size GetPreferredSize() const override; | 68 gfx::Size GetPreferredSize() const override; |
72 const char* GetClassName() const override; | 69 const char* GetClassName() const override; |
73 void OnPaint(gfx::Canvas* canvas) override; | 70 void OnPaint(gfx::Canvas* canvas) override; |
74 bool OnMousePressed(const ui::MouseEvent& event) override; | 71 bool OnMousePressed(const ui::MouseEvent& event) override; |
75 void OnMouseReleased(const ui::MouseEvent& event) override; | 72 void OnMouseReleased(const ui::MouseEvent& event) override; |
76 void OnMouseEntered(const ui::MouseEvent& event) override; | 73 void OnMouseEntered(const ui::MouseEvent& event) override; |
77 void OnMouseExited(const ui::MouseEvent& event) override; | 74 void OnMouseExited(const ui::MouseEvent& event) override; |
78 void OnMouseMoved(const ui::MouseEvent& event) override; | 75 void OnMouseMoved(const ui::MouseEvent& event) override; |
79 void OnGestureEvent(ui::GestureEvent* event) override; | 76 void OnGestureEvent(ui::GestureEvent* event) override; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 114 |
118 // Our listener. Not owned. | 115 // Our listener. Not owned. |
119 MenuButtonListener* listener_; | 116 MenuButtonListener* listener_; |
120 | 117 |
121 // Whether or not we're showing a drop marker. | 118 // Whether or not we're showing a drop marker. |
122 bool show_menu_marker_; | 119 bool show_menu_marker_; |
123 | 120 |
124 // The down arrow used to differentiate the menu button from normal buttons. | 121 // The down arrow used to differentiate the menu button from normal buttons. |
125 const gfx::ImageSkia* menu_marker_; | 122 const gfx::ImageSkia* menu_marker_; |
126 | 123 |
127 // If non-null the destuctor sets this to true. This is set while the menu is | 124 // If non-null the destructor sets this to true. This is set while the menu is |
128 // showing and used to detect if the menu was deleted while running. | 125 // showing and used to detect if the menu was deleted while running. |
129 bool* destroyed_flag_; | 126 bool* destroyed_flag_; |
130 | 127 |
131 // The current number of "pressed" locks this button has. | 128 // The current number of "pressed" locks this button has. |
132 int pressed_lock_count_; | 129 int pressed_lock_count_; |
133 | 130 |
134 // True if the button was in a disabled state when a menu was run, and should | 131 // True if the button was in a disabled state when a menu was run, and should |
135 // return to it once the press is complete. This can happen if, e.g., we | 132 // return to it once the press is complete. This can happen if, e.g., we |
136 // programmatically show a menu on a disabled button. | 133 // programmatically show a menu on a disabled button. |
137 bool should_disable_after_press_; | 134 bool should_disable_after_press_; |
138 | 135 |
139 base::WeakPtrFactory<MenuButton> weak_factory_; | 136 base::WeakPtrFactory<MenuButton> weak_factory_; |
140 | 137 |
141 DISALLOW_COPY_AND_ASSIGN(MenuButton); | 138 DISALLOW_COPY_AND_ASSIGN(MenuButton); |
142 }; | 139 }; |
143 | 140 |
144 } // namespace views | 141 } // namespace views |
145 | 142 |
146 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ | 143 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ |
OLD | NEW |