int_input.h 1.7 KB

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