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 VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 5 #ifndef VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
6 #define VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 6 #define VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "views/controls/button/image_button.h" | 10 #include "views/controls/button/image_button.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // | 21 // |
22 //////////////////////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////////////////////// |
23 class ButtonDropDown : public ImageButton { | 23 class ButtonDropDown : public ImageButton { |
24 public: | 24 public: |
25 ButtonDropDown(ButtonListener* listener, ui::MenuModel* model); | 25 ButtonDropDown(ButtonListener* listener, ui::MenuModel* model); |
26 virtual ~ButtonDropDown(); | 26 virtual ~ButtonDropDown(); |
27 | 27 |
28 // Overridden from views::View | 28 // Overridden from views::View |
29 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; | 29 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; |
30 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; | 30 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; |
31 virtual void OnMouseReleased(const MouseEvent& event, bool canceled) OVERRIDE; | 31 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; |
| 32 // Showing the drop down results in a MouseCaptureLost, we need to ignore it. |
| 33 virtual void OnMouseCaptureLost() OVERRIDE {} |
32 virtual void OnMouseExited(const MouseEvent& event) OVERRIDE; | 34 virtual void OnMouseExited(const MouseEvent& event) OVERRIDE; |
33 // Display the right-click menu, as triggered by the keyboard, for instance. | 35 // Display the right-click menu, as triggered by the keyboard, for instance. |
34 // Using the member function ShowDropDownMenu for the actual display. | 36 // Using the member function ShowDropDownMenu for the actual display. |
35 virtual void ShowContextMenu(const gfx::Point& p, | 37 virtual void ShowContextMenu(const gfx::Point& p, |
36 bool is_mouse_gesture) OVERRIDE; | 38 bool is_mouse_gesture) OVERRIDE; |
37 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 39 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
38 | 40 |
39 protected: | 41 protected: |
40 // Overridden from CustomButton. Returns true if the button should become | 42 // Overridden from CustomButton. Returns true if the button should become |
41 // pressed when a user holds the mouse down over the button. For this | 43 // pressed when a user holds the mouse down over the button. For this |
(...skipping 14 matching lines...) Expand all Loading... |
56 | 58 |
57 // A factory for tasks that show the dropdown context menu for the button. | 59 // A factory for tasks that show the dropdown context menu for the button. |
58 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; | 60 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; |
59 | 61 |
60 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); | 62 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); |
61 }; | 63 }; |
62 | 64 |
63 } // namespace views | 65 } // namespace views |
64 | 66 |
65 #endif // VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 67 #endif // VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
OLD | NEW |