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