OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_APP_LIST_PAGINATION_MODEL_H_ | |
6 #define ASH_APP_LIST_PAGINATION_MODEL_H_ | |
7 #pragma once | |
8 | |
9 #include "ash/ash_export.h" | |
10 #include "base/basictypes.h" | |
11 #include "base/observer_list.h" | |
12 | |
13 namespace ash { | |
14 | |
15 class PaginationModelObserver; | |
16 | |
17 // A simple pagination model that consists of two numbers: the total pages and | |
18 // the currently selected page. The model is a single selection model that at | |
19 // the most one page can become selected at any time. | |
20 class ASH_EXPORT PaginationModel { | |
21 public: | |
22 PaginationModel(); | |
23 ~PaginationModel(); | |
24 | |
25 void SetTotalPages(int total_pages); | |
26 void SelectPage(int page); | |
27 | |
28 void AddObserver(PaginationModelObserver* observer); | |
29 void RemoveObserver(PaginationModelObserver* observer); | |
30 | |
31 int total_pages() const { | |
32 return total_pages_; | |
33 } | |
34 | |
35 int selected_page() const { | |
36 return selected_page_; | |
37 } | |
38 | |
39 private: | |
40 int total_pages_; | |
41 int selected_page_; | |
42 ObserverList<PaginationModelObserver> observers_; | |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(PaginationModel); | |
45 }; | |
46 | |
47 } // namespace ash | |
48 | |
49 #endif // ASH_APP_LIST_PAGINATION_MODEL_H_ | |
OLD | NEW |