summaryrefslogtreecommitdiffstats
path: root/views/examples/text_example.h
blob: da088adc207242445991ce8cdeffea1091871aad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef VIEWS_EXAMPLES_TEXT_EXAMPLE_H_
#define VIEWS_EXAMPLES_TEXT_EXAMPLE_H_
#pragma once

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "views/controls/button/checkbox.h"
#include "views/controls/combobox/combobox.h"
#include "views/examples/example_base.h"
#include "views/layout/grid_layout.h"

namespace examples {

class TextExample : public ExampleBase,
                    public views::ButtonListener,
                    public views::Combobox::Listener {
 public:
  explicit TextExample(ExamplesMain* main);
  virtual ~TextExample();

  // Overridden from ExampleBase:
  virtual void CreateExampleView(views::View* container) OVERRIDE;

 private:
  // Create and add a combo box to the layout.
  views::Combobox* AddCombobox(views::GridLayout* layout,
                               const char *name,
                               const char** strings,
                               int count);

  // Overridden from views::Combobox::Listener:
  virtual void ItemChanged(views::Combobox* combo_box,
                           int prev_index,
                           int new_index) OVERRIDE;

  // Overridden from views::ButtonListener:
  virtual void ButtonPressed(views::Button* button,
                             const views::Event& event) OVERRIDE;

  class TextExampleView;
  // The content of the scroll view.
  TextExampleView* text_view_;

  // Combo box for horizontal text alignment.
  views::Combobox* h_align_cb_;

  // Combo box for vertical text alignment.
  views::Combobox* v_align_cb_;

  // Combo box for text eliding style.
  views::Combobox* eliding_cb_;

  // Combo box to choose one of the sample texts.
  views::Combobox* text_cb_;

  // Check box to enable/disable multiline text drawing.
  views::Checkbox* multiline_checkbox_;

  // Check box to enable/disable character break behavior.
  views::Checkbox* break_checkbox_;

  DISALLOW_COPY_AND_ASSIGN(TextExample);
};

}  // namespace examples

#endif  // VIEWS_EXAMPLES_TEXT_EXAMPLE_H_