• 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_TEXT_EXAMPLE_H_
6 #define UI_VIEWS_EXAMPLES_TEXT_EXAMPLE_H_
7 
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_vector.h"
11 #include "ui/views/controls/button/button.h"
12 #include "ui/views/controls/combobox/combobox_listener.h"
13 #include "ui/views/examples/example_base.h"
14 
15 namespace views {
16 class Checkbox;
17 class GridLayout;
18 
19 namespace examples {
20 
21 class ExampleComboboxModel;
22 
23 class TextExample : public ExampleBase,
24                     public ButtonListener,
25                     public ComboboxListener {
26  public:
27   TextExample();
28   virtual ~TextExample();
29 
30   // Overridden from ExampleBase:
31   virtual void CreateExampleView(View* container) OVERRIDE;
32 
33  private:
34   // Creates and adds a check box to the layout.
35   Checkbox* AddCheckbox(GridLayout* layout, const char* name);
36 
37   // Creates and adds a combobox to the layout.
38   Combobox* AddCombobox(GridLayout* layout,
39                         const char* name,
40                         const char** strings,
41                         int count);
42 
43   // Overridden from ButtonListener:
44   virtual void ButtonPressed(Button* button, const ui::Event& event) OVERRIDE;
45 
46   // Overridden from ComboboxListener:
47   virtual void OnSelectedIndexChanged(Combobox* combobox) OVERRIDE;
48 
49   class TextExampleView;
50   // The content of the scroll view.
51   TextExampleView* text_view_;
52 
53   // Combo box for horizontal text alignment.
54   Combobox* h_align_cb_;
55 
56   // Combo box for text eliding style.
57   Combobox* eliding_cb_;
58 
59   // Combo box for ampersand prefix show / hide behavior.
60   Combobox* prefix_cb_;
61 
62   // Combo box to choose one of the sample texts.
63   Combobox* text_cb_;
64 
65   // Check box to enable/disable multiline text drawing.
66   Checkbox* multiline_checkbox_;
67 
68   // Check box to enable/disable character break behavior.
69   Checkbox* break_checkbox_;
70 
71   // Check box to enable/disable text halo.
72   Checkbox* halo_checkbox_;
73 
74   // Check box to enable/disable bold style.
75   Checkbox* bold_checkbox_;
76 
77   // Check box to enable/disable italic style.
78   Checkbox* italic_checkbox_;
79 
80   // Check box to enable/disable underline style.
81   Checkbox* underline_checkbox_;
82 
83   // We create a model for each of the combobox, so we need to keep them
84   // around until destruction time.
85   ScopedVector<ExampleComboboxModel> example_combobox_model_;
86 
87   DISALLOW_COPY_AND_ASSIGN(TextExample);
88 };
89 
90 }  // namespace examples
91 }  // namespace views
92 
93 #endif  // UI_VIEWS_EXAMPLES_TEXT_EXAMPLE_H_
94