OLD | NEW |
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 "ui/views/examples/scroll_view_example.h" | 5 #include "ui/views/examples/scroll_view_example.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "ui/views/controls/button/radio_button.h" | 9 #include "ui/views/controls/button/radio_button.h" |
10 #include "ui/views/layout/grid_layout.h" | 10 #include "ui/views/layout/grid_layout.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 GridLayout::USE_PREF, 0, 0); | 82 GridLayout::USE_PREF, 0, 0); |
83 } | 83 } |
84 layout->StartRow(0, 1); | 84 layout->StartRow(0, 1); |
85 layout->AddView(wide_); | 85 layout->AddView(wide_); |
86 layout->AddView(tall_); | 86 layout->AddView(tall_); |
87 layout->AddView(big_square_); | 87 layout->AddView(big_square_); |
88 layout->AddView(small_square_); | 88 layout->AddView(small_square_); |
89 layout->AddView(scroll_to_); | 89 layout->AddView(scroll_to_); |
90 } | 90 } |
91 | 91 |
92 void ScrollViewExample::ButtonPressed(Button* sender, const Event& event) { | 92 void ScrollViewExample::ButtonPressed(Button* sender, const ui::Event& event) { |
93 if (sender == wide_) { | 93 if (sender == wide_) { |
94 scrollable_->SetBounds(0, 0, 1000, 100); | 94 scrollable_->SetBounds(0, 0, 1000, 100); |
95 scrollable_->SetColor(SK_ColorYELLOW, SK_ColorCYAN); | 95 scrollable_->SetColor(SK_ColorYELLOW, SK_ColorCYAN); |
96 } else if (sender == tall_) { | 96 } else if (sender == tall_) { |
97 scrollable_->SetBounds(0, 0, 100, 1000); | 97 scrollable_->SetBounds(0, 0, 100, 1000); |
98 scrollable_->SetColor(SK_ColorRED, SK_ColorCYAN); | 98 scrollable_->SetColor(SK_ColorRED, SK_ColorCYAN); |
99 } else if (sender == big_square_) { | 99 } else if (sender == big_square_) { |
100 scrollable_->SetBounds(0, 0, 1000, 1000); | 100 scrollable_->SetBounds(0, 0, 1000, 1000); |
101 scrollable_->SetColor(SK_ColorRED, SK_ColorGREEN); | 101 scrollable_->SetColor(SK_ColorRED, SK_ColorGREEN); |
102 } else if (sender == small_square_) { | 102 } else if (sender == small_square_) { |
103 scrollable_->SetBounds(0, 0, 100, 100); | 103 scrollable_->SetBounds(0, 0, 100, 100); |
104 scrollable_->SetColor(SK_ColorYELLOW, SK_ColorGREEN); | 104 scrollable_->SetColor(SK_ColorYELLOW, SK_ColorGREEN); |
105 } else if (sender == scroll_to_) { | 105 } else if (sender == scroll_to_) { |
106 scroll_view_->ScrollContentsRegionToBeVisible( | 106 scroll_view_->ScrollContentsRegionToBeVisible( |
107 gfx::Rect(20, 500, 1000, 500)); | 107 gfx::Rect(20, 500, 1000, 500)); |
108 } | 108 } |
109 scroll_view_->Layout(); | 109 scroll_view_->Layout(); |
110 } | 110 } |
111 | 111 |
112 } // namespace examples | 112 } // namespace examples |
113 } // namespace views | 113 } // namespace views |
OLD | NEW |