1 #ifndef SEEN_EEK_PREVIEW_H
2 #define SEEN_EEK_PREVIEW_H
3 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
4 *
5 */
6 /* ***** BEGIN LICENSE BLOCK *****
7 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
8 *
9 * The contents of this file are subject to the Mozilla Public License Version
10 * 1.1 (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 * http://www.mozilla.org/MPL/
13 *
14 * Software distributed under the License is distributed on an "AS IS" basis,
15 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
16 * for the specific language governing rights and limitations under the
17 * License.
18 *
19 * The Original Code is Eek Preview Stuffs.
20 *
21 * The Initial Developer of the Original Code is
22 * Jon A. Cruz.
23 * Portions created by the Initial Developer are Copyright (C) 2005-2008
24 * the Initial Developer. All Rights Reserved.
25 *
26 * Contributor(s):
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * either the GNU General Public License Version 2 or later (the "GPL"), or
30 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
39 *
40 * ***** END LICENSE BLOCK ***** */
42 #include <gtk/gtkdrawingarea.h>
44 G_BEGIN_DECLS
47 #define EEK_PREVIEW_TYPE (eek_preview_get_type())
48 #define EEK_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST( (obj), EEK_PREVIEW_TYPE, EekPreview))
49 #define EEK_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST( (klass), EEK_PREVIEW_TYPE, EekPreviewClass))
50 #define IS_EEK_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE( (obj), EEK_PREVIEW_TYPE))
51 #define IS_EEK_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE( (klass), EEK_PREVIEW_TYPE))
52 #define EEK_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS( (obj), EEK_PREVIEW_TYPE, EekPreviewClass))
54 typedef enum {
55 PREVIEW_STYLE_ICON = 0,
56 PREVIEW_STYLE_PREVIEW,
57 PREVIEW_STYLE_NAME,
58 PREVIEW_STYLE_BLURB,
59 PREVIEW_STYLE_ICON_NAME,
60 PREVIEW_STYLE_ICON_BLURB,
61 PREVIEW_STYLE_PREVIEW_NAME,
62 PREVIEW_STYLE_PREVIEW_BLURB
63 } PreviewStyle;
65 typedef enum {
66 VIEW_TYPE_LIST = 0,
67 VIEW_TYPE_GRID
68 } ViewType;
70 typedef enum {
71 PREVIEW_SIZE_TINY = 0,
72 PREVIEW_SIZE_SMALL,
73 PREVIEW_SIZE_MEDIUM,
74 PREVIEW_SIZE_BIG,
75 PREVIEW_SIZE_BIGGER,
76 PREVIEW_SIZE_HUGE
77 } PreviewSize;
79 typedef enum {
80 PREVIEW_LINK_NONE = 0,
81 PREVIEW_LINK_IN = 1,
82 PREVIEW_LINK_OUT = 2,
83 PREVIEW_LINK_OTHER = 4,
84 PREVIEW_LINK_ALL = 7
85 } LinkType;
87 typedef struct _EekPreview EekPreview;
88 typedef struct _EekPreviewClass EekPreviewClass;
91 struct _EekPreview
92 {
93 GtkDrawingArea drawing;
95 int _r;
96 int _g;
97 int _b;
99 gboolean _hot;
100 gboolean _within;
101 gboolean _takesFocus;
103 PreviewStyle _prevstyle;
104 ViewType _view;
105 PreviewSize _size;
106 guint _ratio;
107 guint _linked;
108 };
110 struct _EekPreviewClass
111 {
112 GtkDrawingAreaClass parent_class;
114 void (*clicked) (EekPreview* splat);
115 };
118 GType eek_preview_get_type(void) G_GNUC_CONST;
119 GtkWidget* eek_preview_new(void);
121 void eek_preview_set_details( EekPreview* splat, PreviewStyle prevstyle, ViewType view, PreviewSize size, guint ratio );
122 void eek_preview_set_color( EekPreview* splat, int r, int g, int b );
124 void eek_preview_set_linked( EekPreview* splat, LinkType link );
125 LinkType eek_preview_get_linked( EekPreview* splat );
127 gboolean eek_preview_get_focus_on_click( EekPreview* preview );
128 void eek_preview_set_focus_on_click( EekPreview* preview, gboolean focus_on_click );
130 void eek_preview_set_size_mappings( guint count, GtkIconSize const* sizes );
132 G_END_DECLS
135 #endif /* SEEN_EEK_PREVIEW_H */