Chromium Code Reviews| 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 // TODO(msw): Remove? Overrides CustomButton::OnMouseCaptureLost() with no-op. | |
|
msw
2011/03/17 23:28:51
Need guidance / testing / investigation.
| |
| 33 // Showing the drop down results in a MouseCaptureLost, we need to ignore it. | |
| 34 virtual void OnMouseCaptureLost() OVERRIDE {} | |
| 32 virtual void OnMouseExited(const MouseEvent& event) OVERRIDE; | 35 virtual void OnMouseExited(const MouseEvent& event) OVERRIDE; |
| 33 // Display the right-click menu, as triggered by the keyboard, for instance. | 36 // Display the right-click menu, as triggered by the keyboard, for instance. |
| 34 // Using the member function ShowDropDownMenu for the actual display. | 37 // Using the member function ShowDropDownMenu for the actual display. |
| 35 virtual void ShowContextMenu(const gfx::Point& p, | 38 virtual void ShowContextMenu(const gfx::Point& p, |
| 36 bool is_mouse_gesture) OVERRIDE; | 39 bool is_mouse_gesture) OVERRIDE; |
| 37 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 40 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 38 | 41 |
| 39 protected: | 42 protected: |
| 40 // Overridden from CustomButton. Returns true if the button should become | 43 // Overridden from CustomButton. Returns true if the button should become |
| 41 // pressed when a user holds the mouse down over the button. For this | 44 // pressed when a user holds the mouse down over the button. For this |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 56 | 59 |
| 57 // A factory for tasks that show the dropdown context menu for the button. | 60 // A factory for tasks that show the dropdown context menu for the button. |
| 58 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; | 61 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; |
| 59 | 62 |
| 60 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); | 63 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); |
| 61 }; | 64 }; |
| 62 | 65 |
| 63 } // namespace views | 66 } // namespace views |
| 64 | 67 |
| 65 #endif // VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 68 #endif // VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
| OLD | NEW |