Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: ui/views/examples/textfield_example.cc

Issue 8687013: Get the examples to run in aura_shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/examples/textfield_example.h ('k') | ui/views/examples/throbber_example.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/examples/textfield_example.cc
===================================================================
--- ui/views/examples/textfield_example.cc (revision 111815)
+++ ui/views/examples/textfield_example.cc (working copy)
@@ -12,40 +12,40 @@
#include "views/controls/label.h"
#include "views/view.h"
+namespace views {
namespace examples {
-TextfieldExample::TextfieldExample(ExamplesMain* main)
- : ExampleBase(main, "Textfield") {
+TextfieldExample::TextfieldExample() : ExampleBase("Textfield") {
}
TextfieldExample::~TextfieldExample() {
}
-void TextfieldExample::CreateExampleView(views::View* container) {
- name_ = new views::Textfield();
- password_ = new views::Textfield(views::Textfield::STYLE_PASSWORD);
+void TextfieldExample::CreateExampleView(View* container) {
+ name_ = new Textfield();
+ password_ = new Textfield(Textfield::STYLE_PASSWORD);
password_->set_text_to_display_when_empty(ASCIIToUTF16("password"));
- show_password_ = new views::TextButton(this, ASCIIToUTF16("Show password"));
- clear_all_ = new views::TextButton(this, ASCIIToUTF16("Clear All"));
- append_ = new views::TextButton(this, ASCIIToUTF16("Append"));
- set_ = new views::TextButton(this, ASCIIToUTF16("Set"));
- set_style_ = new views::TextButton(this, ASCIIToUTF16("Set Styles"));
+ show_password_ = new TextButton(this, ASCIIToUTF16("Show password"));
+ clear_all_ = new TextButton(this, ASCIIToUTF16("Clear All"));
+ append_ = new TextButton(this, ASCIIToUTF16("Append"));
+ set_ = new TextButton(this, ASCIIToUTF16("Set"));
+ set_style_ = new TextButton(this, ASCIIToUTF16("Set Styles"));
name_->SetController(this);
password_->SetController(this);
- views::GridLayout* layout = new views::GridLayout(container);
+ GridLayout* layout = new GridLayout(container);
container->SetLayoutManager(layout);
- views::ColumnSet* column_set = layout->AddColumnSet(0);
- column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL,
- 0.2f, views::GridLayout::USE_PREF, 0, 0);
- column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL,
- 0.8f, views::GridLayout::USE_PREF, 0, 0);
+ ColumnSet* column_set = layout->AddColumnSet(0);
+ column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL,
+ 0.2f, GridLayout::USE_PREF, 0, 0);
+ column_set->AddColumn(GridLayout::FILL, GridLayout::FILL,
+ 0.8f, GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, 0);
- layout->AddView(new views::Label(ASCIIToUTF16("Name:")));
+ layout->AddView(new Label(ASCIIToUTF16("Name:")));
layout->AddView(name_);
layout->StartRow(0, 0);
- layout->AddView(new views::Label(ASCIIToUTF16("Password:")));
+ layout->AddView(new Label(ASCIIToUTF16("Password:")));
layout->AddView(password_);
layout->StartRow(0, 0);
layout->AddView(show_password_);
@@ -59,7 +59,7 @@
layout->AddView(set_style_);
}
-void TextfieldExample::ContentsChanged(views::Textfield* sender,
+void TextfieldExample::ContentsChanged(Textfield* sender,
const string16& new_contents) {
if (sender == name_) {
PrintStatus("Name [%s]", UTF16ToUTF8(new_contents).c_str());
@@ -68,13 +68,13 @@
}
}
-bool TextfieldExample::HandleKeyEvent(views::Textfield* sender,
- const views::KeyEvent& key_event) {
+bool TextfieldExample::HandleKeyEvent(Textfield* sender,
+ const KeyEvent& key_event) {
return false;
}
-void TextfieldExample::ButtonPressed(views::Button* sender,
- const views::Event& event) {
+void TextfieldExample::ButtonPressed(Button* sender,
+ const Event& event) {
if (sender == show_password_) {
PrintStatus("Password [%s]", UTF16ToUTF8(password_->text()).c_str());
} else if (sender == clear_all_) {
@@ -111,3 +111,4 @@
}
} // namespace examples
+} // namespace views
« no previous file with comments | « ui/views/examples/textfield_example.h ('k') | ui/views/examples/throbber_example.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698