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

Side by Side Diff: views/examples/scroll_view_example.cc

Issue 7349021: Convert some more view methods to the ui/views style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | « views/controls/textfield/native_textfield_win.cc ('k') | views/examples/throbber_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/examples/scroll_view_example.h" 5 #include "views/examples/scroll_view_example.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "views/controls/button/radio_button.h" 8 #include "views/controls/button/radio_button.h"
9 #include "views/layout/grid_layout.h" 9 #include "views/layout/grid_layout.h"
10 #include "views/view.h" 10 #include "views/view.h"
(...skipping 13 matching lines...) Expand all
24 virtual gfx::Size GetPreferredSize() { 24 virtual gfx::Size GetPreferredSize() {
25 return gfx::Size(width(), height()); 25 return gfx::Size(width(), height());
26 } 26 }
27 27
28 void SetColor(SkColor from, SkColor to) { 28 void SetColor(SkColor from, SkColor to) {
29 set_background( 29 set_background(
30 views::Background::CreateVerticalGradientBackground(from, to)); 30 views::Background::CreateVerticalGradientBackground(from, to));
31 } 31 }
32 32
33 void PlaceChildY(int index, int y) { 33 void PlaceChildY(int index, int y) {
34 views::View* view = GetChildViewAt(index); 34 views::View* view = child_at(index);
35 gfx::Size size = view->GetPreferredSize(); 35 gfx::Size size = view->GetPreferredSize();
36 view->SetBounds(0, y, size.width(), size.height()); 36 view->SetBounds(0, y, size.width(), size.height());
37 } 37 }
38 38
39 virtual void Layout() { 39 virtual void Layout() {
40 PlaceChildY(0, 0); 40 PlaceChildY(0, 0);
41 PlaceChildY(1, height() / 2); 41 PlaceChildY(1, height() / 2);
42 SizeToPreferredSize(); 42 SizeToPreferredSize();
43 } 43 }
44 44
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 scrollable_->SetBounds(0, 0, 100, 100); 108 scrollable_->SetBounds(0, 0, 100, 100);
109 scrollable_->SetColor(SK_ColorYELLOW, SK_ColorGREEN); 109 scrollable_->SetColor(SK_ColorYELLOW, SK_ColorGREEN);
110 } else if (sender == scroll_to_) { 110 } else if (sender == scroll_to_) {
111 scroll_view_->ScrollContentsRegionToBeVisible( 111 scroll_view_->ScrollContentsRegionToBeVisible(
112 gfx::Rect(20, 500, 1000, 500)); 112 gfx::Rect(20, 500, 1000, 500));
113 } 113 }
114 scroll_view_->Layout(); 114 scroll_view_->Layout();
115 } 115 }
116 116
117 } // namespace examples 117 } // namespace examples
OLDNEW
« no previous file with comments | « views/controls/textfield/native_textfield_win.cc ('k') | views/examples/throbber_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698