| 1 | /* sxiv: thumbs.h |
| 2 | * Copyright (c) 2011 Bert Muennich <muennich at informatik.hu-berlin.de> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of the GNU General Public License as published by the |
| 6 | * Free Software Foundation; either version 2 of the License, or (at your |
| 7 | * option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but |
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along |
| 15 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 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 | const fileinfo_t *file; |
| 31 | int x; |
| 32 | int y; |
| 33 | int w; |
| 34 | int h; |
| 35 | } thumb_t; |
| 36 | |
| 37 | typedef struct { |
| 38 | thumb_t *thumbs; |
| 39 | int cap; |
| 40 | int cnt; |
| 41 | int x; |
| 42 | int y; |
| 43 | int cols; |
| 44 | int rows; |
| 45 | int first; |
| 46 | int sel; |
| 47 | bool alpha; |
| 48 | bool dirty; |
| 49 | } tns_t; |
| 50 | |
| 51 | void tns_clean_cache(tns_t*); |
| 52 | |
| 53 | void tns_init(tns_t*, int); |
| 54 | void tns_free(tns_t*); |
| 55 | |
| 56 | bool tns_load(tns_t*, int, const fileinfo_t*, bool, bool); |
| 57 | |
| 58 | void tns_render(tns_t*, win_t*); |
| 59 | void tns_highlight(tns_t*, win_t*, int, bool); |
| 60 | |
| 61 | bool tns_move_selection(tns_t*, win_t*, direction_t); |
| 62 | bool tns_scroll(tns_t*, direction_t); |
| 63 | |
| 64 | int tns_translate(tns_t*, int, int); |
| 65 | |
| 66 | #endif /* THUMBS_H */ |