]> Pileus Git - ~andy/gtk/blob - gtk/gtkiconfactory.h
225cb920dfb744843fb883da99be74d5f17ef382
[~andy/gtk] / gtk / gtkiconfactory.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2000 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25  */
26
27 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
29 #endif
30
31 #ifndef __GTK_ICON_FACTORY_H__
32 #define __GTK_ICON_FACTORY_H__
33
34 #include <gdk/gdk.h>
35 #include <gtk/gtksettings.h>
36 #include <gtk/gtkenums.h>
37 #include <gtk/gtkwidgetpath.h>
38
39 G_BEGIN_DECLS
40
41
42 #define GTK_TYPE_ICON_FACTORY              (gtk_icon_factory_get_type ())
43 #define GTK_ICON_FACTORY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_ICON_FACTORY, GtkIconFactory))
44 #define GTK_ICON_FACTORY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_FACTORY, GtkIconFactoryClass))
45 #define GTK_IS_ICON_FACTORY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_ICON_FACTORY))
46 #define GTK_IS_ICON_FACTORY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_FACTORY))
47 #define GTK_ICON_FACTORY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_FACTORY, GtkIconFactoryClass))
48 #define GTK_TYPE_ICON_SET                  (gtk_icon_set_get_type ())
49 #define GTK_TYPE_ICON_SOURCE               (gtk_icon_source_get_type ())
50
51 typedef struct _GtkIconFactory              GtkIconFactory;
52 typedef struct _GtkIconFactoryPrivate       GtkIconFactoryPrivate;
53 typedef struct _GtkIconFactoryClass         GtkIconFactoryClass;
54
55 typedef struct _GtkIconSet     GtkIconSet;
56 typedef struct _GtkIconSource  GtkIconSource;
57
58 typedef struct _GtkStyle               GtkStyle;
59 typedef struct _GtkRcStyle             GtkRcStyle;
60
61 struct _GtkIconFactory
62 {
63   GObject parent_instance;
64
65   /*< private >*/
66   GtkIconFactoryPrivate *priv;
67 };
68
69 struct _GtkIconFactoryClass
70 {
71   GObjectClass parent_class;
72
73   /* Padding for future expansion */
74   void (*_gtk_reserved1) (void);
75   void (*_gtk_reserved2) (void);
76   void (*_gtk_reserved3) (void);
77   void (*_gtk_reserved4) (void);
78 };
79
80 GType           gtk_icon_factory_get_type (void) G_GNUC_CONST;
81 GtkIconFactory* gtk_icon_factory_new      (void);
82 void            gtk_icon_factory_add      (GtkIconFactory *factory,
83                                            const gchar    *stock_id,
84                                            GtkIconSet     *icon_set);
85 GtkIconSet*     gtk_icon_factory_lookup   (GtkIconFactory *factory,
86                                            const gchar    *stock_id);
87
88 /* Manage the default icon factory stack */
89
90 void        gtk_icon_factory_add_default     (GtkIconFactory  *factory);
91 void        gtk_icon_factory_remove_default  (GtkIconFactory  *factory);
92 GtkIconSet* gtk_icon_factory_lookup_default  (const gchar     *stock_id);
93
94 /* Get preferred real size from registered semantic size.  Note that
95  * themes SHOULD use this size, but they aren't required to; for size
96  * requests and such, you should get the actual pixbuf from the icon
97  * set and see what size was rendered.
98  *
99  * This function is intended for people who are scaling icons,
100  * rather than for people who are displaying already-scaled icons.
101  * That is, if you are displaying an icon, you should get the
102  * size from the rendered pixbuf, not from here.
103  */
104
105 #ifndef GDK_MULTIHEAD_SAFE
106 gboolean gtk_icon_size_lookup              (GtkIconSize  size,
107                                             gint        *width,
108                                             gint        *height);
109 #endif /* GDK_MULTIHEAD_SAFE */
110 gboolean gtk_icon_size_lookup_for_settings (GtkSettings *settings,
111                                             GtkIconSize  size,
112                                             gint        *width,
113                                             gint        *height);
114
115 GtkIconSize           gtk_icon_size_register       (const gchar *name,
116                                                     gint         width,
117                                                     gint         height);
118 void                  gtk_icon_size_register_alias (const gchar *alias,
119                                                     GtkIconSize  target);
120 GtkIconSize           gtk_icon_size_from_name      (const gchar *name);
121 const gchar*          gtk_icon_size_get_name       (GtkIconSize  size);
122
123 /* Icon sets */
124
125 GType       gtk_icon_set_get_type        (void) G_GNUC_CONST;
126 GtkIconSet* gtk_icon_set_new             (void);
127 GtkIconSet* gtk_icon_set_new_from_pixbuf (GdkPixbuf       *pixbuf);
128
129 GtkIconSet* gtk_icon_set_ref             (GtkIconSet      *icon_set);
130 void        gtk_icon_set_unref           (GtkIconSet      *icon_set);
131 GtkIconSet* gtk_icon_set_copy            (GtkIconSet      *icon_set);
132
133 GDK_DEPRECATED_IN_3_0_FOR(gtk_icon_set_render_icon_pixbuf)
134 GdkPixbuf*  gtk_icon_set_render_icon     (GtkIconSet      *icon_set,
135                                           GtkStyle        *style,
136                                           GtkTextDirection direction,
137                                           GtkStateType     state,
138                                           GtkIconSize      size,
139                                           GtkWidget       *widget,
140                                           const gchar     *detail);
141
142 void           gtk_icon_set_add_source   (GtkIconSet          *icon_set,
143                                           const GtkIconSource *source);
144
145 void           gtk_icon_set_get_sizes    (GtkIconSet          *icon_set,
146                                           GtkIconSize        **sizes,
147                                           gint                *n_sizes);
148
149 GType          gtk_icon_source_get_type                 (void) G_GNUC_CONST;
150 GtkIconSource* gtk_icon_source_new                      (void);
151 GtkIconSource* gtk_icon_source_copy                     (const GtkIconSource *source);
152 void           gtk_icon_source_free                     (GtkIconSource       *source);
153
154 void           gtk_icon_source_set_filename             (GtkIconSource       *source,
155                                                          const gchar         *filename);
156 void           gtk_icon_source_set_icon_name            (GtkIconSource       *source,
157                                                          const gchar         *icon_name);
158 void           gtk_icon_source_set_pixbuf               (GtkIconSource       *source,
159                                                          GdkPixbuf           *pixbuf);
160
161 const gchar *    gtk_icon_source_get_filename             (const GtkIconSource *source);
162 const gchar *    gtk_icon_source_get_icon_name            (const GtkIconSource *source);
163 GdkPixbuf*       gtk_icon_source_get_pixbuf               (const GtkIconSource *source);
164
165 void             gtk_icon_source_set_direction_wildcarded (GtkIconSource       *source,
166                                                            gboolean             setting);
167 void             gtk_icon_source_set_state_wildcarded     (GtkIconSource       *source,
168                                                            gboolean             setting);
169 void             gtk_icon_source_set_size_wildcarded      (GtkIconSource       *source,
170                                                            gboolean             setting);
171 gboolean         gtk_icon_source_get_size_wildcarded      (const GtkIconSource *source);
172 gboolean         gtk_icon_source_get_state_wildcarded     (const GtkIconSource *source);
173 gboolean         gtk_icon_source_get_direction_wildcarded (const GtkIconSource *source);
174 void             gtk_icon_source_set_direction            (GtkIconSource       *source,
175                                                            GtkTextDirection     direction);
176 void             gtk_icon_source_set_state                (GtkIconSource       *source,
177                                                            GtkStateType         state);
178 void             gtk_icon_source_set_size                 (GtkIconSource       *source,
179                                                            GtkIconSize          size);
180 GtkTextDirection gtk_icon_source_get_direction            (const GtkIconSource *source);
181 GtkStateType     gtk_icon_source_get_state                (const GtkIconSource *source);
182 GtkIconSize      gtk_icon_source_get_size                 (const GtkIconSource *source);
183
184
185 /* ignore this */
186 void _gtk_icon_set_invalidate_caches (void);
187 GList* _gtk_icon_factory_list_ids (void);
188 void _gtk_icon_factory_ensure_default_icons (void);
189
190 G_END_DECLS
191
192 #endif /* __GTK_ICON_FACTORY_H__ */