/* * This checks to see if the binding for the key exists. */ bool isCDKObjectBind (EObjectType cdktype, void *object, chtype key) { bool result = FALSE; CDKOBJS *obj = bindableObject (&cdktype, object); if (obj != 0 && ((unsigned)key < obj->bindingCount)) { if ((obj)->bindingList[key].bindFunction != 0) result = TRUE; } return (result); }
/* * This removes all the bindings for the given objects. */ void cleanCDKObjectBindings (EObjectType cdktype, void *object) { CDKOBJS *obj = bindableObject (&cdktype, object); if (obj != 0 && obj->bindingList != 0) { unsigned x; for (x = 0; x < obj->bindingCount; x++) { (obj)->bindingList[x].bindFunction = 0; (obj)->bindingList[x].bindData = 0; } freeAndNull ((obj)->bindingList); } }
/* * This checks to see if the binding for the key exists: * If it does then it runs the command and returns its value, normally TRUE. * If it doesn't it returns a FALSE. This way we can 'overwrite' coded * bindings. */ int checkCDKObjectBind (EObjectType cdktype, void *object, chtype key) { CDKOBJS *obj = bindableObject (&cdktype, object); if (obj != 0 && ((unsigned)key < obj->bindingCount)) { if ((obj)->bindingList[key].bindFunction != 0) { BINDFN function = obj->bindingList[key].bindFunction; void *data = obj->bindingList[key].bindData; return function (cdktype, object, data, key); } } return (FALSE); }
void _unbindCDKObject (EObjectType cdktype, void * object, chtype key) { FILE *fd = fopen("/tmp/otro", "aw"); CDKOBJS *obj = bindableObject (&cdktype, object); fprintf(fd, "\nUnbindg Key: %d [%c] - %d\n", (unsigned)key, (unsigned) key, obj->bindingCount); fflush(fd); if (obj != 0 && ((unsigned)key < obj->bindingCount)) { // if (obj->bindingList[key]) { obj->bindingList[key].bindFunction = 0; obj->bindingList[key].bindData = 0; fprintf(fd,"reseting key %d\n", key); fflush(fd); // } else { // fprintf(fd, "Key not binded\n"); // fflush(fd); // } } fflush(fd); }