| 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/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ui/views/controls/button/label_button.h" |
| 10 #include "ui/views/controls/button/text_button.h" | 11 #include "ui/views/controls/button/text_button.h" |
| 11 #include "ui/views/examples/example_base.h" | 12 #include "ui/views/examples/example_base.h" |
| 12 | 13 |
| 13 namespace views { | 14 namespace views { |
| 14 | 15 |
| 15 class ImageButton; | 16 class ImageButton; |
| 16 | 17 |
| 17 namespace examples { | 18 namespace examples { |
| 18 | 19 |
| 19 // ButtonExample simply counts the number of clicks. | 20 // ButtonExample simply counts the number of clicks. |
| 20 class ButtonExample : public ExampleBase, public ButtonListener { | 21 class ButtonExample : public ExampleBase, public ButtonListener { |
| 21 public: | 22 public: |
| 22 ButtonExample(); | 23 ButtonExample(); |
| 23 virtual ~ButtonExample(); | 24 virtual ~ButtonExample(); |
| 24 | 25 |
| 25 // Overridden from ExampleBase: | 26 // Overridden from ExampleBase: |
| 26 virtual void CreateExampleView(View* container) OVERRIDE; | 27 virtual void CreateExampleView(View* container) OVERRIDE; |
| 27 | 28 |
| 28 private: | 29 private: |
| 30 void TextButtonPressed(const ui::Event& event); |
| 31 void LabelButtonPressed(const ui::Event& event); |
| 32 |
| 29 // Overridden from ButtonListener: | 33 // Overridden from ButtonListener: |
| 30 virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; | 34 virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; |
| 31 | 35 |
| 32 // Example buttons. | 36 // Example buttons. |
| 33 TextButton* text_button_; | 37 TextButton* text_button_; |
| 38 LabelButton* label_button_; |
| 34 ImageButton* image_button_; | 39 ImageButton* image_button_; |
| 35 | 40 |
| 36 // Values used to modify the look and feel of the button. | 41 // Values used to modify the look and feel of the button. |
| 37 TextButton::TextAlignment alignment_; | 42 TextButton::TextAlignment alignment_; |
| 38 bool use_native_theme_border_; | 43 bool use_native_theme_border_; |
| 39 const gfx::ImageSkia* icon_; | 44 const gfx::ImageSkia* icon_; |
| 40 | 45 |
| 41 // The number of times the buttons are pressed. | 46 // The number of times the buttons are pressed. |
| 42 int count_; | 47 int count_; |
| 43 | 48 |
| 44 DISALLOW_COPY_AND_ASSIGN(ButtonExample); | 49 DISALLOW_COPY_AND_ASSIGN(ButtonExample); |
| 45 }; | 50 }; |
| 46 | 51 |
| 47 } // namespace examples | 52 } // namespace examples |
| 48 } // namespace views | 53 } // namespace views |
| 49 | 54 |
| 50 #endif // UI_VIEWS_EXAMPLES_BUTTON_EXAMPLE_H_ | 55 #endif // UI_VIEWS_EXAMPLES_BUTTON_EXAMPLE_H_ |
| OLD | NEW |