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 <memory> 9 #include <vector> 10 11 #include "base/macros.h" 12 #include "ui/views/controls/button/button.h" 13 #include "ui/views/controls/combobox/combobox_listener.h" 14 #include "ui/views/examples/example_base.h" 15 16 namespace views { 17 class Checkbox; 18 class GridLayout; 19 20 namespace examples { 21 22 class VIEWS_EXAMPLES_EXPORT TextExample : public ExampleBase, 23 public ButtonListener, 24 public ComboboxListener { 25 public: 26 TextExample(); 27 ~TextExample() override; 28 29 // ExampleBase: 30 void CreateExampleView(View* container) override; 31 32 private: 33 // Creates and adds a check box to the layout. 34 Checkbox* AddCheckbox(GridLayout* layout, const char* name); 35 36 // Creates and adds a combobox to the layout. 37 Combobox* AddCombobox(GridLayout* layout, 38 const char* name, 39 const char* const* strings, 40 int count); 41 42 // ButtonListener: 43 void ButtonPressed(Button* button, const ui::Event& event) override; 44 45 // ComboboxListener: 46 void OnPerformAction(Combobox* combobox) override; 47 48 class TextExampleView; 49 // The content of the scroll view. 50 TextExampleView* text_view_; 51 52 // Combo box for horizontal text alignment. 53 Combobox* h_align_cb_; 54 55 // Combo box for text eliding style. 56 Combobox* eliding_cb_; 57 58 // Combo box for ampersand prefix show / hide behavior. 59 Combobox* prefix_cb_; 60 61 // Combo box to choose one of the sample texts. 62 Combobox* text_cb_; 63 64 // Combo box to choose a font weight. 65 Combobox* weight_cb_; 66 67 // Check box to enable/disable multiline text drawing. 68 Checkbox* multiline_checkbox_; 69 70 // Check box to enable/disable character break behavior. 71 Checkbox* break_checkbox_; 72 73 // Check box to enable/disable italic style. 74 Checkbox* italic_checkbox_; 75 76 // Check box to enable/disable underline style. 77 Checkbox* underline_checkbox_; 78 79 DISALLOW_COPY_AND_ASSIGN(TextExample); 80 }; 81 82 } // namespace examples 83 } // namespace views 84 85 #endif // UI_VIEWS_EXAMPLES_TEXT_EXAMPLE_H_ 86