summaryrefslogtreecommitdiffstats
path: root/views/examples/textfield_example.h
diff options
context:
space:
mode:
Diffstat (limited to 'views/examples/textfield_example.h')
-rw-r--r--views/examples/textfield_example.h31
1 files changed, 20 insertions, 11 deletions
diff --git a/views/examples/textfield_example.h b/views/examples/textfield_example.h
index 2feed4f..e30f3f9 100644
--- a/views/examples/textfield_example.h
+++ b/views/examples/textfield_example.h
@@ -21,20 +21,18 @@ class TextfieldExample : protected ExampleBase,
private Textfield::Controller,
private views::ButtonListener {
public:
- TextfieldExample(views::TabbedPane* tabbed_pane, views::Label* message)
- : ExampleBase(message),
- name_(new Textfield()),
- password_(new Textfield(Textfield::STYLE_PASSWORD)),
- show_password_(new views::TextButton(this, L"Show password")),
- clear_all_(new views::TextButton(this, L"Clear All")),
- append_(new views::TextButton(this, L"Append")) {
+ explicit TextfieldExample(ExamplesMain* main) : ExampleBase(main) {
+ name_ = new Textfield();
+ password_ = new Textfield(Textfield::STYLE_PASSWORD);
+ show_password_ = new views::TextButton(this, L"Show password");
+ clear_all_ = new views::TextButton(this, L"Clear All");
+ append_ = new views::TextButton(this, L"Append");
name_->SetController(this);
password_->SetController(this);
- views::View* container = new views::View();
- tabbed_pane->AddTab(L"Textfield", container);
- views::GridLayout* layout = new views::GridLayout(container);
- container->SetLayoutManager(layout);
+ container_ = new views::View();
+ views::GridLayout* layout = new views::GridLayout(container_);
+ container_->SetLayoutManager(layout);
views::ColumnSet* column_set = layout->AddColumnSet(0);
column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL,
@@ -57,6 +55,14 @@ class TextfieldExample : protected ExampleBase,
virtual ~TextfieldExample() {}
+ virtual std::wstring GetExampleTitle() {
+ return L"Textfield";
+ }
+
+ virtual views::View* GetExampleView() {
+ return container_;
+ }
+
private:
// Textfield::Controller implementations:
// This method is called whenever the text in the field changes.
@@ -89,6 +95,9 @@ class TextfieldExample : protected ExampleBase,
}
}
+ // The view containing this test's controls.
+ views::View* container_;
+
// Textfields for name and password.
views::Textfield* name_;
views::Textfield* password_;