| 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_EXAMPLES_BUTTON_EXAMPLE_H_ | 5 #ifndef UI_VIEWS_EXAMPLES_BUTTON_EXAMPLE_H_ |
| 6 #define UI_VIEWS_EXAMPLES_BUTTON_EXAMPLE_H_ | 6 #define UI_VIEWS_EXAMPLES_BUTTON_EXAMPLE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/views/controls/button/button.h" | 9 #include "ui/views/controls/button/button.h" |
| 10 #include "ui/views/controls/button/image_button.h" |
| 10 #include "ui/views/examples/example_base.h" | 11 #include "ui/views/examples/example_base.h" |
| 11 | 12 |
| 12 namespace views { | 13 namespace views { |
| 13 | 14 |
| 14 class ImageButton; | 15 class ImageButton; |
| 15 class LabelButton; | 16 class LabelButton; |
| 16 class MdTextButton; | 17 class MdTextButton; |
| 17 | 18 |
| 18 namespace examples { | 19 namespace examples { |
| 19 | 20 |
| 20 // ButtonExample simply counts the number of clicks. | 21 // ButtonExample simply counts the number of clicks. |
| 21 class VIEWS_EXAMPLES_EXPORT ButtonExample : public ExampleBase, | 22 class VIEWS_EXAMPLES_EXPORT ButtonExample : public ExampleBase, |
| 22 public ButtonListener { | 23 public ImageButtonDelegate { |
| 23 public: | 24 public: |
| 24 ButtonExample(); | 25 ButtonExample(); |
| 25 ~ButtonExample() override; | 26 ~ButtonExample() override; |
| 26 | 27 |
| 27 // ExampleBase: | 28 // ExampleBase: |
| 28 void CreateExampleView(View* container) override; | 29 void CreateExampleView(View* container) override; |
| 29 | 30 |
| 30 private: | 31 private: |
| 31 void LabelButtonPressed(LabelButton* label_button, const ui::Event& event); | 32 void LabelButtonPressed(LabelButton* label_button, const ui::Event& event); |
| 32 | 33 |
| 33 // ButtonListener: | 34 // ImageButtonDelegate: |
| 34 void ButtonPressed(Button* sender, const ui::Event& event) override; | 35 void ButtonPressed(Button* sender, const ui::Event& event) override; |
| 35 | 36 |
| 36 // Example buttons. | 37 // Example buttons. |
| 37 LabelButton* label_button_ = nullptr; | 38 LabelButton* label_button_ = nullptr; |
| 38 LabelButton* styled_button_ = nullptr; | 39 LabelButton* styled_button_ = nullptr; |
| 39 LabelButton* disabled_button_ = nullptr; | 40 LabelButton* disabled_button_ = nullptr; |
| 40 MdTextButton* md_button_ = nullptr; | 41 MdTextButton* md_button_ = nullptr; |
| 41 MdTextButton* md_default_button_ = nullptr; | 42 MdTextButton* md_default_button_ = nullptr; |
| 42 ImageButton* image_button_ = nullptr; | 43 ImageButton* image_button_ = nullptr; |
| 43 | 44 |
| 44 const gfx::ImageSkia* icon_ = nullptr; | 45 const gfx::ImageSkia* icon_ = nullptr; |
| 45 | 46 |
| 46 // The number of times the buttons are pressed. | 47 // The number of times the buttons are pressed. |
| 47 int count_ = 0; | 48 int count_ = 0; |
| 48 | 49 |
| 49 DISALLOW_COPY_AND_ASSIGN(ButtonExample); | 50 DISALLOW_COPY_AND_ASSIGN(ButtonExample); |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 } // namespace examples | 53 } // namespace examples |
| 53 } // namespace views | 54 } // namespace views |
| 54 | 55 |
| 55 #endif // UI_VIEWS_EXAMPLES_BUTTON_EXAMPLE_H_ | 56 #endif // UI_VIEWS_EXAMPLES_BUTTON_EXAMPLE_H_ |
| OLD | NEW |