forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
advanced_inv_pagination.h
34 lines (29 loc) · 1.17 KB
/
advanced_inv_pagination.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#ifndef CATA_SRC_ADVANCED_INV_PAGINATION_H
#define CATA_SRC_ADVANCED_INV_PAGINATION_H
class advanced_inventory_pane;
class item_category;
/**
* This class determines the page and line at which an item appears in the AIM.
*/
class advanced_inventory_pagination
{
private:
const int linesPerPage;
const advanced_inventory_pane &pane;
int lines_needed( int index );
public:
int line;
int page;
const item_category *last_category;
advanced_inventory_pagination( int linesPerPage, const advanced_inventory_pane &pane )
: linesPerPage( linesPerPage ), pane( pane ), line( 0 ), page( 0 ), last_category( nullptr ) { }
/// Reset pagination state to the start of the current page, so it can be printed.
void reset_page();
/// Returns true if printing an item with the category requires a category header.
bool new_category( const item_category *cat );
/// Step the pagination state forward for the item with this index.
/// Returns true if printing the item required starting a new page.
bool step( int index );
};
#endif // CATA_SRC_ADVANCED_INV_PAGINATION_H