| 1 | /* Copyright 2011 Bert Muennich |
| 2 | * |
| 3 | * This file is part of sxiv. |
| 4 | * |
| 5 | * sxiv is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published |
| 7 | * by the Free Software Foundation; either version 2 of the License, |
| 8 | * or (at your option) any later version. |
| 9 | * |
| 10 | * sxiv is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with sxiv. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #ifndef THUMBS_H |
| 20 | #define THUMBS_H |
| 21 | |
| 22 | #include <X11/Xlib.h> |
| 23 | #include <Imlib2.h> |
| 24 | |
| 25 | #include "types.h" |
| 26 | #include "window.h" |
| 27 | |
| 28 | typedef struct { |
| 29 | Imlib_Image im; |
| 30 | int w; |
| 31 | int h; |
| 32 | int x; |
| 33 | int y; |
| 34 | } thumb_t; |
| 35 | |
| 36 | typedef struct { |
| 37 | const fileinfo_t *files; |
| 38 | thumb_t *thumbs; |
| 39 | int cnt; |
| 40 | int loadnext; |
| 41 | int first, end; |
| 42 | int r_first, r_end; |
| 43 | int *sel; |
| 44 | |
| 45 | win_t *win; |
| 46 | int x; |
| 47 | int y; |
| 48 | int cols; |
| 49 | int rows; |
| 50 | |
| 51 | bool dirty; |
| 52 | } tns_t; |
| 53 | |
| 54 | void tns_clean_cache(tns_t*); |
| 55 | |
| 56 | void tns_init(tns_t*, const fileinfo_t*, int, int*, win_t*); |
| 57 | void tns_free(tns_t*); |
| 58 | |
| 59 | bool tns_load(tns_t*, int, bool); |
| 60 | void tns_unload(tns_t*, int); |
| 61 | |
| 62 | void tns_render(tns_t*); |
| 63 | void tns_mark(tns_t*, int, bool); |
| 64 | void tns_highlight(tns_t*, int, bool); |
| 65 | |
| 66 | bool tns_move_selection(tns_t*, direction_t, int); |
| 67 | bool tns_scroll(tns_t*, direction_t, bool); |
| 68 | |
| 69 | int tns_translate(tns_t*, int, int); |
| 70 | |
| 71 | #endif /* THUMBS_H */ |