1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 
3 /* fm-icon-view.h - interface for icon view of directory.
4 
5    Copyright (C) 2000 Eazel, Inc.
6 
7    The Mate Library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Library General Public License as
9    published by the Free Software Foundation; either version 2 of the
10    License, or (at your option) any later version.
11 
12    The Mate Library 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 GNU
15    Library General Public License for more details.
16 
17    You should have received a copy of the GNU Library General Public
18    License along with the Mate Library; see the file COPYING.LIB.  If not,
19    write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20    Boston, MA 02110-1301, USA.
21 
22    Authors: John Sullivan <sullivan@eazel.com>
23 */
24 
25 #ifndef FM_ICON_VIEW_H
26 #define FM_ICON_VIEW_H
27 
28 #include "fm-directory-view.h"
29 
30 typedef struct FMIconView FMIconView;
31 typedef struct FMIconViewClass FMIconViewClass;
32 
33 #define FM_TYPE_ICON_VIEW fm_icon_view_get_type()
34 #define FM_ICON_VIEW(obj) \
35   (G_TYPE_CHECK_INSTANCE_CAST ((obj), FM_TYPE_ICON_VIEW, FMIconView))
36 #define FM_ICON_VIEW_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST ((klass), FM_TYPE_ICON_VIEW, FMIconViewClass))
38 #define FM_IS_ICON_VIEW(obj) \
39   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FM_TYPE_ICON_VIEW))
40 #define FM_IS_ICON_VIEW_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_TYPE ((klass), FM_TYPE_ICON_VIEW))
42 #define FM_ICON_VIEW_GET_CLASS(obj) \
43   (G_TYPE_INSTANCE_GET_CLASS ((obj), FM_TYPE_ICON_VIEW, FMIconViewClass))
44 
45 #define FM_ICON_VIEW_ID "OAFIID:Caja_File_Manager_Icon_View"
46 #define FM_COMPACT_VIEW_ID "OAFIID:Caja_File_Manager_Compact_View"
47 
48 typedef struct FMIconViewDetails FMIconViewDetails;
49 
50 struct FMIconView
51 {
52     FMDirectoryView parent;
53     FMIconViewDetails *details;
54 };
55 
56 struct FMIconViewClass
57 {
58     FMDirectoryViewClass parent_class;
59 
60     /* Methods that can be overriden for settings you don't want to come from metadata.
61      */
62 
63     /* Note: get_directory_sort_by must return a string that can/will be g_freed.
64      */
65     char *	 (* get_directory_sort_by)       (FMIconView *icon_view,
66             CajaFile *file);
67     void     (* set_directory_sort_by)       (FMIconView *icon_view,
68             CajaFile *file,
69             const char* sort_by);
70 
71     gboolean (* get_directory_sort_reversed) (FMIconView *icon_view,
72             CajaFile *file);
73     void     (* set_directory_sort_reversed) (FMIconView *icon_view,
74             CajaFile *file,
75             gboolean sort_reversed);
76 
77     gboolean (* get_directory_auto_layout)   (FMIconView *icon_view,
78             CajaFile *file);
79     void     (* set_directory_auto_layout)   (FMIconView *icon_view,
80             CajaFile *file,
81             gboolean auto_layout);
82 
83     gboolean (* get_directory_tighter_layout) (FMIconView *icon_view,
84             CajaFile *file);
85     void     (* set_directory_tighter_layout)   (FMIconView *icon_view,
86             CajaFile *file,
87             gboolean tighter_layout);
88 
89     /* Override "clean_up" if your subclass has its own notion of where icons should be positioned */
90     void	 (* clean_up)			 (FMIconView *icon_view);
91 
92     /* supports_auto_layout is a function pointer that subclasses may
93      * override to control whether or not the automatic layout options
94      * should be enabled. The default implementation returns TRUE.
95      */
96     gboolean (* supports_auto_layout)	 (FMIconView *view);
97 
98     /* supports_manual_layout is a function pointer that subclasses may
99      * override to control whether or not the manual layout options
100      * should be enabled. The default implementation returns TRUE iff
101      * not in compact mode.
102      */
103     gboolean (* supports_manual_layout)	 (FMIconView *view);
104 
105     /* supports_scaling is a function pointer that subclasses may
106      * override to control whether or not the manual layout supports
107      * scaling. The default implementation returns FALSE
108      */
109     gboolean (* supports_scaling)	 (FMIconView *view);
110 
111     /* supports_auto_layout is a function pointer that subclasses may
112      * override to control whether snap-to-grid mode
113      * should be enabled. The default implementation returns FALSE.
114      */
115     gboolean (* supports_keep_aligned)	 (FMIconView *view);
116 
117     /* supports_auto_layout is a function pointer that subclasses may
118      * override to control whether snap-to-grid mode
119      * should be enabled. The default implementation returns FALSE.
120      */
121     gboolean (* supports_labels_beside_icons)	 (FMIconView *view);
122 };
123 
124 /* GObject support */
125 GType   fm_icon_view_get_type      (void);
126 int     fm_icon_view_compare_files (FMIconView   *icon_view,
127                                     CajaFile *a,
128                                     CajaFile *b);
129 void    fm_icon_view_filter_by_screen (FMIconView *icon_view, gboolean filter);
130 gboolean fm_icon_view_is_compact   (FMIconView *icon_view);
131 
132 void    fm_icon_view_register       (void);
133 void    fm_compact_view_register    (void);
134 
135 #endif /* FM_ICON_VIEW_H */
136