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