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); }
static int Detach(lua_State *L) { IupDetach(iuplua_checkihandle(L,1)); return 0; }
static void Detach(void) { IupDetach(iuplua_checkihandle(1)); }