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