int_input.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * @file int_input.h
  3. * GUI: Integer string keyboard view module API
  4. */
  5. #pragma once
  6. #include <gui/view.h>
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. /** Int input anonymous structure */
  11. typedef struct IntInput IntInput;
  12. /** callback that is executed on save button press */
  13. typedef void (*IntInputCallback)(void* context);
  14. /** callback that is executed when byte buffer is changed */
  15. typedef void (*IntChangedCallback)(void* context);
  16. /** Allocate and initialize Int input. This Int input is used to enter Ints.
  17. *
  18. * @return IntInput instance pointer
  19. */
  20. IntInput* int_input_alloc();
  21. /** Deinitialize and free byte input
  22. *
  23. * @param int_input Int input instance
  24. */
  25. void int_input_free(IntInput* int_input);
  26. /** Get byte input view
  27. *
  28. * @param int_input byte input instance
  29. *
  30. * @return View instance that can be used for embedding
  31. */
  32. View* int_input_get_view(IntInput* int_input);
  33. /** Set byte input result callback
  34. *
  35. * @param int_input byte input instance
  36. * @param input_callback input callback fn
  37. * @param changed_callback changed callback fn
  38. * @param callback_context callback context
  39. * @param text_buffer buffer to use
  40. * @param text_buffer_size buffer length
  41. * @param clear_default_text clear previous entry
  42. */
  43. void int_input_set_result_callback(
  44. IntInput* int_input,
  45. IntInputCallback input_callback,
  46. void* callback_context,
  47. char* text_buffer,
  48. size_t text_buffer_size,
  49. bool clear_default_text);
  50. /** Set byte input header text
  51. *
  52. * @param int_input byte input instance
  53. * @param text text to be shown
  54. */
  55. void int_input_set_header_text(IntInput* int_input, const char* text);
  56. #ifdef __cplusplus
  57. }
  58. #endif