summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 00:43:33 +0000
committerasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 00:43:33 +0000
commit76490c65e89f557afde04effe45c4d9c3a003036 (patch)
treeb06ca28b75e025e04d99eb5c3fd151aa878cd1c5 /views
parentaff5ed9e45b7fbffbffa00f0e550637c213f2089 (diff)
downloadchromium_src-76490c65e89f557afde04effe45c4d9c3a003036.zip
chromium_src-76490c65e89f557afde04effe45c4d9c3a003036.tar.gz
chromium_src-76490c65e89f557afde04effe45c4d9c3a003036.tar.bz2
Add ampersand prefix options to views text example.
BUG=none TEST=manual Review URL: http://codereview.chromium.org/8232009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104963 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/examples/text_example.cc29
-rw-r--r--views/examples/text_example.h3
2 files changed, 32 insertions, 0 deletions
diff --git a/views/examples/text_example.cc b/views/examples/text_example.cc
index 50695930..cf484e8 100644
--- a/views/examples/text_example.cc
+++ b/views/examples/text_example.cc
@@ -1,3 +1,4 @@
+
// 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.
@@ -26,11 +27,14 @@ const char kLongText[] =
"velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint "
"occaecat cupidatat non proident, sunt in culpa qui officia deserunt "
"mollit anim id est laborum.";
+const char kAmpersandText[] =
+ "The quick && &brown fo&x jumps over the lazy dog.";
const char* kTextExamples[] = {
"Short",
"Medium",
"Long",
+ "Ampersands",
};
const char* kElidingBehaviors[] = {
@@ -43,6 +47,12 @@ const char* kElidingBehaviors[] = {
#endif
};
+const char* kPrefixOptions[] = {
+ "Default",
+ "Show",
+ "Hide",
+};
+
const char* kHorizontalAligments[] = {
"Default",
"Left",
@@ -173,6 +183,10 @@ void TextExample::CreateExampleView(views::View* container) {
"Eliding",
kElidingBehaviors,
arraysize(kElidingBehaviors));
+ prefix_cb_ = AddCombobox(layout,
+ "Prefix",
+ kPrefixOptions,
+ arraysize(kPrefixOptions));
text_cb_ = AddCombobox(layout,
"Example Text",
kTextExamples,
@@ -266,6 +280,9 @@ void TextExample::ItemChanged(views::Combobox* combo_box,
case 2:
text_view_->set_text(ASCIIToUTF16(kLongText));
break;
+ case 3:
+ text_view_->set_text(ASCIIToUTF16(kAmpersandText));
+ break;
}
} else if (combo_box == eliding_cb_) {
switch (new_index) {
@@ -292,6 +309,18 @@ void TextExample::ItemChanged(views::Combobox* combo_box,
break;
#endif
}
+ } else if (combo_box == prefix_cb_) {
+ text_flags &= ~(gfx::Canvas::SHOW_PREFIX | gfx::Canvas::HIDE_PREFIX);
+ switch (new_index) {
+ case 0:
+ break;
+ case 1:
+ text_flags |= gfx::Canvas::SHOW_PREFIX;
+ break;
+ case 2:
+ text_flags |= gfx::Canvas::HIDE_PREFIX;
+ break;
+ }
}
text_view_->set_text_flags(text_flags);
text_view_->SchedulePaint();
diff --git a/views/examples/text_example.h b/views/examples/text_example.h
index 281c971..59569f8 100644
--- a/views/examples/text_example.h
+++ b/views/examples/text_example.h
@@ -59,6 +59,9 @@ class TextExample : public ExampleBase,
// Combo box for text eliding style.
views::Combobox* eliding_cb_;
+ // Combo box for ampersand prefix show / hide behavior.
+ views::Combobox* prefix_cb_;
+
// Combo box to choose one of the sample texts.
views::Combobox* text_cb_;