]> Pileus Git - ~andy/gtk/blob - gtk/gtkiconfactory.h
Mark as const.
[~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 GType           gtk_icon_factory_get_type (void) G_GNUC_CONST;
67 GtkIconFactory* gtk_icon_factory_new      (void);
68 void            gtk_icon_factory_add      (GtkIconFactory *factory,
69                                            const gchar    *stock_id,
70                                            GtkIconSet     *icon_set);
71 GtkIconSet*     gtk_icon_factory_lookup   (GtkIconFactory *factory,
72                                            const gchar    *stock_id);
73
74 /* Manage the default icon factory stack */
75
76 void        gtk_icon_factory_add_default     (GtkIconFactory  *factory);
77 void        gtk_icon_factory_remove_default  (GtkIconFactory  *factory);
78 GtkIconSet* gtk_icon_factory_lookup_default  (const gchar     *stock_id);
79
80 /* Get preferred real size from registered semantic size.  Note that
81  * themes SHOULD use this size, but they aren't required to; for size
82  * requests and such, you should get the actual pixbuf from the icon
83  * set and see what size was rendered.
84  *
85  * This function is intended for people who are scaling icons,
86  * rather than for people who are displaying already-scaled icons.
87  * That is, if you are displaying an icon, you should get the
88  * size from the rendered pixbuf, not from here.
89  */
90
91 #ifndef GDK_MULTIHEAD_SAFE
92 gboolean gtk_icon_size_lookup              (GtkIconSize  size,
93                                             gint        *width,
94                                             gint        *height);
95 #endif /* GDK_MULTIHEAD_SAFE */
96 gboolean gtk_icon_size_lookup_for_settings (GtkSettings *settings,
97                                             GtkIconSize  size,
98                                             gint        *width,
99                                             gint        *height);
100
101 GtkIconSize           gtk_icon_size_register       (const gchar *name,
102                                                     gint         width,
103                                                     gint         height);
104 void                  gtk_icon_size_register_alias (const gchar *alias,
105                                                     GtkIconSize  target);
106 GtkIconSize           gtk_icon_size_from_name      (const gchar *name);
107 G_CONST_RETURN gchar* gtk_icon_size_get_name       (GtkIconSize  size);
108
109 /* Icon sets */
110
111 GType       gtk_icon_set_get_type        (void) G_GNUC_CONST;
112 GtkIconSet* gtk_icon_set_new             (void);
113 GtkIconSet* gtk_icon_set_new_from_pixbuf (GdkPixbuf       *pixbuf);
114
115 GtkIconSet* gtk_icon_set_ref             (GtkIconSet      *icon_set);
116 void        gtk_icon_set_unref           (GtkIconSet      *icon_set);
117 GtkIconSet* gtk_icon_set_copy            (GtkIconSet      *icon_set);
118
119 /* Get one of the icon variants in the set, creating the variant if
120  * necessary.
121  */
122 GdkPixbuf*  gtk_icon_set_render_icon     (GtkIconSet      *icon_set,
123                                           GtkStyle        *style,
124                                           GtkTextDirection direction,
125                                           GtkStateType     state,
126                                           GtkIconSize      size,
127                                           GtkWidget       *widget,
128                                           const char      *detail);
129
130
131 void           gtk_icon_set_add_source   (GtkIconSet          *icon_set,
132                                           const GtkIconSource *source);
133
134 void           gtk_icon_set_get_sizes    (GtkIconSet          *icon_set,
135                                           GtkIconSize        **sizes,
136                                           gint                *n_sizes);
137
138 GType          gtk_icon_source_get_type                 (void) G_GNUC_CONST;
139 GtkIconSource* gtk_icon_source_new                      (void);
140 GtkIconSource* gtk_icon_source_copy                     (const GtkIconSource *source);
141 void           gtk_icon_source_free                     (GtkIconSource       *source);
142
143 void           gtk_icon_source_set_filename             (GtkIconSource       *source,
144                                                          const gchar         *filename);
145 void           gtk_icon_source_set_icon_name            (GtkIconSource       *source,
146                                                          const gchar         *icon_name);
147 void           gtk_icon_source_set_pixbuf               (GtkIconSource       *source,
148                                                          GdkPixbuf           *pixbuf);
149
150 G_CONST_RETURN gchar* gtk_icon_source_get_filename  (const GtkIconSource *source);
151 G_CONST_RETURN gchar* gtk_icon_source_get_icon_name (const GtkIconSource *source);
152 GdkPixbuf*            gtk_icon_source_get_pixbuf    (const GtkIconSource *source);
153
154 void             gtk_icon_source_set_direction_wildcarded (GtkIconSource       *source,
155                                                            gboolean             setting);
156 void             gtk_icon_source_set_state_wildcarded     (GtkIconSource       *source,
157                                                            gboolean             setting);
158 void             gtk_icon_source_set_size_wildcarded      (GtkIconSource       *source,
159                                                            gboolean             setting);
160 gboolean         gtk_icon_source_get_size_wildcarded      (const GtkIconSource *source);
161 gboolean         gtk_icon_source_get_state_wildcarded     (const GtkIconSource *source);
162 gboolean         gtk_icon_source_get_direction_wildcarded (const GtkIconSource *source);
163 void             gtk_icon_source_set_direction            (GtkIconSource       *source,
164                                                            GtkTextDirection     direction);
165 void             gtk_icon_source_set_state                (GtkIconSource       *source,
166                                                            GtkStateType         state);
167 void             gtk_icon_source_set_size                 (GtkIconSource       *source,
168                                                            GtkIconSize          size);
169 GtkTextDirection gtk_icon_source_get_direction            (const GtkIconSource *source);
170 GtkStateType     gtk_icon_source_get_state                (const GtkIconSource *source);
171 GtkIconSize      gtk_icon_source_get_size                 (const GtkIconSource *source);
172
173
174 /* ignore this */
175 void _gtk_icon_set_invalidate_caches (void);
176 GSList* _gtk_icon_factory_list_ids (void);
177
178 #ifdef __cplusplus
179 }
180 #endif /* __cplusplus */
181
182 #endif /* __GTK_ICON_FACTORY_H__ */