virtual Ihandle *create_() { L("VBox create_"); std::vector<Ihandle*> handles; handles.reserve(widgets_.size()+1); for (auto w: widgets_) handles.push_back(*w); handles.push_back(0); return IupVboxv(handles.data()); }
static void ext_iup_vbox(script_t* script, vector_t* args) { vector_t* array = &script_get_arg(args, 0)->array; vector_t handle_array; vec_init(&handle_array, sizeof(Ihandle*)); vec_reserve(&handle_array, array->length + 1); for(int i = 0; i < array->length; ++i) { script_value_t* val = vec_get_value(array, i, script_value_t*); vec_push_back(&handle_array, &val->nat.value); } Ihandle* null_handle = NULL; vec_push_back(&handle_array, &null_handle); Ihandle* vbox = IupVboxv((Ihandle**)handle_array.data); vec_destroy(&handle_array); script_push_native(script, vbox, NULL, iup_handle_free); script_return_top(script); }
Ihandle* IupCreatev(const char *name, void **params) { Iclass *ic = NULL; char lower[30]; int size = 0; assert(name); if(name == NULL) return NULL; size = (int)strlen(name); size++; assert(size < 30 && size > 0); /* invalid name */ if(size > 30 || size <= 0) return NULL; while(size--) lower[size] = (char)tolower(name[size]); if(iupStrEqual(lower, "dialog")) return IupDialog(params? params[0] : NULL); else if(iupStrEqual(lower, "canvas")) return IupCanvas(NULL); else if(iupStrEqual(lower, "button")) return IupButton(NULL, NULL); else if(iupStrEqual(lower, "toggle")) return IupToggle(NULL, NULL); else if(iupStrEqual(lower, "label")) return IupLabel(NULL); else if(iupStrEqual(lower, "frame")) return IupFrame(NULL); else if(iupStrEqual(lower, "list")) return IupList(NULL); else if(iupStrEqual(lower, "multiline")) return IupMultiLine(NULL); else if(iupStrEqual(lower, "text")) return IupText(NULL); else if(iupStrEqual(lower, "user")) return IupUser(); else if(iupStrEqual(lower, "fill")) return IupFill(); else if(iupStrEqual(lower, "separator")) return IupSeparator(); else if(iupStrEqual(lower, "item")) return IupItem(NULL, NULL); else if(iupStrEqual(lower, "hbox")) return IupHboxv((Ihandle**)params); else if(iupStrEqual(lower, "zbox")) return IupZboxv((Ihandle**)params); else if(iupStrEqual(lower, "vbox")) return IupVboxv((Ihandle**)params); else if(iupStrEqual(lower, "menu")) return IupMenuv((Ihandle**)params); else if(iupStrEqual(lower, "radio")) return IupRadio(params[0]); else if(iupStrEqual(lower, "submenu")) return IupSubmenu(NULL, params? params[0] : NULL); /* Not accepted: image color IupGetFile IupListDialog IupMessage IupScanf IupAlarm */ ic = iupCpiGetClass(lower); return iupCpiCreate(ic, params); }