| 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 CHROME_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 5 #ifndef CHROME_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
| 6 #define CHROME_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 6 #define CHROME_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
| 7 | 7 |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "chrome/views/controls/button/image_button.h" | 9 #include "chrome/views/controls/button/image_button.h" |
| 10 #include "chrome/views/controls/menu/menu.h" | 10 #include "chrome/views/controls/menu/menu.h" |
| 11 | 11 |
| 12 namespace views { | 12 namespace views { |
| 13 | 13 |
| 14 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
| 15 // | 15 // |
| 16 // ButtonDropDown | 16 // ButtonDropDown |
| 17 // | 17 // |
| 18 // A button class that when pressed (and held) or pressed (and drag down) will | 18 // A button class that when pressed (and held) or pressed (and drag down) will |
| 19 // display a menu | 19 // display a menu |
| 20 // | 20 // |
| 21 //////////////////////////////////////////////////////////////////////////////// | 21 //////////////////////////////////////////////////////////////////////////////// |
| 22 class ButtonDropDown : public ImageButton { | 22 class ButtonDropDown : public ImageButton { |
| 23 public: | 23 public: |
| 24 ButtonDropDown(ButtonListener* listener, Menu::Delegate* menu_delegate); | 24 ButtonDropDown(ButtonListener* listener, Menu::Delegate* menu_delegate); |
| 25 virtual ~ButtonDropDown(); | 25 virtual ~ButtonDropDown(); |
| 26 | 26 |
| 27 // Returns the MSAA default action of the current view. The string returned | 27 // Accessibility accessors, overridden from View. |
| 28 // describes the default action that will occur when executing | 28 virtual bool GetAccessibleDefaultAction(std::wstring* action); |
| 29 // IAccessible::DoDefaultAction. | 29 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); |
| 30 bool GetAccessibleDefaultAction(std::wstring* action); | 30 virtual bool GetAccessibleState(AccessibilityTypes::State* state); |
| 31 | |
| 32 // Returns the MSAA role of the current view. The role is what assistive | |
| 33 // technologies (ATs) use to determine what behavior to expect from a given | |
| 34 // control. | |
| 35 bool GetAccessibleRole(VARIANT* role); | |
| 36 | |
| 37 // Returns the MSAA state of the current view. Sets the input VARIANT | |
| 38 // appropriately, and returns true if a change was performed successfully. | |
| 39 // Overriden from View. | |
| 40 virtual bool GetAccessibleState(VARIANT* state); | |
| 41 | 31 |
| 42 private: | 32 private: |
| 43 // Overridden from Button | 33 // Overridden from Button |
| 44 virtual bool OnMousePressed(const MouseEvent& e); | 34 virtual bool OnMousePressed(const MouseEvent& e); |
| 45 virtual void OnMouseReleased(const MouseEvent& e, bool canceled); | 35 virtual void OnMouseReleased(const MouseEvent& e, bool canceled); |
| 46 virtual bool OnMouseDragged(const MouseEvent& e); | 36 virtual bool OnMouseDragged(const MouseEvent& e); |
| 47 | 37 |
| 48 // Overridden from View. Used to display the right-click menu, as triggered | 38 // Overridden from View. Used to display the right-click menu, as triggered |
| 49 // by the keyboard, for instance. Using the member function ShowDropDownMenu | 39 // by the keyboard, for instance. Using the member function ShowDropDownMenu |
| 50 // for the actual display. | 40 // for the actual display. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 63 | 53 |
| 64 // A factory for tasks that show the dropdown context menu for the button. | 54 // A factory for tasks that show the dropdown context menu for the button. |
| 65 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; | 55 ScopedRunnableMethodFactory<ButtonDropDown> show_menu_factory_; |
| 66 | 56 |
| 67 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); | 57 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); |
| 68 }; | 58 }; |
| 69 | 59 |
| 70 } // namespace views | 60 } // namespace views |
| 71 | 61 |
| 72 #endif // CHROME_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ | 62 #endif // CHROME_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
| OLD | NEW |