OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ |
6 #define UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // | 23 // |
24 // MenuButton | 24 // MenuButton |
25 // | 25 // |
26 // A button that shows a menu when the left mouse button is pushed | 26 // A button that shows a menu when the left mouse button is pushed |
27 // | 27 // |
28 //////////////////////////////////////////////////////////////////////////////// | 28 //////////////////////////////////////////////////////////////////////////////// |
29 class VIEWS_EXPORT MenuButton : public TextButton { | 29 class VIEWS_EXPORT MenuButton : public TextButton { |
30 public: | 30 public: |
31 static const char kViewClassName[]; | 31 static const char kViewClassName[]; |
32 | 32 |
| 33 // How much padding to put on the left and right of the menu marker. |
| 34 static const int kMenuMarkerPaddingLeft; |
| 35 static const int kMenuMarkerPaddingRight; |
| 36 |
33 // Create a Button. | 37 // Create a Button. |
34 MenuButton(ButtonListener* listener, | 38 MenuButton(ButtonListener* listener, |
35 const string16& text, | 39 const string16& text, |
36 MenuButtonListener* menu_button_listener, | 40 MenuButtonListener* menu_button_listener, |
37 bool show_menu_marker); | 41 bool show_menu_marker); |
38 virtual ~MenuButton(); | 42 virtual ~MenuButton(); |
39 | 43 |
| 44 bool show_menu_marker() const { return show_menu_marker_; } |
40 void set_menu_marker(const gfx::ImageSkia* menu_marker) { | 45 void set_menu_marker(const gfx::ImageSkia* menu_marker) { |
41 menu_marker_ = menu_marker; | 46 menu_marker_ = menu_marker; |
42 } | 47 } |
| 48 const gfx::ImageSkia* menu_marker() const { return menu_marker_; } |
43 | 49 |
44 const gfx::Point& menu_offset() const { return menu_offset_; } | 50 const gfx::Point& menu_offset() const { return menu_offset_; } |
45 void set_menu_offset(int x, int y) { menu_offset_.SetPoint(x, y); } | 51 void set_menu_offset(int x, int y) { menu_offset_.SetPoint(x, y); } |
46 | 52 |
47 // Activate the button (called when the button is pressed). | 53 // Activate the button (called when the button is pressed). |
48 virtual bool Activate(); | 54 virtual bool Activate(); |
49 | 55 |
50 // Overridden from TextButton for the potential use of a drop marker. | 56 // Overridden from TextButton for the potential use of a drop marker. |
51 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE; | 57 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE; |
52 | 58 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // If non-null the destuctor sets this to true. This is set while the menu is | 102 // If non-null the destuctor sets this to true. This is set while the menu is |
97 // showing and used to detect if the menu was deleted while running. | 103 // showing and used to detect if the menu was deleted while running. |
98 bool* destroyed_flag_; | 104 bool* destroyed_flag_; |
99 | 105 |
100 DISALLOW_COPY_AND_ASSIGN(MenuButton); | 106 DISALLOW_COPY_AND_ASSIGN(MenuButton); |
101 }; | 107 }; |
102 | 108 |
103 } // namespace views | 109 } // namespace views |
104 | 110 |
105 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ | 111 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ |
OLD | NEW |