| 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_MENU_BUTTON_H_ | 5 #ifndef VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ |
| 6 #define VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ | 6 #define VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 8 #include "app/gfx/font.h" | 10 #include "app/gfx/font.h" |
| 9 #include "base/time.h" | 11 #include "base/time.h" |
| 10 #include "views/background.h" | 12 #include "views/background.h" |
| 11 #include "views/controls/button/text_button.h" | 13 #include "views/controls/button/text_button.h" |
| 12 | 14 |
| 13 namespace views { | 15 namespace views { |
| 14 | 16 |
| 15 class MouseEvent; | 17 class MouseEvent; |
| 16 class ViewMenuDelegate; | 18 class ViewMenuDelegate; |
| 17 | 19 |
| 18 | 20 |
| 19 //////////////////////////////////////////////////////////////////////////////// | 21 //////////////////////////////////////////////////////////////////////////////// |
| 20 // | 22 // |
| 21 // MenuButton | 23 // MenuButton |
| 22 // | 24 // |
| 23 // A button that shows a menu when the left mouse button is pushed | 25 // A button that shows a menu when the left mouse button is pushed |
| 24 // | 26 // |
| 25 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
| 26 class MenuButton : public TextButton { | 28 class MenuButton : public TextButton { |
| 27 public: | 29 public: |
| 30 // The menu button's class name. |
| 31 static const char kViewClassName[]; |
| 32 |
| 28 // | 33 // |
| 29 // Create a Button | 34 // Create a Button |
| 30 MenuButton(ButtonListener* listener, | 35 MenuButton(ButtonListener* listener, |
| 31 const std::wstring& text, | 36 const std::wstring& text, |
| 32 ViewMenuDelegate* menu_delegate, | 37 ViewMenuDelegate* menu_delegate, |
| 33 bool show_menu_marker); | 38 bool show_menu_marker); |
| 34 virtual ~MenuButton(); | 39 virtual ~MenuButton(); |
| 35 | 40 |
| 36 void set_menu_delegate(ViewMenuDelegate* delegate) { | 41 void set_menu_delegate(ViewMenuDelegate* delegate) { |
| 37 menu_delegate_ = delegate; | 42 menu_delegate_ = delegate; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 49 virtual bool OnMousePressed(const MouseEvent& e); | 54 virtual bool OnMousePressed(const MouseEvent& e); |
| 50 virtual void OnMouseReleased(const MouseEvent& e, bool canceled); | 55 virtual void OnMouseReleased(const MouseEvent& e, bool canceled); |
| 51 virtual bool OnKeyReleased(const KeyEvent& e); | 56 virtual bool OnKeyReleased(const KeyEvent& e); |
| 52 virtual void OnMouseExited(const MouseEvent& event); | 57 virtual void OnMouseExited(const MouseEvent& event); |
| 53 | 58 |
| 54 // Accessibility accessors, overridden from View. | 59 // Accessibility accessors, overridden from View. |
| 55 virtual bool GetAccessibleDefaultAction(std::wstring* action); | 60 virtual bool GetAccessibleDefaultAction(std::wstring* action); |
| 56 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); | 61 virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); |
| 57 virtual bool GetAccessibleState(AccessibilityTypes::State* state); | 62 virtual bool GetAccessibleState(AccessibilityTypes::State* state); |
| 58 | 63 |
| 64 // Returns views/MenuButton. |
| 65 virtual std::string GetClassName() const; |
| 66 |
| 59 protected: | 67 protected: |
| 60 // True if the menu is currently visible. | 68 // True if the menu is currently visible. |
| 61 bool menu_visible_; | 69 bool menu_visible_; |
| 62 | 70 |
| 63 private: | 71 private: |
| 64 friend class TextButtonBackground; | 72 friend class TextButtonBackground; |
| 65 | 73 |
| 66 // Compute the maximum X coordinate for the current screen. MenuButtons | 74 // Compute the maximum X coordinate for the current screen. MenuButtons |
| 67 // use this to make sure a menu is never shown off screen. | 75 // use this to make sure a menu is never shown off screen. |
| 68 int GetMaximumScreenXCoordinate(); | 76 int GetMaximumScreenXCoordinate(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 80 | 88 |
| 81 // Whether or not we're showing a drop marker. | 89 // Whether or not we're showing a drop marker. |
| 82 bool show_menu_marker_; | 90 bool show_menu_marker_; |
| 83 | 91 |
| 84 DISALLOW_COPY_AND_ASSIGN(MenuButton); | 92 DISALLOW_COPY_AND_ASSIGN(MenuButton); |
| 85 }; | 93 }; |
| 86 | 94 |
| 87 } // namespace views | 95 } // namespace views |
| 88 | 96 |
| 89 #endif // VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ | 97 #endif // VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ |
| OLD | NEW |