flipp_pomodoro_info_view.h 2.5 KB

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