forked from artemsen/swayimg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
imagelist.h
86 lines (72 loc) · 1.85 KB
/
imagelist.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// SPDX-License-Identifier: MIT
// List of images.
// Copyright (C) 2022 Artem Senichev <[email protected]>
#pragma once
#include "image.h"
// Configuration parameters
#define IMGLIST_CFG_SECTION "list"
#define IMGLIST_CFG_ORDER "order"
#define IMGLIST_CFG_LOOP "loop"
#define IMGLIST_CFG_RECURSIVE "recursive"
#define IMGLIST_CFG_ALL "all"
/** Image entry. */
struct image_entry {
size_t index; ///< Entry index in the list
struct image* image; ///< Image handle
};
/** Order of file list. */
enum list_order {
order_none, ///< Unsorted (system depended)
order_alpha, ///< Alphanumeric sort
order_random ///< Random order
};
/** Movement directions. */
enum list_jump {
jump_first_file,
jump_last_file,
jump_next_file,
jump_prev_file,
jump_next_dir,
jump_prev_dir
};
/**
* Initialize the image list.
*/
void image_list_init(void);
/**
* Free the image list.
*/
void image_list_free(void);
/**
* Scan directories and fill the image list.
* @param files list of input files
* @param num number of files in the file list
* @return false if no one images loaded
*/
bool image_list_scan(const char** files, size_t num);
/**
* Get image list size.
* @return total number of entries in the list include non-image files
*/
size_t image_list_size(void);
/**
* Get current entry in the image list.
* @return current entry description
*/
struct image_entry image_list_current(void);
/**
* Skip current entry (remove from the image list).
* @return false if the image list is now empty
*/
bool image_list_skip(void);
/**
* Reset cache and reload current image.
* @return false if reset failed (no more images)
*/
bool image_list_reset(void);
/**
* Move through image list.
* @param jump position to set
* @return false if iterator can not be moved
*/
bool image_list_jump(enum list_jump jump);