int_input.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * @file int_input.h
  3. * GUI: Integer 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. //IntChangedCallback changed_callback,
  47. void* callback_context,
  48. char* text_buffer,
  49. size_t text_buffer_size,
  50. bool clear_default_text);
  51. /** Set byte input header text
  52. *
  53. * @param int_input byte input instance
  54. * @param text text to be shown
  55. */
  56. void int_input_set_header_text(IntInput* int_input, const char* text);
  57. #ifdef __cplusplus
  58. }
  59. #endif