diff options
-rw-r--r-- | src/tk/check.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/tk/check.c b/src/tk/check.c index 407d969..fddd7cf 100644 --- a/src/tk/check.c +++ b/src/tk/check.c @@ -85,7 +85,22 @@ _mftk_check_key_event(struct mftk_widget *w, SDL_Event *e) { struct mftk_check *c = (struct mftk_check *) w; - /* TODO */ + switch (e->type) { + case SDL_KEYDOWN: + switch (e->key.keysym.sym) { + case SDLK_SPACE: + case SDLK_RETURN: + c->state = !c->state; + if (c->action == NULL) { + return 0; + } + return c->action(c->user_data,c->state); + default: + break; + } + default: + break; + } return 0; } |