Code

Use subdirectories with icon sizes.
[inkscape.git] / src / widgets / eek-preview.h
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_FILL = 8,
87   PREVIEW_STROKE = 16,
88   PREVIEW_LINK_ALL = 31
89 } LinkType;
91 typedef struct _EekPreview       EekPreview;
92 typedef struct _EekPreviewClass  EekPreviewClass;
95 struct _EekPreview
96 {
97     GtkDrawingArea drawing;
99     int _r;
100     int _g;
101     int _b;
102     int _scaledW;
103     int _scaledH;
105     gboolean _hot;
106     gboolean _within;
107     gboolean _takesFocus;
109     PreviewStyle _prevstyle;
110     ViewType _view;
111     PreviewSize _size;
112     guint _ratio;
113     guint _linked;
114     GdkPixbuf* _previewPixbuf;
115     GdkPixbuf* _scaled;
116 };
118 struct _EekPreviewClass
120     GtkDrawingAreaClass parent_class;
122     void (*clicked) (EekPreview* splat);
123 };
126 GType      eek_preview_get_type(void) G_GNUC_CONST;
127 GtkWidget* eek_preview_new(void);
129 void eek_preview_set_details( EekPreview* splat, PreviewStyle prevstyle, ViewType view, PreviewSize size, guint ratio );
130 void eek_preview_set_color( EekPreview* splat, int r, int g, int b );
131 void eek_preview_set_pixbuf( EekPreview* splat, GdkPixbuf* pixbuf );
133 void eek_preview_set_linked( EekPreview* splat, LinkType link );
134 LinkType eek_preview_get_linked( EekPreview* splat );
136 gboolean eek_preview_get_focus_on_click( EekPreview* preview );
137 void eek_preview_set_focus_on_click( EekPreview* preview, gboolean focus_on_click );
139 void eek_preview_set_size_mappings( guint count, GtkIconSize const* sizes );
141 G_END_DECLS
143 #endif /* SEEN_EEK_PREVIEW_H */
145 /*
146   Local Variables:
147   mode:c++
148   c-file-style:"stroustrup"
149   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
150   indent-tabs-mode:nil
151   fill-column:99
152   End:
153 */
154 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :