| 1 | /* sxiv: thumbs.h |
| 2 | * Copyright (c) 2011 Bert Muennich <be.muennich at googlemail.com> |
| 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 | const fileinfo_t *file; |
| 30 | Imlib_Image *im; |
| 31 | int w; |
| 32 | int h; |
| 33 | int x; |
| 34 | int y; |
| 35 | } thumb_t; |
| 36 | |
| 37 | typedef struct { |
| 38 | thumb_t *thumbs; |
| 39 | int cap; |
| 40 | int cnt; |
| 41 | int first; |
| 42 | int sel; |
| 43 | |
| 44 | win_t *win; |
| 45 | int x; |
| 46 | int y; |
| 47 | int cols; |
| 48 | int rows; |
| 49 | |
| 50 | bool alpha; |
| 51 | bool dirty; |
| 52 | } tns_t; |
| 53 | |
| 54 | void tns_clean_cache(tns_t*); |
| 55 | |
| 56 | void tns_init(tns_t*, int, win_t*); |
| 57 | void tns_free(tns_t*); |
| 58 | |
| 59 | bool tns_load(tns_t*, int, const fileinfo_t*, bool, bool); |
| 60 | |
| 61 | void tns_render(tns_t*); |
| 62 | void tns_highlight(tns_t*, int, bool); |
| 63 | |
| 64 | bool tns_move_selection(tns_t*, direction_t); |
| 65 | bool tns_scroll(tns_t*, direction_t); |
| 66 | |
| 67 | int tns_translate(tns_t*, int, int); |
| 68 | |
| 69 | #endif /* THUMBS_H */ |