dialog_ex_vm.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #pragma once
  2. #include "generic_view_module.h"
  3. #include <gui/modules/dialog_ex.h>
  4. class DialogExVM : public GenericViewModule {
  5. public:
  6. DialogExVM();
  7. ~DialogExVM() final;
  8. View* get_view() final;
  9. void clean() final;
  10. /**
  11. * Set dialog result callback
  12. * @param callback - result callback function
  13. */
  14. void set_result_callback(DialogExResultCallback callback);
  15. /**
  16. * Set dialog context
  17. * @param context - context pointer, will be passed to result callback
  18. */
  19. void set_context(void* context);
  20. /**
  21. * Set dialog header text
  22. * If text is null, dialog header will not be rendered
  23. * @param text - text to be shown, can be multiline
  24. * @param x, y - text position
  25. * @param horizontal, vertical - text aligment
  26. */
  27. void set_header(const char* text, uint8_t x, uint8_t y, Align horizontal, Align vertical);
  28. /**
  29. * Set dialog text
  30. * If text is null, dialog text will not be rendered
  31. * @param text - text to be shown, can be multiline
  32. * @param x, y - text position
  33. * @param horizontal, vertical - text aligment
  34. */
  35. void set_text(const char* text, uint8_t x, uint8_t y, Align horizontal, Align vertical);
  36. /**
  37. * Set dialog icon
  38. * If x or y is negative, dialog icon will not be rendered
  39. * @param x, y - icon position
  40. * @param name - icon to be shown
  41. */
  42. void set_icon(uint8_t x, uint8_t y, const Icon* icon);
  43. /**
  44. * Set left button text
  45. * If text is null, left button will not be rendered and processed
  46. * @param text - text to be shown
  47. */
  48. void set_left_button_text(const char* text);
  49. /**
  50. * Set center button text
  51. * If text is null, center button will not be rendered and processed
  52. * @param text - text to be shown
  53. */
  54. void set_center_button_text(const char* text);
  55. /**
  56. * Set right button text
  57. * If text is null, right button will not be rendered and processed
  58. * @param text - text to be shown
  59. */
  60. void set_right_button_text(const char* text);
  61. private:
  62. DialogEx* dialog_ex;
  63. };