| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
| 11 #include "views/controls/menu/menu_2.h" | 11 #include "views/controls/menu/menu_2.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 | 14 |
| 15 //////////////////////////////////////////////////////////////////////////////// | 15 //////////////////////////////////////////////////////////////////////////////// |
| 16 // | 16 // |
| 17 // ButtonDropDown | 17 // ButtonDropDown |
| 18 // | 18 // |
| 19 // A button class that when pressed (and held) or pressed (and drag down) will | 19 // A button class that when pressed (and held) or pressed (and drag down) will |
| 20 // display a menu | 20 // display a menu |
| 21 // | 21 // |
| 22 //////////////////////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////////////////////// |
| 23 class ButtonDropDown : public ImageButton { | 23 class ButtonDropDown : public ImageButton { |
| 24 public: | 24 public: |
| 25 ButtonDropDown(ButtonListener* listener, menus::MenuModel* model); | 25 ButtonDropDown(ButtonListener* listener, menus::MenuModel* model); |
| 26 virtual ~ButtonDropDown(); | 26 virtual ~ButtonDropDown(); |
| 27 | 27 |
| 28 // Accessibility accessors, overridden from View. | 28 // Accessibility accessors, overridden from View. |
| 29 virtual std::wstring GetAccessibleDefaultAction(); | 29 virtual string16 GetAccessibleDefaultAction() OVERRIDE; |
| 30 virtual AccessibilityTypes::Role GetAccessibleRole(); | 30 virtual AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; |
| 31 virtual AccessibilityTypes::State GetAccessibleState(); | 31 virtual AccessibilityTypes::State GetAccessibleState() OVERRIDE; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 // Overridden from CustomButton | 34 // Overridden from CustomButton |
| 35 virtual bool OnMousePressed(const MouseEvent& e); | 35 virtual bool OnMousePressed(const MouseEvent& e); |
| 36 virtual void OnMouseReleased(const MouseEvent& e, bool canceled); | 36 virtual void OnMouseReleased(const MouseEvent& e, bool canceled); |
| 37 virtual bool OnMouseDragged(const MouseEvent& e); | 37 virtual bool OnMouseDragged(const MouseEvent& e); |
| 38 virtual void OnMouseExited(const MouseEvent& e); | 38 virtual void OnMouseExited(const MouseEvent& e); |
| 39 | 39 |
| 40 // Overridden from View. Used to display the right-click menu, as triggered | 40 // Overridden from View. Used to display the right-click menu, as triggered |
| 41 // by the keyboard, for instance. Using the member function ShowDropDownMenu | 41 // by the keyboard, for instance. Using the member function ShowDropDownMenu |
| (...skipping 19 matching lines...) Expand all Loading... |
| 61 | 61 |
| 62 // 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. |
| 63 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; | 63 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; |
| 64 | 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); | 65 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 } // namespace views | 68 } // namespace views |
| 69 | 69 |
| 70 #endif // VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 70 #endif // VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
| OLD | NEW |