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

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

Issue 129863002: Makes View::focusable() return last value supplied to SetFocusable() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix views_examples 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/controls/textfield/native_textfield_views_unittest.cc ('k') | ui/views/view.h » ('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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 label_button_->SetImage(Button::STATE_NORMAL, 156 label_button_->SetImage(Button::STATE_NORMAL,
157 label_button_->GetImage(Button::STATE_NORMAL).isNull() ? 157 label_button_->GetImage(Button::STATE_NORMAL).isNull() ?
158 *icon_ : gfx::ImageSkia()); 158 *icon_ : gfx::ImageSkia());
159 } else { 159 } else {
160 label_button_->SetHorizontalAlignment( 160 label_button_->SetHorizontalAlignment(
161 static_cast<gfx::HorizontalAlignment>( 161 static_cast<gfx::HorizontalAlignment>(
162 (label_button_->GetHorizontalAlignment() + 1) % 3)); 162 (label_button_->GetHorizontalAlignment() + 1) % 3));
163 } 163 }
164 } else if (event.IsShiftDown()) { 164 } else if (event.IsShiftDown()) {
165 if (event.IsAltDown()) { 165 if (event.IsAltDown()) {
166 label_button_->SetFocusable(!label_button_->focusable()); 166 label_button_->SetFocusable(!label_button_->IsFocusable());
167 } else { 167 } else {
168 label_button_->SetStyle(static_cast<Button::ButtonStyle>( 168 label_button_->SetStyle(static_cast<Button::ButtonStyle>(
169 (label_button_->style() + 1) % Button::STYLE_COUNT)); 169 (label_button_->style() + 1) % Button::STYLE_COUNT));
170 } 170 }
171 } else if (event.IsAltDown()) { 171 } else if (event.IsAltDown()) {
172 label_button_->SetIsDefault(!label_button_->is_default()); 172 label_button_->SetIsDefault(!label_button_->is_default());
173 } else { 173 } else {
174 label_button_->set_min_size(gfx::Size()); 174 label_button_->set_min_size(gfx::Size());
175 } 175 }
176 example_view()->GetLayoutManager()->Layout(example_view()); 176 example_view()->GetLayoutManager()->Layout(example_view());
177 } 177 }
178 178
179 void ButtonExample::ButtonPressed(Button* sender, const ui::Event& event) { 179 void ButtonExample::ButtonPressed(Button* sender, const ui::Event& event) {
180 if (sender == text_button_) 180 if (sender == text_button_)
181 TextButtonPressed(event); 181 TextButtonPressed(event);
182 else if (sender == label_button_) 182 else if (sender == label_button_)
183 LabelButtonPressed(event); 183 LabelButtonPressed(event);
184 else 184 else
185 PrintStatus("Image Button Pressed! count: %d", ++count_); 185 PrintStatus("Image Button Pressed! count: %d", ++count_);
186 } 186 }
187 187
188 } // namespace examples 188 } // namespace examples
189 } // namespace views 189 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/native_textfield_views_unittest.cc ('k') | ui/views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698