flipp_pomodoro_info_view.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #pragma once
  2. #include <gui/view.h>
  3. /** @brief Mode types for FlippPomodoroInfoView
  4. *
  5. * These are the modes that can be used in the FlippPomodoroInfoView
  6. */
  7. typedef enum
  8. {
  9. FlippPomodoroInfoViewModeStats,
  10. FlippPomodoroInfoViewModeAbout,
  11. } FlippPomodoroInfoViewMode;
  12. /** @brief Forward declaration of the FlippPomodoroInfoView struct */
  13. typedef struct FlippPomodoroInfoView FlippPomodoroInfoView;
  14. /** @brief User action callback function type
  15. *
  16. * Callback functions of this type are called when a user action is performed.
  17. */
  18. typedef void (*FlippPomodoroInfoViewUserActionCb)(void *ctx);
  19. /** @brief Allocate a new FlippPomodoroInfoView
  20. *
  21. * Allocates a new FlippPomodoroInfoView and returns a pointer to it.
  22. * @return A pointer to a new FlippPomodoroInfoView
  23. */
  24. FlippPomodoroInfoView *flipp_pomodoro_info_view_alloc();
  25. /** @brief Get the view from a FlippPomodoroInfoView
  26. *
  27. * Returns a pointer to the view associated with a FlippPomodoroInfoView.
  28. * @param info_view A pointer to a FlippPomodoroInfoView
  29. * @return A pointer to the view of the FlippPomodoroInfoView
  30. */
  31. View *flipp_pomodoro_info_view_get_view(FlippPomodoroInfoView *info_view);
  32. /** @brief Free a FlippPomodoroInfoView
  33. *
  34. * Frees the memory used by a FlippPomodoroInfoView.
  35. * @param info_view A pointer to a FlippPomodoroInfoView
  36. */
  37. void flipp_pomodoro_info_view_free(FlippPomodoroInfoView *info_view);
  38. /** @brief Set the number of completed pomodoros in the view
  39. *
  40. * Sets the number of completed pomodoros that should be displayed in the view.
  41. * @param info_view A pointer to the view
  42. * @param pomodoros_completed The number of completed pomodoros
  43. */
  44. void flipp_pomodoro_info_view_set_pomodoros_completed(View *info_view, uint8_t pomodoros_completed);
  45. /** @brief Set the callback function to be called when the timer should be resumed
  46. *
  47. * Sets the callback function that will be called when the timer should be resumed.
  48. * @param info_view A pointer to the FlippPomodoroInfoView
  49. * @param user_action_cb The callback function
  50. * @param user_action_cb_ctx The context to be passed to the callback function
  51. */
  52. void flipp_pomodoro_info_view_set_resume_timer_cb(FlippPomodoroInfoView *info_view, FlippPomodoroInfoViewUserActionCb user_action_cb, void *user_action_cb_ctx);
  53. /** @brief Set the mode of the view
  54. *
  55. * Sets the mode that should be used in the view.
  56. * @param view A pointer to the view
  57. * @param desired_mode The desired mode
  58. */
  59. void flipp_pomodoro_info_view_set_mode(View *view, FlippPomodoroInfoViewMode desired_mode);