Skip to content

Commit

Permalink
Add snis_text_input_has_focus() function
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen M. Cameron <[email protected]>
  • Loading branch information
smcameron committed Oct 21, 2023
1 parent 2c00c63 commit bd6d54a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions snis_text_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ void snis_text_input_box_set_focus(struct snis_text_input_box *t, int has_focus)
}
}

int snis_text_input_box_has_focus(struct snis_text_input_box *t)
{
return t->has_focus;
}

int snis_text_input_box_button_press(struct snis_text_input_box *t, int x, int y)
{
int hit;
Expand Down
3 changes: 3 additions & 0 deletions snis_text_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ GLOBAL void snis_text_input_box_draw(struct snis_text_input_box *t);
/* Set the text input to have focus (has_focus != 0) or not (has_focus == 0) */
GLOBAL void snis_text_input_box_set_focus(struct snis_text_input_box *t, int has_focus);

/* Returns 1 if *t has focus, 0 otherwise */
GLOBAL int snis_text_input_box_has_focus(struct snis_text_input_box *t);

/* Returns 1 if x,y are inside the text box, 0 otherwise */
GLOBAL int snis_text_input_box_button_press(struct snis_text_input_box *t, int x, int y);

Expand Down

0 comments on commit bd6d54a

Please sign in to comment.