Class: Newt::CheckboxTree
  
  
  
  
    
      Class Method Summary
      collapse
    
    
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  Methods inherited from Widget
  #==, #callback, #get_position, #get_size, #inspect, #takes_focus
  
    Class Method Details
    
      
  
  
    .new(*args)  ⇒ Object 
  
  
  
  
    | 
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186 | # File 'ext/ruby_newt/ruby_newt.c', line 1173
static VALUE rb_ext_CheckboxTree_new(int argc, VALUE *argv, VALUE self)
{
  newtComponent co;
  int flags;
  if (argc < 3 || argc > 4)
    ARG_ERROR(argc, "3..4");
  INIT_GUARD();
  flags = (argc == 4) ? NUM2INT(argv[3]) : 0;
  co = newtCheckboxTree(NUM2INT(argv[0]), NUM2INT(argv[1]), NUM2INT(argv[2]), flags);
  return Make_Widget(self, co);
} | 
 
    
   
  
    Instance Method Details
    
      
  
  
    #add(args)  ⇒ Object 
  
  
  
  
    | 
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211 | # File 'ext/ruby_newt/ruby_newt.c', line 1188
static VALUE rb_ext_CheckboxTree_AddItem(VALUE self, VALUE args)
{
  newtComponent co;
  int *indexes;
  char *text; VALUE data;
  int i, len, flags;
  len = RARRAY_LENINT(args);
  if (len < 4)
    ARG_ERROR(len, "4+");
  Get_newtComponent(self, co);
  indexes = ALLOCA_N(int, (len - 4) + 2);
  for (i = 0; i < (len - 4) + 1; i++)
    indexes[i] = NUM2INT(RARRAY_PTR(args)[i+3]);
  indexes[(len - 4) + 1] = NEWT_ARG_LAST;
  text = StringValuePtr(RARRAY_PTR(args)[0]);
  data = RARRAY_PTR(args)[1];
  flags = NUM2INT(RARRAY_PTR(args)[2]);
  Data_Attach(self, data);
  newtCheckboxTreeAddArray(co, text, (void *) data, flags, indexes);
  return Qnil;
} | 
 
    
      
  
  
    #find(data)  ⇒ Object 
  
  
  
  
    | 
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257 | # File 'ext/ruby_newt/ruby_newt.c', line 1241
static VALUE rb_ext_CheckboxTree_FindItem(VALUE self, VALUE data)
{
  newtComponent co;
  int *path;
  VALUE ary;
  int i;
  ary = Qnil;
  Get_newtComponent(self, co);
  path = newtCheckboxTreeFindItem(co, (void *) data);
  if (path != NULL) {
    ary = rb_ary_new();
    for (i = 0; path[i] != NEWT_ARG_LAST; i++)
      rb_ary_push(ary, INT2NUM(path[i]));
  }
  return ary;
} | 
 
    
      
  
  
    #get(data)  ⇒ Object 
  
  
  
  
    | 
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286 | # File 'ext/ruby_newt/ruby_newt.c', line 1277
static VALUE rb_ext_CheckboxTree_GetEntryValue(VALUE self, VALUE data)
{
  newtComponent co;
  char value[2];
  Get_newtComponent(self, co);
  value[0] = newtCheckboxTreeGetEntryValue(co, (void *) data);
  value[1] = '\0';
  return (value[0] == -1) ? Qnil : rb_str_new_cstr(value);
} | 
 
    
      
  
  
    #get_current  ⇒ Object 
  
  
  
  
    | 
1224
1225
1226
1227
1228
1229
1230 | # File 'ext/ruby_newt/ruby_newt.c', line 1224
static VALUE rb_ext_CheckboxTree_GetCurrent(VALUE self)
{
  newtComponent co;
  Get_newtComponent(self, co);
  return (VALUE) newtCheckboxTreeGetCurrent(co);
} | 
 
    
      
  
  
    #get_selection  ⇒ Object 
  
  
  
  
    | 
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222 | # File 'ext/ruby_newt/ruby_newt.c', line 1213
static VALUE rb_ext_CheckboxTree_GetSelection(VALUE self)
{
  newtComponent co;
  VALUE *data;
  int numitems;
  Get_newtComponent(self, co);
  data = (VALUE *) newtCheckboxTreeGetSelection(co, &numitems);
  return checkboxtree_collect_selection(numitems, data);
} | 
 
    
      
  
  
    #set(data, value)  ⇒ Object 
  
  
  
  
    | 
1288
1289
1290
1291
1292
1293
1294 | # File 'ext/ruby_newt/ruby_newt.c', line 1288
static VALUE rb_ext_CheckboxTree_SetEntryValue(VALUE self, VALUE data, VALUE value) {
  newtComponent co;
  Get_newtComponent(self, co);
  newtCheckboxTreeSetEntryValue(co, (void *) data, StringValueCStr(value)[0]);
  return Qnil;
} | 
 
    
      
  
  
    #set_current(data)  ⇒ Object 
  
  
  
  
    | 
1232
1233
1234
1235
1236
1237
1238
1239 | # File 'ext/ruby_newt/ruby_newt.c', line 1232
static VALUE rb_ext_CheckboxTree_SetCurrent(VALUE self, VALUE data)
{
  newtComponent co;
  Get_newtComponent(self, co);
  newtCheckboxTreeSetCurrent(co, (void *) data);
  return Qnil;
} | 
 
    
      
  
  
    #set_entry(data, text)  ⇒ Object 
  
  
  
  
    | 
1259
1260
1261
1262
1263
1264
1265
1266 | # File 'ext/ruby_newt/ruby_newt.c', line 1259
static VALUE rb_ext_CheckboxTree_SetEntry(VALUE self, VALUE data, VALUE text)
{
  newtComponent co;
  Get_newtComponent(self, co);
  newtCheckboxTreeSetEntry(co, (void *) data, StringValuePtr(text));
  return Qnil;
} | 
 
    
      
  
  
    #set_width(width)  ⇒ Object 
  
  
  
  
    | 
1268
1269
1270
1271
1272
1273
1274
1275 | # File 'ext/ruby_newt/ruby_newt.c', line 1268
static VALUE rb_ext_CheckboxTree_SetWidth(VALUE self, VALUE width)
{
  newtComponent co;
  Get_newtComponent(self, co);
  newtCheckboxTreeSetWidth(co, NUM2INT(width));
  return Qnil;
} |