Add PanColor to simplify pan functions
[geeqie.git] / src / pan-view / pan-item.h
1 /*
2  * Copyright (C) 2006 John Ellis
3  * Copyright (C) 2008 - 2016 The Geeqie Team
4  *
5  * Author: John Ellis
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef PAN_VIEW_PAN_ITEM_H
23 #define PAN_VIEW_PAN_ITEM_H
24
25 #include <gdk-pixbuf/gdk-pixbuf.h>
26 #include <glib.h>
27
28 #include "pan-types.h"
29
30 struct FileData;
31 struct PixbufRenderer;
32
33 void pan_item_free(PanItem *pi);
34
35 void pan_item_set_key(PanItem *pi, const gchar *key);
36 void pan_item_added(PanWindow *pw, PanItem *pi);
37 void pan_item_remove(PanWindow *pw, PanItem *pi);
38
39 // Determine sizes
40 void pan_item_size_by_item(PanItem *pi, PanItem *child, gint border);
41 void pan_item_size_coordinates(PanItem *pi, gint border, gint *w, gint *h);
42
43 // Find items
44 PanItem *pan_item_find_by_key(PanWindow *pw, PanItemType type, const gchar *key);
45 GList *pan_item_find_by_path(PanWindow *pw, PanItemType type, const gchar *path,
46                              gboolean ignore_case, gboolean partial);
47 GList *pan_item_find_by_fd(PanWindow *pw, PanItemType type, FileData *fd,
48                            gboolean ignore_case, gboolean partial);
49 PanItem *pan_item_find_by_coord(PanWindow *pw, PanItemType type,
50                                 gint x, gint y, const gchar *key);
51
52 // Item box type
53 PanItem *pan_item_box_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height,
54                           gint border_size, const PanColor &base, const PanColor &bord);
55 void pan_item_box_shadow(PanItem *pi, gint offset, gint fade);
56 gint pan_item_box_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
57                        gint x, gint y, gint width, gint height);
58
59 // Item triangle type
60 PanItem *pan_item_tri_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height,
61                           gint x1, gint y1, gint x2, gint y2, gint x3, gint y3,
62                           const PanColor &color);
63 void pan_item_tri_border(PanItem *pi, gint borders, const PanColor &color);
64 gint pan_item_tri_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
65                        gint x, gint y, gint width, gint height);
66
67 // Item text type
68 PanItem *pan_item_text_new(PanWindow *pw, gint x, gint y, const gchar *text,
69                            PanTextAttrType attr, PanBorderType border, const PanColor &color);
70 gint pan_item_text_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
71                         gint x, gint y, gint width, gint height);
72
73 // Item thumbnail type
74 PanItem *pan_item_thumb_new(PanWindow *pw, FileData *fd, gint x, gint y);
75 gint pan_item_thumb_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
76                          gint x, gint y, gint width, gint height);
77
78 // Item image type
79 PanItem *pan_item_image_new(PanWindow *pw, FileData *fd, gint x, gint y, gint w, gint h);
80 gint pan_item_image_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr,
81                          gint x, gint y, gint width, gint height);
82
83 // Alignment
84 struct PanTextAlignment {
85         PanWindow *pw;
86
87         GList *column1;
88         GList *column2;
89
90         gint x;
91         gint y;
92         gchar *key;
93 };
94
95 PanTextAlignment *pan_text_alignment_new(PanWindow *pw, gint x, gint y, const gchar *key);
96 void pan_text_alignment_free(PanTextAlignment *ta);
97
98 PanItem *pan_text_alignment_add(PanTextAlignment *ta, const gchar *label, const gchar *text);
99 void pan_text_alignment_calc(PanTextAlignment *ta, PanItem *box);
100
101 #endif