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
  
/* -*- C -*- */ 
class GTK2.IconSet; 
 
//! Iconset.  A single icon. 
 
void create(?GDK2.Pixbuf pixbuf) 
//! Create a new GTK2.IconSet.  A GTK2.IconSet represents a single icon in 
//! various sizes and widget states.  It can provide a GDK2.Pixbuf for a given 
//! size and state on request, and automatically caches some of the rendered 
//! GDK2.Pixbuf objects. 
//! <p> 
//! Normally you would use GTK2.Widget->render_icon() instead of using 
//! GTK2.IconSet directly.  The one case where you'd use GTK2.IconSet is to 
//! create application-specific icon sets to place in a GTK2.IconFactory. 
{ 
  pgtk2_verify_not_inited(); 
  pgtk2_verify_setup(); 
  if (args) { 
    struct object *o1; 
    get_all_args("create",args,"%o",&o1); 
    THIS->obj=(void *)gtk_icon_set_new_from_pixbuf( 
                        GDK_PIXBUF(get_gobject(o1))); 
    pgtk2_pop_n_elems(args); 
  } else 
    THIS->obj=(void *)gtk_icon_set_new(); 
  pgtk2__init_this_object(); 
} 
 
void destroy() 
{ 
  if (THIS->obj) 
    gtk_icon_set_unref((GtkIconSet *)THIS->obj); 
  THIS->obj=NULL; 
  pgtk2_pop_n_elems(args); 
  push_int(0); 
} 
 
GTK2.IconSet copy() 
//! Create a copy. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GtkIconSet *gis=gtk_icon_set_copy((GtkIconSet *)THIS->obj); 
    push_gobjectclass(gis,pgtk2_icon_set_program); 
  } 
} 
 
/* 
GDK2.Pixbuf render_icon(GTK2.Style style, int direction, int state, int size, 
                       ?GTK2.Widget widget) 
//! Renders an icon using GTK2.Style->render_icon().  In most cases, 
//! GTK2.Widget->render_icon() is better, since it automatically provides most 
//! of the arguments from the current widget settings. 
{ 
  pgtk2_verify_inited(); 
  { 
    INT_TYPE dir,state,size; 
    struct object *o1,*o2; 
    GdkPixbuf *pixbuf; 
    get_all_args("render_icon",args,"%o%i%i%i%o",&o1,&dir,&state,&size,&o2); 
    pixbuf=gtk_icon_set_render_icon((GtkIconSet *)THIS->obj, 
                        GTK_STYLE(get_gobject(o1)),dir,state,size, 
                        GTK_WIDGET(get_gobject(o2))); 
    pgtk2_pop_n_elems(args); 
    g_object_ref(pixbuf); 
    push_gobject(pixbuf); 
  } 
} 
*/ 
 
array(int) get_sizes() 
//! Obtains a list of icon sizes this icon set can render. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GtkIconSize *sizes; 
    int n_sizes,i; 
    gtk_icon_set_get_sizes((GtkIconSet *)THIS->obj,&sizes,&n_sizes); 
    for (i=0; i<n_sizes; i++) 
      PGTK_PUSH_INT(sizes[i]); 
    g_free(sizes); 
  } 
} 
 
void add_source(GTK2.IconSource source) 
//! Icon sets have a list of GTK2.IconSource, which they use as base icons for 
//! rendering icons in different states and sizes.  Icons are scaled, made to 
//! look insensitive, etc. in render_icon(), but GTK2.IconSet needs base images 
//! to work with.  The base images and when to use them are described by a 
//! GTK2.IconSource. 
//! <p> 
//! This function copies source, so you can reuse the same source immediately 
//! without affecting the icon set. 
//! <p> 
//! An example of when you'd use this function:  a web browser's "Back to 
//! Previous Page" icon might point in a different direciton in Hebrew and in 
//! English; it might look different when insensitive; and it might change size 
//! depending on toolbar mode (small/large icons).  So a single icon set would 
//! contain all those variants of the icon, and you might add a separate source 
//! for each one. 
//! <p> 
//! You should nearly always add a "default" icon source with all fields 
//! wildcarded, which will be used as a fallback if no more specific source 
//! matches.  GTK2.IconSet always prefers more specific icon sources to more 
//! generic icon sources.  The order in which you add the sources to the icon 
//! set does not matter. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1; 
    get_all_args("add_source",args,"%o",&o1); 
    gtk_icon_set_add_source((GtkIconSet *)THIS->obj, 
                        (GtkIconSource *)get_pg2object(o1,pgtk2_icon_source_program)); 
  } 
  RETURN_THIS(); 
}