| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 7 |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "views/controls/button/image_button.h" | 9 #include "views/controls/button/image_button.h" |
| 10 #include "views/controls/menu/menu_2.h" | 10 #include "views/controls/menu/menu_2.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 public: | 23 public: |
| 24 ButtonDropDown(ButtonListener* listener, Menu2Model* model); | 24 ButtonDropDown(ButtonListener* listener, Menu2Model* model); |
| 25 virtual ~ButtonDropDown(); | 25 virtual ~ButtonDropDown(); |
| 26 | 26 |
| 27 // Accessibility accessors, overridden from View. | 27 // Accessibility accessors, overridden from View. |
| 28 virtual bool GetAccessibleDefaultAction(std::wstring* action); | 28 virtual bool GetAccessibleDefaultAction(std::wstring* action); |
| 29 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); | 29 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); |
| 30 virtual bool GetAccessibleState(AccessibilityTypes::State* state); | 30 virtual bool GetAccessibleState(AccessibilityTypes::State* state); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 // Overridden from Button | 33 // Overridden from CustomButton |
| 34 virtual bool OnMousePressed(const MouseEvent& e); | 34 virtual bool OnMousePressed(const MouseEvent& e); |
| 35 virtual void OnMouseReleased(const MouseEvent& e, bool canceled); | 35 virtual void OnMouseReleased(const MouseEvent& e, bool canceled); |
| 36 virtual bool OnMouseDragged(const MouseEvent& e); | 36 virtual bool OnMouseDragged(const MouseEvent& e); |
| 37 virtual void OnMouseExited(const MouseEvent& e); |
| 37 | 38 |
| 38 // Overridden from View. Used to display the right-click menu, as triggered | 39 // Overridden from View. Used to display the right-click menu, as triggered |
| 39 // by the keyboard, for instance. Using the member function ShowDropDownMenu | 40 // by the keyboard, for instance. Using the member function ShowDropDownMenu |
| 40 // for the actual display. | 41 // for the actual display. |
| 41 virtual void ShowContextMenu(int x, | 42 virtual void ShowContextMenu(int x, |
| 42 int y, | 43 int y, |
| 43 bool is_mouse_gesture); | 44 bool is_mouse_gesture); |
| 44 | 45 |
| 46 // Overridden from CustomButton. Returns true if the button should become |
| 47 // pressed when a user holds the mouse down over the button. For this |
| 48 // implementation, both left and right mouse buttons can trigger a change |
| 49 // to the PUSHED state. |
| 50 virtual bool ShouldEnterPushedState(const MouseEvent& e); |
| 51 |
| 45 // Internal function to show the dropdown menu | 52 // Internal function to show the dropdown menu |
| 46 void ShowDropDownMenu(gfx::NativeView window); | 53 void ShowDropDownMenu(gfx::NativeView window); |
| 47 | 54 |
| 48 // The model that populates the attached menu. | 55 // The model that populates the attached menu. |
| 49 Menu2Model* model_; | 56 Menu2Model* model_; |
| 50 scoped_ptr<Menu2> menu_; | 57 scoped_ptr<Menu2> menu_; |
| 51 | 58 |
| 52 // Y position of mouse when left mouse button is pressed | 59 // Y position of mouse when left mouse button is pressed |
| 53 int y_position_on_lbuttondown_; | 60 int y_position_on_lbuttondown_; |
| 54 | 61 |
| 55 // A factory for tasks that show the dropdown context menu for the button. | 62 // A factory for tasks that show the dropdown context menu for the button. |
| 56 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; | 63 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; |
| 57 | 64 |
| 58 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); | 65 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); |
| 59 }; | 66 }; |
| 60 | 67 |
| 61 } // namespace views | 68 } // namespace views |
| 62 | 69 |
| 63 #endif // VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 70 #endif // VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
| OLD | NEW |