Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_ | 5 #ifndef UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_ |
| 6 #define UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_ | 6 #define UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_ |
| 7 | 7 |
| 8 #include "ui/compositor/layer_animation_observer.h" | 8 #include "ui/compositor/layer_animation_observer.h" |
| 9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
| 10 #include "ui/views/views_export.h" | 10 #include "ui/views/views_export.h" |
| 11 | 11 |
| 12 namespace views { | 12 namespace views { |
| 13 | 13 |
| 14 // A View that can be closed by a slide-out touch gesture. | 14 // A View that can be closed by a slide-out touch gesture. |
| 15 class VIEWS_EXPORT SlideOutView : public views::View, | 15 class VIEWS_EXPORT SlideOutView : public views::View, |
| 16 public ui::ImplicitAnimationObserver { | 16 public ui::ImplicitAnimationObserver { |
| 17 public: | 17 public: |
| 18 enum SlideDirection { | |
| 19 SLIDE_LEFT, | |
| 20 SLIDE_RIGHT | |
|
msw
2013/01/17 02:28:30
nit: use a comma after trailing enum entries.
dewittj
2013/01/17 21:25:18
Done.
| |
| 21 }; | |
| 22 | |
| 23 class Impl { | |
|
msw
2013/01/17 02:28:30
nit: comment.
dewittj
2013/01/17 21:25:18
Gone.
| |
| 24 public: | |
| 25 virtual void TransformView(float scroll_amount) = 0; | |
| 26 virtual void RestoreView() = 0; | |
| 27 virtual void HideView(SlideDirection direction) = 0; | |
| 28 virtual ~Impl() {} | |
|
msw
2013/01/17 02:28:30
nit: list the destructor above other functions.
dewittj
2013/01/17 21:25:18
Gone.
| |
| 29 }; | |
| 30 | |
| 18 SlideOutView(); | 31 SlideOutView(); |
| 19 virtual ~SlideOutView(); | 32 virtual ~SlideOutView(); |
| 20 | 33 |
| 21 protected: | 34 protected: |
| 22 // Called when user intends to close the View by sliding it out. | 35 // Called when user intends to close the View by sliding it out. |
| 23 virtual void OnSlideOut() = 0; | 36 virtual void OnSlideOut() = 0; |
| 24 | 37 |
| 25 // Overridden from views::View. | 38 // Overridden from views::View. |
| 26 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 39 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 27 | 40 |
| 28 private: | |
| 29 enum SlideDirection { | |
| 30 SLIDE_LEFT, | |
| 31 SLIDE_RIGHT | |
| 32 }; | |
| 33 | |
| 34 // Restores the transform and opacity of the view. | 41 // Restores the transform and opacity of the view. |
| 35 void RestoreVisualState(); | 42 void RestoreVisualState(); |
| 36 | 43 |
| 37 // Slides the view out and closes it after the animation. | 44 // Slides the view out and closes it after the animation. |
| 38 void SlideOutAndClose(SlideDirection direction); | 45 void SlideOutAndClose(SlideDirection direction); |
| 39 | 46 |
| 40 // Overridden from ImplicitAnimationObserver. | 47 // Overridden from ImplicitAnimationObserver. |
| 41 virtual void OnImplicitAnimationsCompleted() OVERRIDE; | 48 virtual void OnImplicitAnimationsCompleted() OVERRIDE; |
| 42 | 49 |
| 50 scoped_ptr<Impl> impl_; | |
| 43 float gesture_scroll_amount_; | 51 float gesture_scroll_amount_; |
| 44 | 52 |
| 45 DISALLOW_COPY_AND_ASSIGN(SlideOutView); | 53 DISALLOW_COPY_AND_ASSIGN(SlideOutView); |
| 46 }; | 54 }; |
| 47 | 55 |
| 48 } // namespace views | 56 } // namespace views |
| 49 | 57 |
| 50 #endif // UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_ | 58 #endif // UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_ |
| OLD | NEW |