BSB Developer Docs
Loading...
Searching...
No Matches
countdown.h
Go to the documentation of this file.
1
5#pragma once
6
7#include <gui/widget.h>
8#include <gui/gui.h>
9#include <toolbox/color.h>
10#include <time.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
17typedef struct Countdown Countdown;
18
19typedef enum {
20 CountdownDirectionTimeLeft,
21 CountdownDirectionTimeSince,
22 CountdownDirectionMAX,
23} CountdownDirection;
24
25typedef enum {
26 CountdownShowHourAlways,
27 CountdownShowHourWhenNonZero,
28 CountdownShowHourMAX,
29} CountdownShowHour;
30
36typedef void (*CountdownCallback)(void* context);
37
46
52void countdown_free(Countdown* instance);
53
63
74void countdown_set_callback(Countdown* instance, CountdownCallback callback, void* context);
75
82void countdown_set_text_color(Countdown* instance, Color color);
83
90void countdown_set_text_font(Countdown* instance, const char* font_path);
91
100void countdown_begin(
101 Countdown* instance,
102 time_t time,
103 CountdownDirection direction,
104 CountdownShowHour hours);
105
111void countdown_stop(Countdown* instance);
112
113#ifdef __cplusplus
114}
115#endif
Color declaration and conversion API.
void countdown_set_text_font(Countdown *instance, const char *font_path)
Set the countdown font from a font file.
Definition countdown.c:104
void(* CountdownCallback)(void *context)
Countdown callback function type.
Definition countdown.h:36
void countdown_free(Countdown *instance)
Delete a Countdown instance.
Definition countdown.c:82
void countdown_begin(Countdown *instance, time_t time, CountdownDirection direction, CountdownShowHour hours)
Starts counting down (or up)
Definition countdown.c:116
Countdown * countdown_alloc(Widget *parent)
Create a new Countdown instance.
Definition countdown.c:72
void countdown_stop(Countdown *instance)
Stop counting.
Definition countdown.c:133
void countdown_set_callback(Countdown *instance, CountdownCallback callback, void *context)
Set a countdown callback.
Definition countdown.c:92
void countdown_set_text_color(Countdown *instance, Color color)
Set the countdown text color.
Definition countdown.c:98
Widget * countdown_get_base(Countdown *instance)
Get a pointer to the base class instance.
Definition countdown.c:87
GUI system APIs.
RGB color structure.
Definition color.h:42
Definition countdown.c:10
Definition widget_i.h:35
TIME (Simple Network Time Protocol) service API.
Base widget class.