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
  
/* -*- C -*- */ 
require gtk24; 
 
class GTK2.ComboBox; 
inherit GTK2.Bin; 
inherit GTK2.CellLayout; 
inherit GTK2.CellEditable; 
 
//! Properties: 
//! int active 
//! int add-tearoffs 
//! int column-span-column 
//! int focus-on-click 
//! int has-frame 
//! GTK2.TreeModel model 
//! int row-span-column 
require gtk210; 
//! string tearoff-title 
endrequire; 
//! int wrap-width 
//! <p> 
//! Style properties: 
//! int appears-as-list 
//! int arrow-size 
//! int shadow-type 
 
signal changed; 
 
void create(GTK2.TreeModel|mapping(string:mixed)|string|void model_or_props) 
//! Create a new ComboBox, either empty or with a model.  If a string is passed 
//! int instead, it will create a new W(ComboBox) with only text strings. 
//! If you do so, you should only manipulate it with the following functions: 
//! append_text(), insert_text(), prepend_text(), and remove_text(). 
{ 
  pgtk2_verify_not_inited(); 
  pgtk2_verify_setup(); 
  if (args) { 
    GtkWidget *gcb; 
    if (TYPEOF(Pike_sp[-args]) == PIKE_T_STRING) { 
      char *text; 
      get_all_args(NULL,args,"%s",&text); 
      gcb=gtk_combo_box_new_text(); 
      THIS->obj=G_OBJECT(gcb); 
    } else if (TYPEOF(Pike_sp[-args]) == PIKE_T_OBJECT) { 
      struct object *o1; 
      get_all_args(NULL,args,"%o",&o1); 
      gcb=gtk_combo_box_new_with_model(GTK_TREE_MODEL(get_gobject(o1))); 
      THIS->obj=G_OBJECT(gcb); 
    } else { 
      INIT_WITH_PROPS(GTK_TYPE_COMBO_BOX); 
    } 
    pgtk2_pop_n_elems(args); 
  } else { 
    GtkWidget *gcb; 
    gcb=gtk_combo_box_new(); 
    THIS->obj=G_OBJECT(gcb); 
  } 
  pgtk2__init_this_object(); 
} 
 
require gtk26; 
int get_wrap_width(); 
//! Returns the wrap width which is used to determine 
//! the number of columns for the popup menu.  If the wrap 
//! width is larger than 1, the combo box is in table mode. 
endrequire; 
 
void set_wrap_width(int width); 
//! Sets the wrap width.  The wrap width is basically the preferred 
//! number of columns when you want the popup to be layed out in 
//! a table. 
 
require gtk26; 
int get_row_span_column(); 
//! Returns the column with row span information. 
 
int get_column_span_column(); 
//! Returns the column with column span information. 
endrequire; 
 
void set_row_span_column(int row_span); 
//! Sets the column with row span information.  The row span column 
//! contains integers which indicate how many rows an item 
//! should span. 
 
void set_column_span_column(int column_span); 
//! Sets the column span information.  The column span column 
//! contains integers which indicate how many columns 
//! an item should span. 
 
int get_active(); 
//! Returns the index of the currently active item, or -1 if none. 
//! If the model is a non-flat treemodel, and the active item 
//! is not an immediate child of the root of the tree, this 
//! function returns path_get_indices(path)[0], where path is 
//! the GTK2.TreePath of the active item. 
 
void set_active(int index_); 
//! Sets the active item. 
 
+GTK2.TreeIter get_active_iter() 
//! Get the current active item. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GtkTreeIter *iter=NULL; 
    int res; 
 
    iter=(GtkTreeIter *)g_malloc(sizeof(GtkTreeIter)); 
    if (iter==NULL) 
      SIMPLE_OUT_OF_MEMORY_ERROR("get_active_iter",sizeof(GtkTreeIter)); 
    res=gtk_combo_box_get_active_iter(GTK_COMBO_BOX(THIS->obj), 
                iter); 
    if (res) 
      push_gobjectclass(iter,pgtk2_tree_iter_program); 
    else 
      push_int(0); 
  } 
} 
 
