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 { |
11 | 11 |
12 class Button; | 12 class Button; |
13 class Event; | 13 class Event; |
14 | 14 |
15 // An interface implemented by an object to let it know that a button was | 15 // An interface implemented by an object to let it know that a button was |
16 // pressed. | 16 // pressed. |
17 class VIEWS_EXPORT ButtonListener { | 17 class VIEWS_EXPORT ButtonListener { |
18 public: | 18 public: |
19 virtual void ButtonPressed(Button* sender, const views::Event& event) = 0; | 19 virtual void ButtonPressed(Button* sender, const ui::Event& event) = 0; |
20 | 20 |
21 protected: | 21 protected: |
22 virtual ~ButtonListener() {} | 22 virtual ~ButtonListener() {} |
23 }; | 23 }; |
24 | 24 |
25 // A View representing a button. Depending on the specific type, the button | 25 // A View representing a button. Depending on the specific type, the button |
26 // could be implemented by a native control or custom rendered. | 26 // could be implemented by a native control or custom rendered. |
27 class VIEWS_EXPORT Button : public View { | 27 class VIEWS_EXPORT Button : public View { |
28 public: | 28 public: |
29 virtual ~Button(); | 29 virtual ~Button(); |
(...skipping 13 matching lines...) Expand all Loading... |
43 string16* tooltip) const OVERRIDE; | 43 string16* tooltip) const OVERRIDE; |
44 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 44 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
45 | 45 |
46 protected: | 46 protected: |
47 // Construct the Button with a Listener. The listener can be NULL. This can be | 47 // Construct the Button with a Listener. The listener can be NULL. This can be |
48 // true of buttons that don't have a listener - e.g. menubuttons where there's | 48 // true of buttons that don't have a listener - e.g. menubuttons where there's |
49 // no default action and checkboxes. | 49 // no default action and checkboxes. |
50 explicit Button(ButtonListener* listener); | 50 explicit Button(ButtonListener* listener); |
51 | 51 |
52 // Cause the button to notify the listener that a click occurred. | 52 // Cause the button to notify the listener that a click occurred. |
53 virtual void NotifyClick(const views::Event& event); | 53 virtual void NotifyClick(const ui::Event& event); |
54 | 54 |
55 // The button's listener. Notified when clicked. | 55 // The button's listener. Notified when clicked. |
56 ButtonListener* listener_; | 56 ButtonListener* listener_; |
57 | 57 |
58 private: | 58 private: |
59 // The text shown in a tooltip. | 59 // The text shown in a tooltip. |
60 string16 tooltip_text_; | 60 string16 tooltip_text_; |
61 | 61 |
62 // Accessibility data. | 62 // Accessibility data. |
63 string16 accessible_name_; | 63 string16 accessible_name_; |
64 string16 accessible_shortcut_; | 64 string16 accessible_shortcut_; |
65 | 65 |
66 // The id tag associated with this button. Used to disambiguate buttons in | 66 // The id tag associated with this button. Used to disambiguate buttons in |
67 // the ButtonListener implementation. | 67 // the ButtonListener implementation. |
68 int tag_; | 68 int tag_; |
69 | 69 |
70 // Event flags present when the button was clicked. | 70 // Event flags present when the button was clicked. |
71 int mouse_event_flags_; | 71 int mouse_event_flags_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(Button); | 73 DISALLOW_COPY_AND_ASSIGN(Button); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace views | 76 } // namespace views |
77 | 77 |
78 #endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_H_ | 78 #endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_H_ |
OLD | NEW |