2022-07-02 21:56:10 +02:00
|
|
|
#ifndef HTML_PAGINATOR_H
|
|
|
|
#define HTML_PAGINATOR_H
|
2022-06-25 01:55:54 +02:00
|
|
|
|
2022-07-02 21:56:10 +02:00
|
|
|
#include "core/ustring.h"
|
|
|
|
#include "core/vector.h"
|
2022-06-25 01:55:54 +02:00
|
|
|
|
|
|
|
#include "core/reference.h"
|
|
|
|
|
2022-07-02 21:56:10 +02:00
|
|
|
class HTMLPaginator : public Reference {
|
|
|
|
GDCLASS(HTMLPaginator, Reference);
|
2022-06-25 01:55:54 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
//settint the item count will update page count and vice versa
|
|
|
|
int get_item_count() const;
|
|
|
|
void set_item_count(const int val);
|
|
|
|
|
|
|
|
int get_page_count() const;
|
|
|
|
void set_page_count(const int val);
|
|
|
|
|
|
|
|
int get_max_visible_links() const;
|
|
|
|
void set_max_visible_links(const int val);
|
|
|
|
|
|
|
|
String base_url;
|
|
|
|
Vector<String> links;
|
|
|
|
|
|
|
|
bool use_links_array;
|
|
|
|
bool hide_if_one_page;
|
|
|
|
|
|
|
|
String class_main_ul;
|
|
|
|
String class_enabled_li;
|
|
|
|
String class_disabled_li;
|
|
|
|
String text_next_link;
|
|
|
|
String text_prev_link;
|
|
|
|
|
|
|
|
void start();
|
|
|
|
String next();
|
|
|
|
String get_current();
|
|
|
|
|
|
|
|
String get_pagination_for_indx(const int page_index);
|
|
|
|
String get_pagination_for_num(const int page_num);
|
|
|
|
|
2022-07-02 21:56:10 +02:00
|
|
|
virtual String render_indexed(Ref<HTMLPaginator> target, const int page_index);
|
|
|
|
virtual String render_links(Ref<HTMLPaginator> target, const int page_index);
|
2022-06-25 01:55:54 +02:00
|
|
|
|
2022-07-02 21:56:10 +02:00
|
|
|
Ref<HTMLPaginator> renderer;
|
2022-06-25 01:55:54 +02:00
|
|
|
|
2022-07-02 21:59:24 +02:00
|
|
|
//Old methods for the time being
|
2022-07-02 22:21:43 +02:00
|
|
|
static String get_pagination_old(const String &base_url, const int max, const int current_index, const int max_visible_links = 10);
|
|
|
|
static String get_pagination_links_old(const String &base_url, const Vector<String> &links, const int current_index, const int max_visible_links = 10);
|
2022-07-02 21:59:24 +02:00
|
|
|
|
2022-07-02 21:56:10 +02:00
|
|
|
HTMLPaginator();
|
|
|
|
~HTMLPaginator();
|
2022-06-25 01:55:54 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int _item_count;
|
|
|
|
int _page_count;
|
|
|
|
int _max_visible_links;
|
|
|
|
int _current_page_index;
|
|
|
|
};
|
|
|
|
|
2022-07-02 21:56:10 +02:00
|
|
|
#endif
|