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