Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_APP_LIST_PAGINATION_CONTROLLER_H_ | |
| 6 #define UI_APP_LIST_PAGINATION_CONTROLLER_H_ | |
| 7 | |
| 8 #include "ui/app_list/app_list_export.h" | |
| 9 | |
| 10 namespace gfx { | |
| 11 class Point; | |
| 12 class Rect; | |
| 13 } | |
| 14 | |
| 15 namespace ui { | |
| 16 class GestureEvent; | |
| 17 class ScrollEvent; | |
|
calamity
2014/09/01 01:49:30
Unnecessary forward declaration.
Matt Giuca
2014/09/01 03:02:26
Done.
| |
| 18 } | |
| 19 | |
| 20 namespace app_list { | |
| 21 | |
| 22 class PaginationModel; | |
| 23 | |
| 24 // Receives user scroll events from various sources (mouse wheel, touchpad, | |
| 25 // touch gestures) and manipulates a PaginationModel as necessary. | |
| 26 class APP_LIST_EXPORT PaginationController { | |
| 27 public: | |
| 28 enum ScrollAxis { SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_VERTICAL }; | |
| 29 | |
| 30 // Creates a PaginationController. Does not take ownership of |model|. The | |
| 31 // |model| is required to outlive this PaginationController. |scroll_axis| | |
| 32 // specifies the axis in which the pages will scroll. | |
| 33 PaginationController(PaginationModel* model, ScrollAxis scroll_axis); | |
| 34 | |
| 35 ScrollAxis scroll_axis() const { return scroll_axis_; } | |
| 36 | |
| 37 // Handles a mouse wheel or touchpad scroll event in the area represented by | |
| 38 // the PaginationModel. |offset| is the number of units scrolled in each axis. | |
| 39 bool OnScroll(const gfx::Point& offset); | |
|
calamity
2014/09/01 01:49:30
This API seems kinda weird. The fact that OnGestur
Matt Giuca
2014/09/01 03:02:26
I agree that this should return a bool instead of
calamity
2014/09/01 05:50:32
Ack.
| |
| 40 | |
| 41 // Handles a touch gesture event in the area represented by the | |
| 42 // PaginationModel. | |
| 43 void OnGestureEvent(ui::GestureEvent* event, const gfx::Rect& bounds); | |
| 44 | |
| 45 private: | |
| 46 PaginationModel* pagination_model_; // Not owned. | |
| 47 ScrollAxis scroll_axis_; | |
| 48 }; | |
| 49 | |
| 50 } // namespace app_list | |
| 51 | |
| 52 #endif // UI_APP_LIST_PAGINATION_CONTROLLER_H_ | |
| OLD | NEW |