void set_active_iter(GTK2.TreeIter iter) 
//! Sets the current active item to be the one referenced by iter. 
//! iter must correspond to a path of depth one. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1; 
    get_all_args(NULL,args,"%o",&o1); 
    gtk_combo_box_set_active_iter(GTK_COMBO_BOX(THIS->obj), 
                (GtkTreeIter *)get_pg2object(o1,pgtk2_tree_iter_program)); 
    pgtk2_pop_n_elems(args); 
  } 
  RETURN_THIS(); 
} 
 
+GTK2.TreeModel get_model() 
//! Get the GTK2.TreeModel which is acting as a data source. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GtkTreeModel *gtm; 
 
    gtm=gtk_combo_box_get_model(GTK_COMBO_BOX(THIS->obj)); 
    if (GTK_IS_TREE_MODEL(gtm)) { 
      push_gobject(gtm); 
      g_object_ref(gtm); 
    } else 
      push_int(0); 
  } 
} 
 
void set_model(?GTK2.TreeModel model); 
//! Sets the model used by this widget.  Will unset a previously 
//! set model.  If no arguments are passed, then it will unset 
//! the model. 
 
void append_text(string text); 
//! Appends text to the list of strings stored in this combo box. 
//! Note that you can only use this function with combo boxes 
//! constructed with GTK2.ComboBox("a string"). 
 
void insert_text(int position, string text); 
//! Inserts string at position in the list of strings stored. 
//! Note that you can only use this function with combo boxes 
//! constructed with GTK2.ComboBox("a string"). 
 
void prepend_text(string text); 
//! Prepends string to the list of strings stored in this combo box. 
//! Note that you can only use this function with combo boxes 
//! constructed with GTK2.ComboBox("a string"). 
 
void remove_text(int position); 
//! Removes the string at position from this combo box. 
//! Note that you can only use this function with combo boxes 
//! constructed with GTK2.ComboBox("a string"). 
 
require gtk26; 
string get_active_text() 
//! Returns the currently active string. 
//! Note that you can only use this function with combo boxes 
//! constructed with GTK2.ComboBox("a string"). 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    gchar *a1; 
    a1=gtk_combo_box_get_active_text(GTK_COMBO_BOX(THIS->obj)); 
    if (a1==NULL) 
      push_string(empty_pike_string); 
    else 
    { 
      PGTK_PUSH_GCHAR(a1); 
      free( a1 ); 
    } 
  } 
} 
endrequire; 
 
void popup(); 
//! Pops up the menu or dropdown list. 
 
void popdown(); 
//! Hides the menu or dropdown list. 
 
require gtk26; 
void set_row_separator_func(function(GTK2.TreeModel, GTK2.TreeIter, mixed : int) f, mixed user_data ) 
//! Sets the row separator function, which is used to determine whether a 
//! row should be drawn as a separator.  If the row separator function is 0 
//! no separators are drawn.  This is the default value. 
 
{ 
  pgtk2_verify_inited(); 
  {  
    struct svalue *sv1,*sv2; 
    struct signal_data *sd; 
 
    get_all_args(NULL,args,"%*%*",&sv1,&sv2); 
    sd=(struct signal_data *)g_malloc(sizeof(struct signal_data)); 
    if (sd==NULL) 
      SIMPLE_OUT_OF_MEMORY_ERROR("set_row_separator_func",sizeof(struct signal_data) 
); 
    assign_svalue_no_free(&sd->cb,sv1); 
    assign_svalue_no_free(&sd->args,sv2); 
    gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(THIS->obj), 
                        (GtkTreeViewRowSeparatorFunc)pgtk2_tree_view_row_separator_func, 
                        sd,(GtkDestroyNotify)pgtk2_free_signal_data); 
  }  
  RETURN_THIS(); 
} 
endrequire; 
 
require gtk26; 
void set_add_tearoffs(int setting); 
//! Sets whether the popup menu should have a tearoff menu item. 
 
int get_add_tearoffs(); 
//! Gets whether the popup menu has tearoff items. 
 
require gtk210; 
void set_title(string title); 
//! Sets the menu's title in tearoff mode. 
 
string get_title(); 
//! Gets the current title of the menu in tearoff mode. 
endrequire; 
 
void set_focus_on_click(int setting); 
//! Sets whether the combo box will grab focus when it is 
//! clicked with the mouse. 
 
int get_focus_on_click(); 
//! Returns whether the combo box grabs focus when it is 
//! clicked with the mouse. 
endrequire; 
 
endrequire;