1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 
3 /*
4  *  GThumb
5  *
6  *  Copyright (C) 2008 Free Software Foundation, Inc.
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef GTH_FILE_VIEW_H
23 #define GTH_FILE_VIEW_H
24 
25 #include <glib.h>
26 #include <glib-object.h>
27 #include <gtk/gtk.h>
28 
29 G_BEGIN_DECLS
30 
31 #define GTH_TYPE_FILE_VIEW               (gth_file_view_get_type ())
32 #define GTH_FILE_VIEW(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_FILE_VIEW, GthFileView))
33 #define GTH_IS_FILE_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_FILE_VIEW))
34 #define GTH_FILE_VIEW_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTH_TYPE_FILE_VIEW, GthFileViewInterface))
35 
36 typedef struct _GthFileView GthFileView;
37 typedef struct _GthFileViewInterface GthFileViewInterface;
38 
39 typedef enum  {
40 	GTH_VISIBILITY_NONE,
41 	GTH_VISIBILITY_FULL,
42 	GTH_VISIBILITY_PARTIAL,
43 	GTH_VISIBILITY_PARTIAL_TOP,
44 	GTH_VISIBILITY_PARTIAL_BOTTOM
45 } GthVisibility;
46 
47 typedef enum {
48 	GTH_FILE_VIEW_RENDERER_CHECKBOX,
49 	GTH_FILE_VIEW_RENDERER_THUMBNAIL,
50 	GTH_FILE_VIEW_RENDERER_TEXT
51 } GthFileViewRendererType;
52 
53 struct _GthFileViewInterface {
54 	GTypeInterface parent_iface;
55 
56 	/*< signals >*/
57 
58 	void            (*cursor_changed)                (GthFileView              *self,
59 							  int                       pos);
60 	void            (*file_activated)                (GthFileView              *self,
61 					     	     	  int                       pos);
62 
63 	/*< virtual functions >*/
64 
65 	void            (*scroll_to)                     (GthFileView              *self,
66 							  int                       pos,
67 							  double                    yalign);
68 	void            (*set_vscroll)                   (GthFileView              *self,
69 							  double                    vscroll);
70 	GthVisibility   (*get_visibility)                (GthFileView              *self,
71 							  int                       pos);
72 	int             (*get_at_position)               (GthFileView              *self,
73 							  int                       x,
74 							  int                       y);
75 	int             (*get_first_visible)             (GthFileView              *self);
76 	int             (*get_last_visible)              (GthFileView              *self);
77 	int             (*get_cursor)                    (GthFileView              *self);
78 	void            (*enable_drag_source)            (GthFileView              *self,
79 							  GdkModifierType           start_button_mask,
80 							  const GtkTargetEntry     *targets,
81 							  gint                      n_targets,
82 							  GdkDragAction             actions);
83 	void            (*unset_drag_source)             (GthFileView              *self);
84 	void            (*enable_drag_dest)              (GthFileView              *self,
85 							  const GtkTargetEntry     *targets,
86 							  gint                      n_targets,
87 							  GdkDragAction             actions);
88 	void            (*unset_drag_dest)               (GthFileView              *self);
89 	void            (*set_drag_dest_pos)             (GthFileView              *self,
90 							  GdkDragContext           *context,
91 							  int                       x,
92 							  int                       y,
93 							  guint                     time,
94 			                      	          int                      *pos);
95 	void            (*get_drag_dest_pos)             (GthFileView             *self,
96 							  int                     *pos);
97 
98 };
99 
100 GType           gth_file_view_get_type           (void);
101 void            gth_file_view_set_model          (GthFileView             *self,
102 					 	  GtkTreeModel            *model);
103 GtkTreeModel *  gth_file_view_get_model          (GthFileView             *self);
104 void            gth_file_view_set_caption        (GthFileView             *self,
105 						  const char              *attributes);
106 char *          gth_file_view_get_caption        (GthFileView             *self);
107 void            gth_file_view_set_thumbnail_size (GthFileView             *self,
108 						  int                      value);
109 gboolean        gth_file_view_get_thumbnail_size (GthFileView             *self);
110 void		gth_file_view_set_activate_on_single_click
111 						 (GthFileView             *self,
112 						  gboolean		   single);
113 gboolean        gth_file_view_get_activate_on_single_click
114 						 (GthFileView             *self);
115 void            gth_file_view_scroll_to          (GthFileView             *self,
116 						  int                      pos,
117 						  double                   yalign);
118 void            gth_file_view_set_vscroll        (GthFileView             *self,
119 						  double                   vscroll);
120 GthVisibility   gth_file_view_get_visibility     (GthFileView             *self,
121 						  int                      pos);
122 int             gth_file_view_get_at_position    (GthFileView             *self,
123 						  int                      x,
124 						  int                      y);
125 int             gth_file_view_get_first_visible  (GthFileView             *self);
126 int             gth_file_view_get_last_visible   (GthFileView             *self);
127 void            gth_file_view_activated          (GthFileView             *self,
128 						  int                      pos);
129 void            gth_file_view_set_cursor         (GthFileView             *self,
130 						  int                      pos);
131 int             gth_file_view_get_cursor         (GthFileView             *self);
132 void            gth_file_view_enable_drag_source (GthFileView             *self,
133 				      		  GdkModifierType          start_button_mask,
134 				      		  const GtkTargetEntry    *targets,
135 				      		  int                      n_targets,
136 				      		  GdkDragAction            actions);
137 void            gth_file_view_unset_drag_source  (GthFileView             *self);
138 void            gth_file_view_enable_drag_dest   (GthFileView             *self,
139 				      		  const GtkTargetEntry    *targets,
140 				      		  int                      n_targets,
141 				      		  GdkDragAction            actions);
142 void            gth_file_view_unset_drag_dest    (GthFileView             *self);
143 void            gth_file_view_set_drag_dest_pos  (GthFileView             *self,
144 		 			          GdkDragContext          *context,
145 			                          int                      x,
146 			                          int                      y,
147 			                          guint                    time,
148 				                  int                     *pos);
149 void            gth_file_view_get_drag_dest_pos  (GthFileView             *self,
150 						  int                     *pos);
151 
152 G_END_DECLS
153 
154 #endif /* GTH_FILE_VIEW_H */
155