| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TEXT_EXAMPLE_H_ | 5 #ifndef UI_VIEWS_EXAMPLES_TEXT_EXAMPLE_H_ |
| 6 #define UI_VIEWS_EXAMPLES_TEXT_EXAMPLE_H_ | 6 #define UI_VIEWS_EXAMPLES_TEXT_EXAMPLE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "ui/views/controls/button/button.h" | 11 #include "ui/views/controls/button/button.h" |
| 12 #include "ui/views/controls/combobox/combobox_listener.h" | 12 #include "ui/views/controls/combobox/combobox_listener.h" |
| 13 #include "ui/views/examples/example_base.h" | 13 #include "ui/views/examples/example_base.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 class Checkbox; | 16 class Checkbox; |
| 17 class GridLayout; | 17 class GridLayout; |
| 18 } | |
| 19 | 18 |
| 20 namespace examples { | 19 namespace examples { |
| 21 | 20 |
| 22 class TextExample : public ExampleBase, | 21 class TextExample : public ExampleBase, |
| 23 public views::ButtonListener, | 22 public ButtonListener, |
| 24 public views::ComboboxListener { | 23 public ComboboxListener { |
| 25 public: | 24 public: |
| 26 explicit TextExample(ExamplesMain* main); | 25 TextExample(); |
| 27 virtual ~TextExample(); | 26 virtual ~TextExample(); |
| 28 | 27 |
| 29 // Overridden from ExampleBase: | 28 // Overridden from ExampleBase: |
| 30 virtual void CreateExampleView(views::View* container) OVERRIDE; | 29 virtual void CreateExampleView(View* container) OVERRIDE; |
| 31 | 30 |
| 32 private: | 31 private: |
| 33 // Create and add a combo box to the layout. | 32 // Create and add a combo box to the layout. |
| 34 views::Combobox* AddCombobox(views::GridLayout* layout, | 33 Combobox* AddCombobox(GridLayout* layout, |
| 35 const char* name, | 34 const char* name, |
| 36 const char** strings, | 35 const char** strings, |
| 37 int count); | 36 int count); |
| 38 | 37 |
| 39 // Overridden from views::ButtonListener: | 38 // Overridden from ButtonListener: |
| 40 virtual void ButtonPressed(views::Button* button, | 39 virtual void ButtonPressed(Button* button, const Event& event) OVERRIDE; |
| 41 const views::Event& event) OVERRIDE; | |
| 42 | 40 |
| 43 // Overridden from views::ComboboxListener: | 41 // Overridden from ComboboxListener: |
| 44 virtual void ItemChanged(views::Combobox* combo_box, | 42 virtual void ItemChanged(Combobox* combo_box, |
| 45 int prev_index, | 43 int prev_index, |
| 46 int new_index) OVERRIDE; | 44 int new_index) OVERRIDE; |
| 47 | 45 |
| 48 | 46 |
| 49 class TextExampleView; | 47 class TextExampleView; |
| 50 // The content of the scroll view. | 48 // The content of the scroll view. |
| 51 TextExampleView* text_view_; | 49 TextExampleView* text_view_; |
| 52 | 50 |
| 53 // Combo box for horizontal text alignment. | 51 // Combo box for horizontal text alignment. |
| 54 views::Combobox* h_align_cb_; | 52 Combobox* h_align_cb_; |
| 55 | 53 |
| 56 // Combo box for vertical text alignment. | 54 // Combo box for vertical text alignment. |
| 57 views::Combobox* v_align_cb_; | 55 Combobox* v_align_cb_; |
| 58 | 56 |
| 59 // Combo box for text eliding style. | 57 // Combo box for text eliding style. |
| 60 views::Combobox* eliding_cb_; | 58 Combobox* eliding_cb_; |
| 61 | 59 |
| 62 // Combo box for ampersand prefix show / hide behavior. | 60 // Combo box for ampersand prefix show / hide behavior. |
| 63 views::Combobox* prefix_cb_; | 61 Combobox* prefix_cb_; |
| 64 | 62 |
| 65 // Combo box to choose one of the sample texts. | 63 // Combo box to choose one of the sample texts. |
| 66 views::Combobox* text_cb_; | 64 Combobox* text_cb_; |
| 67 | 65 |
| 68 // Check box to enable/disable multiline text drawing. | 66 // Check box to enable/disable multiline text drawing. |
| 69 views::Checkbox* multiline_checkbox_; | 67 Checkbox* multiline_checkbox_; |
| 70 | 68 |
| 71 // Check box to enable/disable character break behavior. | 69 // Check box to enable/disable character break behavior. |
| 72 views::Checkbox* break_checkbox_; | 70 Checkbox* break_checkbox_; |
| 73 | 71 |
| 74 DISALLOW_COPY_AND_ASSIGN(TextExample); | 72 DISALLOW_COPY_AND_ASSIGN(TextExample); |
| 75 }; | 73 }; |
| 76 | 74 |
| 77 } // namespace examples | 75 } // namespace examples |
| 76 } // namespace views |
| 78 | 77 |
| 79 #endif // UI_VIEWS_EXAMPLES_TEXT_EXAMPLE_H_ | 78 #endif // UI_VIEWS_EXAMPLES_TEXT_EXAMPLE_H_ |
| OLD | NEW |