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 <gtk/gtkdrawingarea.h>
45 G_BEGIN_DECLS
48 #define EEK_PREVIEW_TYPE (eek_preview_get_type())
49 #define EEK_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST( (obj), EEK_PREVIEW_TYPE, EekPreview))
50 #define EEK_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST( (klass), EEK_PREVIEW_TYPE, EekPreviewClass))
51 #define IS_EEK_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE( (obj), EEK_PREVIEW_TYPE))
52 #define IS_EEK_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE( (klass), EEK_PREVIEW_TYPE))
53 #define EEK_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS( (obj), EEK_PREVIEW_TYPE, EekPreviewClass))
55 typedef enum {
56 PREVIEW_STYLE_ICON = 0,
57 PREVIEW_STYLE_PREVIEW,
58 PREVIEW_STYLE_NAME,
59 PREVIEW_STYLE_BLURB,
60 PREVIEW_STYLE_ICON_NAME,
61 PREVIEW_STYLE_ICON_BLURB,
62 PREVIEW_STYLE_PREVIEW_NAME,
63 PREVIEW_STYLE_PREVIEW_BLURB
64 } PreviewStyle;
66 typedef enum {
67 VIEW_TYPE_LIST = 0,
68 VIEW_TYPE_GRID
69 } ViewType;
71 typedef enum {
72 PREVIEW_SIZE_TINY = 0,
73 PREVIEW_SIZE_SMALL,
74 PREVIEW_SIZE_MEDIUM,
75 PREVIEW_SIZE_BIG,
76 PREVIEW_SIZE_BIGGER,
77 PREVIEW_SIZE_HUGE
78 } PreviewSize;
80 typedef enum {
81 PREVIEW_LINK_NONE = 0,
82 PREVIEW_LINK_IN = 1,
83 PREVIEW_LINK_OUT = 2,
84 PREVIEW_LINK_OTHER = 4,
85 PREVIEW_LINK_ALL = 7
86 } LinkType;
88 typedef struct _EekPreview EekPreview;
89 typedef struct _EekPreviewClass EekPreviewClass;
92 struct _EekPreview
93 {
94 GtkDrawingArea drawing;
96 int _r;
97 int _g;
98 int _b;
100 gboolean _hot;
101 gboolean _within;
102 gboolean _takesFocus;
103 gboolean _isRemove;
105 PreviewStyle _prevstyle;
106 ViewType _view;
107 PreviewSize _size;
108 guint _ratio;
109 guint _linked;
110 };
112 struct _EekPreviewClass
113 {
114 GtkDrawingAreaClass parent_class;
116 void (*clicked) (EekPreview* splat);
117 };
120 GType eek_preview_get_type(void) G_GNUC_CONST;
121 GtkWidget* eek_preview_new(void);
123 void eek_preview_set_details( EekPreview* splat, PreviewStyle prevstyle, ViewType view, PreviewSize size, guint ratio );
124 void eek_preview_set_color( EekPreview* splat, int r, int g, int b );
126 void eek_preview_set_linked( EekPreview* splat, LinkType link );
127 LinkType eek_preview_get_linked( EekPreview* splat );
129 gboolean eek_preview_get_focus_on_click( EekPreview* preview );
130 void eek_preview_set_focus_on_click( EekPreview* preview, gboolean focus_on_click );
132 void eek_preview_set_size_mappings( guint count, GtkIconSize const* sizes );
134 G_END_DECLS
136 #endif /* SEEN_EEK_PREVIEW_H */
138 /*
139 Local Variables:
140 mode:c++
141 c-file-style:"stroustrup"
142 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
143 indent-tabs-mode:nil
144 fill-column:99
145 End:
146 */
147 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :