File: GtkIconFactory.xs

package info (click to toggle)
libgtk2-perl 2%3A1.2499-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,668 kB
  • ctags: 594
  • sloc: perl: 22,100; ansic: 122; makefile: 17
file content (338 lines) | stat: -rw-r--r-- 9,977 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
/*
 * Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
 * Boston, MA  02111-1307  USA.
 *
 * $Id$
 */
#include "gtk2perl.h"

/*
 * Programs and libraries can register their own GtkIconSizes, making the
 * standard enum handling rather incorrect.  so, we override that stuff
 * here.  FIXME if this stuff is ever needed outside this file, we'll have
 * to undef and prototype in gtk2perl.h, instead.
 */
#undef newSVGtkIconSize
#undef SvGtkIconSize

static SV *
newSVGtkIconSize (GtkIconSize size)
{
	/* crap.  there is no try.  do, or do not. */
	/* SV * sv = gperl_try_convert_back_enum (GTK_TYPE_ICON_SIZE, size); */
	SV * sv = gperl_convert_back_enum_pass_unknown (GTK_TYPE_ICON_SIZE,
							size);
	if (looks_like_number (sv)) {
		/* fall back... */
		const char * name;
		name = gtk_icon_size_get_name (size);
		if (name)
			sv_setpv (sv, name);
	}
	return sv;
}

static GtkIconSize
SvGtkIconSize (SV * sv)
{
	GtkIconSize size;
	if (gperl_try_convert_enum (GTK_TYPE_ICON_SIZE, sv, (gint*)&size))
		return size;
	/* fall back... */
	return gtk_icon_size_from_name (SvPV_nolen (sv));
}


MODULE = Gtk2::IconFactory	PACKAGE = Gtk2::IconFactory	PREFIX = gtk_icon_factory_

##  GtkIconFactory* gtk_icon_factory_new (void) 
GtkIconFactory_noinc *
gtk_icon_factory_new (class)
    C_ARGS:
	/*void*/

##  void gtk_icon_factory_add (GtkIconFactory *factory, const gchar *stock_id, GtkIconSet *icon_set) 
void
gtk_icon_factory_add (factory, stock_id, icon_set)
	GtkIconFactory *factory
	const gchar *stock_id
	GtkIconSet *icon_set

##  GtkIconSet* gtk_icon_factory_lookup (GtkIconFactory *factory, const gchar *stock_id) 
GtkIconSet*
gtk_icon_factory_lookup (factory, stock_id)
	GtkIconFactory *factory
	const gchar *stock_id

##  void gtk_icon_factory_add_default (GtkIconFactory *factory) 
void
gtk_icon_factory_add_default (factory)
	GtkIconFactory *factory

##  void gtk_icon_factory_remove_default (GtkIconFactory *factory) 
void
gtk_icon_factory_remove_default (factory)
	GtkIconFactory *factory

# apps should generally use themes for this, but the stock browser needs it
##  GtkIconSet* gtk_icon_factory_lookup_default (const gchar *stock_id) 
GtkIconSet*
gtk_icon_factory_lookup_default (class, stock_id)
	const gchar *stock_id
    CODE:
	RETVAL = gtk_icon_factory_lookup_default (stock_id);
	if (!RETVAL)
		XSRETURN_UNDEF;
    OUTPUT:
	RETVAL

MODULE = Gtk2::IconFactory	PACKAGE = Gtk2::IconSize	PREFIX = gtk_icon_size_

##  gboolean gtk_icon_size_lookup (GtkIconSize size, gint *width, gint *height) 
=for apidoc
=for signature (width, height) = Gtk2::IconSize->lookup ($size)
=cut
void
gtk_icon_size_lookup (class, size)
	GtkIconSize size
    PREINIT:
	gint width;
	gint height;
    PPCODE:
	if (!gtk_icon_size_lookup (size, &width, &height))
		XSRETURN_EMPTY;
	EXTEND (SP, 2);
	PUSHs (sv_2mortal (newSViv (width)));
	PUSHs (sv_2mortal (newSViv (height)));

#if GTK_CHECK_VERSION(2,2,0)

##  gboolean gtk_icon_size_lookup_for_settings (GtkSettings *settings, GtkIconSize size, gint *width, gint *height) 
=for apidoc
=for signature (width, height) = Gtk2::IconSize->lookup_for_settings ($settings, $size)
=cut
void
gtk_icon_size_lookup_for_settings (class, settings, size)
	GtkSettings *settings
	GtkIconSize size
    PREINIT:
	gint width;
	gint height;
    PPCODE:
	if (!gtk_icon_size_lookup_for_settings (settings, size, &width, &height))
		XSRETURN_EMPTY;
	EXTEND (SP, 2);
	PUSHs (sv_2mortal (newSViv (width)));
	PUSHs (sv_2mortal (newSViv (height)));

#endif /* >= 2.2.0 */

##  GtkIconSize gtk_icon_size_register (const gchar *name, gint width, gint height) 
GtkIconSize
gtk_icon_size_register (class, name, width, height)
	const gchar *name
	gint width
	gint height
    C_ARGS:
	name, width, height

##  void gtk_icon_size_register_alias (const gchar *alias, GtkIconSize target) 
void
gtk_icon_size_register_alias (class, alias, target)
	const gchar *alias
	GtkIconSize target
    C_ARGS:
	alias, target

##  GtkIconSize gtk_icon_size_from_name (const gchar *name) 
GtkIconSize
gtk_icon_size_from_name (class, name)
	const gchar *name
    C_ARGS:
	name

##  const gchar * gtk_icon_size_get_name (GtkIconSize size) 

MODULE = Gtk2::IconFactory	PACKAGE = Gtk2::IconSet	PREFIX = gtk_icon_set_

##  GtkIconSet* gtk_icon_set_new (void) 
GtkIconSet_own*
gtk_icon_set_new (class)
    C_ARGS:
	/*void*/

##  GtkIconSet* gtk_icon_set_new_from_pixbuf (GdkPixbuf *pixbuf) 
GtkIconSet_own*
gtk_icon_set_new_from_pixbuf (class, pixbuf)
	GdkPixbuf *pixbuf
    C_ARGS:
	pixbuf

 # these are done for you by the Glib bindings
###  GtkIconSet* gtk_icon_set_ref (GtkIconSet *icon_set) 
###  void gtk_icon_set_unref (GtkIconSet *icon_set) 
###  GtkIconSet* gtk_icon_set_copy (GtkIconSet *icon_set) 

#### apps should almost always use gtk_widget_render_icon
##  GdkPixbuf* gtk_icon_set_render_icon (GtkIconSet *icon_set, GtkStyle *style, GtkTextDirection direction, GtkStateType state, GtkIconSize size, GtkWidget *widget, const char *detail) 
GdkPixbuf_noinc*
gtk_icon_set_render_icon (icon_set, style, direction, state, size, widget, detail=NULL)
	GtkIconSet *icon_set
	GtkStyle_ornull *style
	GtkTextDirection direction
	GtkStateType state
	GtkIconSize size
	GtkWidget_ornull *widget
	const char *detail

##  void gtk_icon_set_add_source (GtkIconSet *icon_set, const GtkIconSource *source) 
void
gtk_icon_set_add_source (icon_set, source)
	GtkIconSet *icon_set
	GtkIconSource *source

##  void gtk_icon_set_get_sizes (GtkIconSet *icon_set, GtkIconSize **sizes, gint *n_sizes) 
=for apidoc
Returns a list of Gtk2::IconSize's.
=cut
void
gtk_icon_set_get_sizes (icon_set)
	GtkIconSet *icon_set
    PREINIT:
	GtkIconSize * sizes = NULL;
	gint n_sizes, i;
    PPCODE:
	gtk_icon_set_get_sizes (icon_set, &sizes, &n_sizes);
	EXTEND (SP, n_sizes);
	for (i = 0 ; i < n_sizes ; i++)
		PUSHs (sv_2mortal (newSVGtkIconSize (sizes[i])));
	g_free (sizes);
	

MODULE = Gtk2::IconFactory	PACKAGE = Gtk2::IconSource	PREFIX = gtk_icon_source_

##  GtkIconSource* gtk_icon_source_new (void) 
GtkIconSource_own*
gtk_icon_source_new (class)
    C_ARGS:
	/*void*/

 # these are done for you by the Glib::Boxed bindings
##  GtkIconSource* gtk_icon_source_copy (const GtkIconSource *source) 
##  void gtk_icon_source_free (GtkIconSource *source) 

##  void gtk_icon_source_set_filename (GtkIconSource *source, const gchar *filename) 
void
gtk_icon_source_set_filename (source, filename)
	GtkIconSource *source
	GPerlFilename filename

GPerlFilename_const
gtk_icon_source_get_filename (source)
	GtkIconSource *source

##  void gtk_icon_source_set_pixbuf (GtkIconSource *source, GdkPixbuf *pixbuf) 
void
gtk_icon_source_set_pixbuf (source, pixbuf)
	GtkIconSource *source
	GdkPixbuf *pixbuf

##  GdkPixbuf* gtk_icon_source_get_pixbuf (const GtkIconSource *source) 
GdkPixbuf_ornull*
gtk_icon_source_get_pixbuf (source)
	GtkIconSource *source

##  void gtk_icon_source_set_direction_wildcarded (GtkIconSource *source, gboolean setting) 
void
gtk_icon_source_set_direction_wildcarded (source, setting)
	GtkIconSource *source
	gboolean setting

##  void gtk_icon_source_set_state_wildcarded (GtkIconSource *source, gboolean setting) 
void
gtk_icon_source_set_state_wildcarded (source, setting)
	GtkIconSource *source
	gboolean setting

##  void gtk_icon_source_set_size_wildcarded (GtkIconSource *source, gboolean setting) 
void
gtk_icon_source_set_size_wildcarded (source, setting)
	GtkIconSource *source
	gboolean setting

##  gboolean gtk_icon_source_get_size_wildcarded (const GtkIconSource *source) 
gboolean
gtk_icon_source_get_size_wildcarded (source)
	GtkIconSource *source

##  gboolean gtk_icon_source_get_state_wildcarded (const GtkIconSource *source) 
gboolean
gtk_icon_source_get_state_wildcarded (source)
	GtkIconSource *source

##  gboolean gtk_icon_source_get_direction_wildcarded (const GtkIconSource *source) 
gboolean
gtk_icon_source_get_direction_wildcarded (source)
	GtkIconSource *source

##  void gtk_icon_source_set_direction (GtkIconSource *source, GtkTextDirection direction) 
void
gtk_icon_source_set_direction (source, direction)
	GtkIconSource *source
	GtkTextDirection direction

##  void gtk_icon_source_set_state (GtkIconSource *source, GtkStateType state) 
void
gtk_icon_source_set_state (source, state)
	GtkIconSource *source
	GtkStateType state

##  void gtk_icon_source_set_size (GtkIconSource *source, GtkIconSize size) 
void
gtk_icon_source_set_size (source, size)
	GtkIconSource *source
	GtkIconSize size

##  GtkTextDirection gtk_icon_source_get_direction (const GtkIconSource *source) 
GtkTextDirection
gtk_icon_source_get_direction (source)
	GtkIconSource *source

##  GtkStateType gtk_icon_source_get_state (const GtkIconSource *source) 
GtkStateType
gtk_icon_source_get_state (source)
	GtkIconSource *source

##  GtkIconSize gtk_icon_source_get_size (const GtkIconSource *source) 
GtkIconSize
gtk_icon_source_get_size (source)
	GtkIconSource *source

#if GTK_CHECK_VERSION(2,4,0)

##  void gtk_icon_source_set_icon_name (GtkIconSource *source, const gchar *icon_name) 
void
gtk_icon_source_set_icon_name (source, icon_name)
	GtkIconSource *source
	const gchar *icon_name

##  const gchar *gtk_icon_source_get_icon_name (const GtkIconSource *source) 
const gchar *
gtk_icon_source_get_icon_name (source)
	GtkIconSource *source

#endif