OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_BUTTON_H_ |
6 #define UI_VIEWS_CONTROLS_BUTTON_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_BUTTON_H_ |
7 | 7 |
8 #include "ui/views/view.h" | 8 #include "ui/views/view.h" |
9 | 9 |
10 namespace views { | 10 namespace views { |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 // Button styles with associated images and border painters. | 40 // Button styles with associated images and border painters. |
41 // TODO(msw): Add Menu, ComboBox, etc. | 41 // TODO(msw): Add Menu, ComboBox, etc. |
42 enum ButtonStyle { | 42 enum ButtonStyle { |
43 STYLE_BUTTON = 0, | 43 STYLE_BUTTON = 0, |
44 STYLE_TEXTBUTTON, | 44 STYLE_TEXTBUTTON, |
45 STYLE_NATIVE_TEXTBUTTON, | 45 STYLE_NATIVE_TEXTBUTTON, |
46 STYLE_COUNT, | 46 STYLE_COUNT, |
47 }; | 47 }; |
48 | 48 |
49 void SetTooltipText(const string16& tooltip_text); | 49 void SetTooltipText(const base::string16& tooltip_text); |
50 | 50 |
51 int tag() const { return tag_; } | 51 int tag() const { return tag_; } |
52 void set_tag(int tag) { tag_ = tag; } | 52 void set_tag(int tag) { tag_ = tag; } |
53 | 53 |
54 void SetAccessibleName(const string16& name); | 54 void SetAccessibleName(const base::string16& name); |
55 | 55 |
56 // Overridden from View: | 56 // Overridden from View: |
57 virtual bool GetTooltipText(const gfx::Point& p, | 57 virtual bool GetTooltipText(const gfx::Point& p, |
58 string16* tooltip) const OVERRIDE; | 58 base::string16* tooltip) const OVERRIDE; |
59 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 59 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
60 | 60 |
61 protected: | 61 protected: |
62 // Construct the Button with a Listener. The listener can be NULL. This can be | 62 // Construct the Button with a Listener. The listener can be NULL. This can be |
63 // true of buttons that don't have a listener - e.g. menubuttons where there's | 63 // true of buttons that don't have a listener - e.g. menubuttons where there's |
64 // no default action and checkboxes. | 64 // no default action and checkboxes. |
65 explicit Button(ButtonListener* listener); | 65 explicit Button(ButtonListener* listener); |
66 | 66 |
67 // Cause the button to notify the listener that a click occurred. | 67 // Cause the button to notify the listener that a click occurred. |
68 virtual void NotifyClick(const ui::Event& event); | 68 virtual void NotifyClick(const ui::Event& event); |
69 | 69 |
70 // The button's listener. Notified when clicked. | 70 // The button's listener. Notified when clicked. |
71 ButtonListener* listener_; | 71 ButtonListener* listener_; |
72 | 72 |
73 private: | 73 private: |
74 // The text shown in a tooltip. | 74 // The text shown in a tooltip. |
75 string16 tooltip_text_; | 75 base::string16 tooltip_text_; |
76 | 76 |
77 // Accessibility data. | 77 // Accessibility data. |
78 string16 accessible_name_; | 78 base::string16 accessible_name_; |
79 | 79 |
80 // The id tag associated with this button. Used to disambiguate buttons in | 80 // The id tag associated with this button. Used to disambiguate buttons in |
81 // the ButtonListener implementation. | 81 // the ButtonListener implementation. |
82 int tag_; | 82 int tag_; |
83 | 83 |
84 DISALLOW_COPY_AND_ASSIGN(Button); | 84 DISALLOW_COPY_AND_ASSIGN(Button); |
85 }; | 85 }; |
86 | 86 |
87 } // namespace views | 87 } // namespace views |
88 | 88 |
89 #endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_H_ | 89 #endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_H_ |
OLD | NEW |