]> Pileus Git - ~andy/gtk/blob - gtk/gtkiconfactory.h
gtk/gtkaccelmap.[ch] gtk/gtkfilechooser.[ch] gtk/gtkfilesel.c
[~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 #ifndef __GTK_ICON_FACTORY_H__
28 #define __GTK_ICON_FACTORY_H__
29
30 #include <gdk/gdk.h>
31 #include <gtk/gtkrc.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif /* __cplusplus */
36
37 typedef struct _GtkIconFactoryClass GtkIconFactoryClass;
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 struct _GtkIconFactory
49 {
50   GObject parent_instance;
51
52   GHashTable *icons;
53 };
54
55 struct _GtkIconFactoryClass
56 {
57   GObjectClass parent_class;
58
59   /* Padding for future expansion */
60   void (*_gtk_reserved1) (void);
61   void (*_gtk_reserved2) (void);
62   void (*_gtk_reserved3) (void);
63   void (*_gtk_reserved4) (void);
64 };
65
66 #ifdef G_OS_WIN32
67 /* Reserve old names for DLL ABI backward compatibility */
68 #define gtk_icon_source_set_filename gtk_icon_source_set_filename_utf8
69 #define gtk_icon_source_get_filename gtk_icon_source_get_filename_utf8
70 #endif
71
72 GType           gtk_icon_factory_get_type (void) G_GNUC_CONST;
73 GtkIconFactory* gtk_icon_factory_new      (void);
74 void            gtk_icon_factory_add      (GtkIconFactory *factory,
75                                            const gchar    *stock_id,
76                                            GtkIconSet     *icon_set);
77 GtkIconSet*     gtk_icon_factory_lookup   (GtkIconFactory *factory,
78                                            const gchar    *stock_id);
79
80 /* Manage the default icon factory stack */
81
82 void        gtk_icon_factory_add_default     (GtkIconFactory  *factory);
83 void        gtk_icon_factory_remove_default  (GtkIconFactory  *factory);
84 GtkIconSet* gtk_icon_factory_lookup_default  (const gchar     *stock_id);
85
86 /* Get preferred real size from registered semantic size.  Note that
87  * themes SHOULD use this size, but they aren't required to; for size
88  * requests and such, you should get the actual pixbuf from the icon
89  * set and see what size was rendered.
90  *
91  * This function is intended for people who are scaling icons,
92  * rather than for people who are displaying already-scaled icons.
93  * That is, if you are displaying an icon, you should get the
94  * size from the rendered pixbuf, not from here.
95  */
96
97 #ifndef GDK_MULTIHEAD_SAFE
98 gboolean gtk_icon_size_lookup              (GtkIconSize  size,
99                                             gint        *width,
100                                             gint        *height);
101 #endif /* GDK_MULTIHEAD_SAFE */
102 gboolean gtk_icon_size_lookup_for_settings (GtkSettings *settings,
103                                             GtkIconSize  size,
104                                             gint        *width,
105                                             gint        *height);
106
107 GtkIconSize           gtk_icon_size_register       (const gchar *name,
108                                                     gint         width,
109                                                     gint         height);
110 void                  gtk_icon_size_register_alias (const gchar *alias,
111                                                     GtkIconSize  target);
112 GtkIconSize           gtk_icon_size_from_name      (const gchar *name);
113 G_CONST_RETURN gchar* gtk_icon_size_get_name       (GtkIconSize  size);
114
115 /* Icon sets */
116
117 GType       gtk_icon_set_get_type        (void) G_GNUC_CONST;
118 GtkIconSet* gtk_icon_set_new             (void);
119 GtkIconSet* gtk_icon_set_new_from_pixbuf (GdkPixbuf       *pixbuf);
120
121 GtkIconSet* gtk_icon_set_ref             (GtkIconSet      *icon_set);
122 void        gtk_icon_set_unref           (GtkIconSet      *icon_set);
123 GtkIconSet* gtk_icon_set_copy            (GtkIconSet      *icon_set);
124
125 /* Get one of the icon variants in the set, creating the variant if
126  * necessary.
127  */
128 GdkPixbuf*  gtk_icon_set_render_icon     (GtkIconSet      *icon_set,
129                                           GtkStyle        *style,
130                                           GtkTextDirection direction,
131                                           GtkStateType     state,
132                                           GtkIconSize      size,
133                                           GtkWidget       *widget,
134                                           const char      *detail);
135
136
137 void           gtk_icon_set_add_source   (GtkIconSet          *icon_set,
138                                           const GtkIconSource *source);
139
140 void           gtk_icon_set_get_sizes    (GtkIconSet          *icon_set,
141                                           GtkIconSize        **sizes,
142                                           gint                *n_sizes);
143
144 GType          gtk_icon_source_get_type                 (void) G_GNUC_CONST;
145 GtkIconSource* gtk_icon_source_new                      (void);
146 GtkIconSource* gtk_icon_source_copy                     (const GtkIconSource *source);
147 void           gtk_icon_source_free                     (GtkIconSource       *source);
148
149 void           gtk_icon_source_set_filename             (GtkIconSource       *source,
150                                                          const gchar         *filename);
151 void           gtk_icon_source_set_icon_name            (GtkIconSource       *source,
152                                                          const gchar         *icon_name);
153 void           gtk_icon_source_set_pixbuf               (GtkIconSource       *source,
154                                                          GdkPixbuf           *pixbuf);
155
156 G_CONST_RETURN gchar* gtk_icon_source_get_filename  (const GtkIconSource *source);
157 G_CONST_RETURN gchar* gtk_icon_source_get_icon_name (const GtkIconSource *source);
158 GdkPixbuf*            gtk_icon_source_get_pixbuf    (const GtkIconSource *source);
159
160 void             gtk_icon_source_set_direction_wildcarded (GtkIconSource       *source,
161                                                            gboolean             setting);
162 void             gtk_icon_source_set_state_wildcarded     (GtkIconSource       *source,
163                                                            gboolean             setting);
164 void             gtk_icon_source_set_size_wildcarded      (GtkIconSource       *source,
165                                                            gboolean             setting);
166 gboolean         gtk_icon_source_get_size_wildcarded      (const GtkIconSource *source);
167 gboolean         gtk_icon_source_get_state_wildcarded     (const GtkIconSource *source);
168 gboolean         gtk_icon_source_get_direction_wildcarded (const GtkIconSource *source);
169 void             gtk_icon_source_set_direction            (GtkIconSource       *source,
170                                                            GtkTextDirection     direction);
171 void             gtk_icon_source_set_state                (GtkIconSource       *source,
172                                                            GtkStateType         state);
173 void             gtk_icon_source_set_size                 (GtkIconSource       *source,
174                                                            GtkIconSize          size);
175 GtkTextDirection gtk_icon_source_get_direction            (const GtkIconSource *source);
176 GtkStateType     gtk_icon_source_get_state                (const GtkIconSource *source);
177 GtkIconSize      gtk_icon_source_get_size                 (const GtkIconSource *source);
178
179
180 /* ignore this */
181 void _gtk_icon_set_invalidate_caches (void);
182 GSList* _gtk_icon_factory_list_ids (void);
183
184 #ifdef __cplusplus
185 }
186 #endif /* __cplusplus */
187
188 #endif /* __GTK_ICON_FACTORY_H__ */