Chromium Code Reviews| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/native_theme/native_theme.h" | 9 #include "ui/native_theme/native_theme.h" |
| 10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| 11 #include "ui/views/widget/widget_observer_view.h" | |
| 11 | 12 |
| 12 namespace views { | 13 namespace views { |
| 13 | 14 |
| 14 class Button; | 15 class Button; |
| 15 class Event; | 16 class Event; |
| 16 | 17 |
| 17 // An interface implemented by an object to let it know that a button was | 18 // An interface implemented by an object to let it know that a button was |
| 18 // pressed. | 19 // pressed. |
| 19 class VIEWS_EXPORT ButtonListener { | 20 class VIEWS_EXPORT ButtonListener { |
| 20 public: | 21 public: |
| 21 virtual void ButtonPressed(Button* sender, const ui::Event& event) = 0; | 22 virtual void ButtonPressed(Button* sender, const ui::Event& event) = 0; |
| 22 | 23 |
| 23 protected: | 24 protected: |
| 24 virtual ~ButtonListener() {} | 25 virtual ~ButtonListener() {} |
| 25 }; | 26 }; |
| 26 | 27 |
| 27 // A View representing a button. Depending on the specific type, the button | 28 // A View representing a button. Depending on the specific type, the button |
| 28 // could be implemented by a native control or custom rendered. | 29 // could be implemented by a native control or custom rendered. |
| 29 class VIEWS_EXPORT Button : public View { | 30 class VIEWS_EXPORT Button : public WidgetObserverView { |
|
sadrul
2016/01/28 17:45:06
We shouldn't do this, of course.
varkha
2016/01/28 20:09:19
Done.
| |
| 30 public: | 31 public: |
| 31 ~Button() override; | 32 ~Button() override; |
| 32 | 33 |
| 33 // Button states for various button sub-types. | 34 // Button states for various button sub-types. |
| 34 enum ButtonState { | 35 enum ButtonState { |
| 35 STATE_NORMAL = 0, | 36 STATE_NORMAL = 0, |
| 36 STATE_HOVERED, | 37 STATE_HOVERED, |
| 37 STATE_PRESSED, | 38 STATE_PRESSED, |
| 38 STATE_DISABLED, | 39 STATE_DISABLED, |
| 39 STATE_COUNT, | 40 STATE_COUNT, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 // The id tag associated with this button. Used to disambiguate buttons in | 89 // The id tag associated with this button. Used to disambiguate buttons in |
| 89 // the ButtonListener implementation. | 90 // the ButtonListener implementation. |
| 90 int tag_; | 91 int tag_; |
| 91 | 92 |
| 92 DISALLOW_COPY_AND_ASSIGN(Button); | 93 DISALLOW_COPY_AND_ASSIGN(Button); |
| 93 }; | 94 }; |
| 94 | 95 |
| 95 } // namespace views | 96 } // namespace views |
| 96 | 97 |
| 97 #endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_H_ | 98 #endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_H_ |
| OLD | NEW |