2021-10-03 10:36:05 +00:00
|
|
|
/**
|
|
|
|
* @file icon_animation.h
|
|
|
|
* GUI: IconAnimation API
|
|
|
|
*/
|
|
|
|
|
2021-07-07 08:57:49 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2022-10-28 14:08:50 +00:00
|
|
|
#include <gui/icon.h>
|
2021-07-07 08:57:49 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-10-03 10:36:05 +00:00
|
|
|
/** Icon Animation */
|
2021-07-07 08:57:49 +00:00
|
|
|
typedef struct IconAnimation IconAnimation;
|
|
|
|
|
2021-10-03 10:36:05 +00:00
|
|
|
/** Icon Animation Callback. Used for update notification */
|
2021-10-02 17:00:56 +00:00
|
|
|
typedef void (*IconAnimationCallback)(IconAnimation* instance, void* context);
|
|
|
|
|
|
|
|
/** Allocate icon animation instance with const icon data.
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
2021-07-07 08:57:49 +00:00
|
|
|
* always returns Icon or stops system if not enough memory
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param[in] icon pointer to Icon data
|
|
|
|
*
|
|
|
|
* @return IconAnimation instance
|
2021-07-07 08:57:49 +00:00
|
|
|
*/
|
|
|
|
IconAnimation* icon_animation_alloc(const Icon* icon);
|
|
|
|
|
2021-10-02 17:00:56 +00:00
|
|
|
/** Release icon animation instance
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param instance IconAnimation instance
|
2021-07-07 08:57:49 +00:00
|
|
|
*/
|
|
|
|
void icon_animation_free(IconAnimation* instance);
|
|
|
|
|
2021-10-03 10:36:05 +00:00
|
|
|
/** Set IconAnimation update callback
|
|
|
|
*
|
|
|
|
* Normally you do not need to use this function, use view_tie_icon_animation
|
|
|
|
* instead.
|
|
|
|
*
|
|
|
|
* @param instance IconAnimation instance
|
|
|
|
* @param[in] callback IconAnimationCallback
|
|
|
|
* @param context callback context
|
2021-07-07 08:57:49 +00:00
|
|
|
*/
|
2021-10-02 17:00:56 +00:00
|
|
|
void icon_animation_set_update_callback(
|
|
|
|
IconAnimation* instance,
|
|
|
|
IconAnimationCallback callback,
|
|
|
|
void* context);
|
2021-07-07 08:57:49 +00:00
|
|
|
|
2021-10-02 17:00:56 +00:00
|
|
|
/** Get icon animation width
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param instance IconAnimation instance
|
|
|
|
*
|
|
|
|
* @return width in pixels
|
2021-07-07 08:57:49 +00:00
|
|
|
*/
|
2023-02-09 04:58:01 +00:00
|
|
|
uint8_t icon_animation_get_width(const IconAnimation* instance);
|
2021-07-07 08:57:49 +00:00
|
|
|
|
2021-10-02 17:00:56 +00:00
|
|
|
/** Get icon animation height
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param instance IconAnimation instance
|
|
|
|
*
|
|
|
|
* @return height in pixels
|
2021-07-07 08:57:49 +00:00
|
|
|
*/
|
2023-02-09 04:58:01 +00:00
|
|
|
uint8_t icon_animation_get_height(const IconAnimation* instance);
|
2021-07-07 08:57:49 +00:00
|
|
|
|
2021-10-02 17:00:56 +00:00
|
|
|
/** Start icon animation
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param instance IconAnimation instance
|
2021-07-07 08:57:49 +00:00
|
|
|
*/
|
|
|
|
void icon_animation_start(IconAnimation* instance);
|
|
|
|
|
2021-10-02 17:00:56 +00:00
|
|
|
/** Stop icon animation
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param instance IconAnimation instance
|
2021-07-07 08:57:49 +00:00
|
|
|
*/
|
|
|
|
void icon_animation_stop(IconAnimation* instance);
|
|
|
|
|
2021-10-02 17:00:56 +00:00
|
|
|
/** Returns true if current frame is a last one
|
2021-10-03 10:36:05 +00:00
|
|
|
*
|
|
|
|
* @param instance IconAnimation instance
|
|
|
|
*
|
|
|
|
* @return true if last frame
|
2021-07-07 08:57:49 +00:00
|
|
|
*/
|
2023-02-09 04:58:01 +00:00
|
|
|
bool icon_animation_is_last_frame(const IconAnimation* instance);
|
2021-07-07 08:57:49 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|