Ihandle* iupObjectCreate(Iclass* iclass, void** params) { /* create the base handle structure */ Ihandle* ih = iHandleCreate(); ih->iclass = iclass; /* create the element */ if (iupClassObjectCreate(ih, params) == IUP_ERROR) { iupERROR1("IUP object creation failed (%s).", iclass->name); iHandleDestroy(ih); return NULL; } return ih; }
Ihandle* iupObjectCreate(Iclass* iclass, void** params) { /* create the base handle structure */ Ihandle* ih = iHandleCreate(); ih->iclass = iclass; /* create the element */ if (iupClassObjectCreate(ih, params) == IUP_ERROR) { iupERROR1("IUP object creation failed (%s).", iclass->name); iHandleDestroy(ih); return NULL; } /* ensure attributes default values, at this time only the ones that can be set before map */ iupClassObjectEnsureDefaultAttributes(ih); return ih; }
void IupDestroy(Ihandle *ih) { Icallback cb; iupASSERT(iupObjectCheck(ih)); if (!iupObjectCheck(ih)) return; /* Hide before destroy to avoid children redraw */ if (ih->iclass->nativetype == IUP_TYPEDIALOG) IupHide(ih); cb = IupGetCallback(ih, "DESTROY_CB"); if (cb) cb(ih); cb = IupGetCallback(ih, "LDESTROY_CB"); /* for language bindings */ if (cb) cb(ih); /* Destroy all its children. Just need to remove the first child, IupDetach will update firstchild. */ while (ih->firstchild) IupDestroy(ih->firstchild); /* unmap if mapped and remove from its parent child list */ IupDetach(ih); /* removes names associated with the element */ iupRemoveNames(ih); /* destroy the element */ iupClassObjectDestroy(ih); /* destroy the private data */ if (ih->data) free(ih->data); /* destroy the base handle structure */ iHandleDestroy(ih); }
void IupDestroy(Ihandle *ih) { iupASSERT(iupObjectCheck(ih)); if (!iupObjectCheck(ih)) return; /* Hide before destroy to avoid children redraw */ if (ih->iclass->nativetype == IUP_TYPEDIALOG) IupHide(ih); /* Destroy all its children. Just need to remove the first child, IupDetach will update firstchild. */ while (ih->firstchild) IupDestroy(ih->firstchild); /* unmap if mapped and remove from its parent child list */ IupDetach(ih); /* destroy the element */ iupClassObjectDestroy(ih); /* destroy the private data */ if (ih->data) free(ih->data); { /* removes all the names associated with the element */ char *name; while ((name=IupGetName(ih)) != NULL) IupSetHandle(name, NULL); } /* destroy the base handle structure */ iHandleDestroy(ih); }