1 /** @file
2 * @brief EEK preview stuff
3 */
4 /* ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 *
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
11 *
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
16 *
17 * The Original Code is Eek Preview Stuffs.
18 *
19 * The Initial Developer of the Original Code is
20 * Jon A. Cruz.
21 * Portions created by the Initial Developer are Copyright (C) 2005-2008
22 * the Initial Developer. All Rights Reserved.
23 *
24 * Contributor(s):
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
40 #ifndef SEEN_EEK_PREVIEW_H
41 #define SEEN_EEK_PREVIEW_H
43 #include <gdk/gdkpixbuf.h>
44 #include <gtk/gtkdrawingarea.h>
46 G_BEGIN_DECLS
49 #define EEK_PREVIEW_TYPE (eek_preview_get_type())
50 #define EEK_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST( (obj), EEK_PREVIEW_TYPE, EekPreview))
51 #define EEK_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST( (klass), EEK_PREVIEW_TYPE, EekPreviewClass))
52 #define IS_EEK_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE( (obj), EEK_PREVIEW_TYPE))
53 #define IS_EEK_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE( (klass), EEK_PREVIEW_TYPE))
54 #define EEK_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS( (obj), EEK_PREVIEW_TYPE, EekPreviewClass))
56 typedef enum {
57 PREVIEW_STYLE_ICON = 0,
58 PREVIEW_STYLE_PREVIEW,
59 PREVIEW_STYLE_NAME,
60 PREVIEW_STYLE_BLURB,
61 PREVIEW_STYLE_ICON_NAME,
62 PREVIEW_STYLE_ICON_BLURB,
63 PREVIEW_STYLE_PREVIEW_NAME,
64 PREVIEW_STYLE_PREVIEW_BLURB
65 } PreviewStyle;
67 typedef enum {
68 VIEW_TYPE_LIST = 0,
69 VIEW_TYPE_GRID
70 } ViewType;
72 typedef enum {
73 PREVIEW_SIZE_TINY = 0,
74 PREVIEW_SIZE_SMALL,
75 PREVIEW_SIZE_MEDIUM,
76 PREVIEW_SIZE_BIG,
77 PREVIEW_SIZE_BIGGER,
78 PREVIEW_SIZE_HUGE
79 } PreviewSize;
81 typedef enum {
82 PREVIEW_LINK_NONE = 0,
83 PREVIEW_LINK_IN = 1,
84 PREVIEW_LINK_OUT = 2,
85 PREVIEW_LINK_OTHER = 4,
86 PREVIEW_LINK_ALL = 7
87 } LinkType;
89 typedef struct _EekPreview EekPreview;
90 typedef struct _EekPreviewClass EekPreviewClass;
93 struct _EekPreview
94 {
95 GtkDrawingArea drawing;
97 int _r;
98 int _g;
99 int _b;
100 int _scaledW;
101 int _scaledH;
103 gboolean _hot;
104 gboolean _within;
105 gboolean _takesFocus;
107 PreviewStyle _prevstyle;
108 ViewType _view;
109 PreviewSize _size;
110 guint _ratio;
111 guint _linked;
112 GdkPixbuf* _previewPixbuf;
113 GdkPixbuf* _scaled;
114 };
116 struct _EekPreviewClass
117 {
118 GtkDrawingAreaClass parent_class;
120 void (*clicked) (EekPreview* splat);
121 };
124 GType eek_preview_get_type(void) G_GNUC_CONST;
125 GtkWidget* eek_preview_new(void);
127 void eek_preview_set_details( EekPreview* splat, PreviewStyle prevstyle, ViewType view, PreviewSize size, guint ratio );
128 void eek_preview_set_color( EekPreview* splat, int r, int g, int b );
129 void eek_preview_set_pixbuf( EekPreview* splat, GdkPixbuf* pixbuf );
131 void eek_preview_set_linked( EekPreview* splat, LinkType link );
132 LinkType eek_preview_get_linked( EekPreview* splat );
134 gboolean eek_preview_get_focus_on_click( EekPreview* preview );
135 void eek_preview_set_focus_on_click( EekPreview* preview, gboolean focus_on_click );
137 void eek_preview_set_size_mappings( guint count, GtkIconSize const* sizes );
139 G_END_DECLS
141 #endif /* SEEN_EEK_PREVIEW_H */
143 /*
144 Local Variables:
145 mode:c++
146 c-file-style:"stroustrup"
147 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
148 indent-tabs-mode:nil
149 fill-column:99
150 End:
151 */
152 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :