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

Side by Side Diff: ui/views/examples/button_example.cc

Issue 145033006: views: Make View::set_border() take a scoped_ptr<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 years, 11 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/corewm/tooltip_aura.cc ('k') | ui/views/examples/label_example.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ui/views/examples/button_example.h" 5 #include "ui/views/examples/button_example.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/image/image.h" 10 #include "ui/gfx/image/image.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 break; 119 break;
120 } 120 }
121 text_button_->set_alignment(alignment_); 121 text_button_->set_alignment(alignment_);
122 } 122 }
123 } else if (event.IsShiftDown()) { 123 } else if (event.IsShiftDown()) {
124 if (event.IsAltDown()) { 124 if (event.IsAltDown()) {
125 text_button_->SetText(ASCIIToUTF16( 125 text_button_->SetText(ASCIIToUTF16(
126 text_button_->text().length() < 50 ? kLongText : kTextButton)); 126 text_button_->text().length() < 50 ? kLongText : kTextButton));
127 } else { 127 } else {
128 use_native_theme_border_ = !use_native_theme_border_; 128 use_native_theme_border_ = !use_native_theme_border_;
129 if (use_native_theme_border_) 129 if (use_native_theme_border_) {
130 text_button_->set_border(new TextButtonNativeThemeBorder(text_button_)); 130 text_button_->SetBorder(scoped_ptr<views::Border>(
131 else 131 new TextButtonNativeThemeBorder(text_button_)));
132 text_button_->set_border(new TextButtonDefaultBorder()); 132 } else {
133 text_button_->SetBorder(
134 scoped_ptr<views::Border>(new TextButtonDefaultBorder()));
135 }
133 } 136 }
134 } else if (event.IsAltDown()) { 137 } else if (event.IsAltDown()) {
135 text_button_->SetIsDefault(!text_button_->is_default()); 138 text_button_->SetIsDefault(!text_button_->is_default());
136 } else { 139 } else {
137 text_button_->ClearMaxTextSize(); 140 text_button_->ClearMaxTextSize();
138 } 141 }
139 example_view()->GetLayoutManager()->Layout(example_view()); 142 example_view()->GetLayoutManager()->Layout(example_view());
140 } 143 }
141 144
142 void ButtonExample::LabelButtonPressed(const ui::Event& event) { 145 void ButtonExample::LabelButtonPressed(const ui::Event& event) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (sender == text_button_) 183 if (sender == text_button_)
181 TextButtonPressed(event); 184 TextButtonPressed(event);
182 else if (sender == label_button_) 185 else if (sender == label_button_)
183 LabelButtonPressed(event); 186 LabelButtonPressed(event);
184 else 187 else
185 PrintStatus("Image Button Pressed! count: %d", ++count_); 188 PrintStatus("Image Button Pressed! count: %d", ++count_);
186 } 189 }
187 190
188 } // namespace examples 191 } // namespace examples
189 } // namespace views 192 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/tooltip_aura.cc ('k') | ui/views/examples/label_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698