OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/panels/panel_scroller.h" | 5 #include "chrome/browser/chromeos/panels/panel_scroller.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "gfx/canvas.h" | 11 #include "gfx/canvas.h" |
12 #include "chrome/browser/chromeos/panels/panel_scroller_container.h" | 12 #include "chrome/browser/chromeos/panels/panel_scroller_container.h" |
13 #include "chrome/browser/chromeos/panels/panel_scroller_header.h" | 13 #include "chrome/browser/chromeos/panels/panel_scroller_header.h" |
14 #include "views/widget/widget_gtk.h" | 14 #include "views/widget/widget_gtk.h" |
15 | 15 |
16 struct PanelScroller::Panel { | 16 struct PanelScroller::Panel { |
17 PanelScrollerHeader* header; | 17 PanelScrollerHeader* header; |
18 PanelScrollerContainer* container; | 18 PanelScrollerContainer* container; |
19 }; | 19 }; |
20 | 20 |
21 PanelScroller::PanelScroller() | 21 PanelScroller::PanelScroller() |
22 : views::View(), | 22 : views::View(), |
23 divider_height_(18), | 23 divider_height_(18), |
24 needs_layout_(true), | 24 needs_layout_(true), |
25 scroll_pos_(0), | 25 scroll_pos_(0), |
26 ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)), | 26 ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)), |
27 animated_scroll_begin_(0), | 27 animated_scroll_begin_(0), |
28 animated_scroll_end_(0) { | 28 animated_scroll_end_(0) { |
29 animation_.SetTweenType(SlideAnimation::EASE_IN_OUT); | 29 animation_.SetTweenType(Tween::EASE_IN_OUT); |
30 animation_.SetSlideDuration(300); | 30 animation_.SetSlideDuration(300); |
31 | 31 |
32 Panel* panel = new Panel; | 32 Panel* panel = new Panel; |
33 panel->header = new PanelScrollerHeader(this); | 33 panel->header = new PanelScrollerHeader(this); |
34 panel->header->set_title(ASCIIToUTF16("Email")); | 34 panel->header->set_title(ASCIIToUTF16("Email")); |
35 panel->container = new PanelScrollerContainer(this, new views::View()); | 35 panel->container = new PanelScrollerContainer(this, new views::View()); |
36 panels_.push_back(panel); | 36 panels_.push_back(panel); |
37 | 37 |
38 panel = new Panel; | 38 panel = new Panel; |
39 panel->header = new PanelScrollerHeader(this); | 39 panel->header = new PanelScrollerHeader(this); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 animated_scroll_begin_ = scroll_pos_; | 231 animated_scroll_begin_ = scroll_pos_; |
232 if (animated_scroll_begin_ == animated_scroll_end_) | 232 if (animated_scroll_begin_ == animated_scroll_end_) |
233 return; // Nothing to animate. | 233 return; // Nothing to animate. |
234 | 234 |
235 // Start animating to the destination. | 235 // Start animating to the destination. |
236 animation_.Reset(); | 236 animation_.Reset(); |
237 animation_.Show(); | 237 animation_.Show(); |
238 } | 238 } |
239 | 239 |
240 void PanelScroller::AnimationEnded(const Animation* animation) { | |
241 } | |
242 | |
243 void PanelScroller::AnimationProgressed(const Animation* animation) { | 240 void PanelScroller::AnimationProgressed(const Animation* animation) { |
244 scroll_pos_ = static_cast<int>( | 241 scroll_pos_ = static_cast<int>( |
245 static_cast<double>(animated_scroll_end_ - animated_scroll_begin_) * | 242 static_cast<double>(animated_scroll_end_ - animated_scroll_begin_) * |
246 animation_.GetCurrentValue()) + animated_scroll_begin_; | 243 animation_.GetCurrentValue()) + animated_scroll_begin_; |
247 | 244 |
248 Layout(); | 245 Layout(); |
249 SchedulePaint(); | 246 SchedulePaint(); |
250 } | 247 } |
251 | |
252 void PanelScroller::AnimationCanceled(const Animation* animation) { | |
253 } | |
OLD | NEW |