aboutsummaryrefslogtreecommitdiff
path: root/ui_ani.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui_ani.c')
-rw-r--r--ui_ani.c73
1 files changed, 0 insertions, 73 deletions
diff --git a/ui_ani.c b/ui_ani.c
deleted file mode 100644
index d38e090..0000000
--- a/ui_ani.c
+++ /dev/null
@@ -1,73 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-
-#include "ui.h"
-#include "ui_ani.h"
-
-#define ANIC_INITSTATE '|'
-
-
-struct anic *
-init_anic(unsigned int x, unsigned int y, chtype attrs, char *fmt)
-{
- struct anic *a = calloc(1, sizeof(struct anic));
-
- a->x = x;
- a->y = y;
- a->state = ANIC_INITSTATE;
- a->attrs = attrs;
- if (fmt != NULL) {
- a->fmt = strdup(fmt);
- }
- return (a);
-}
-
-void
-free_anic(struct anic *a)
-{
- if (a->fmt != NULL) {
- free(a->fmt);
- }
- free(a);
-}
-
-int
-anic_cb(WINDOW *win, void *data, bool timed_out)
-{
- struct anic *a = (struct anic *) data;
- char *tmp;
- int retval = UICB_OK;
-
- if (a == NULL) return (UICB_ERR_UNDEF);
- if (timed_out == true) {
- switch (a->state) {
- default:
- case '|': a->state = '/'; break;
- case '/': a->state = '-'; break;
- case '-': a->state = '\\'; break;
- case '\\': a->state = '|'; break;
- }
- }
- attron(a->attrs);
- if (a->fmt != NULL) {
- if (asprintf(&tmp, a->fmt, a->state) <= 0) {
- retval = UICB_ERR_BUF;
- }
- } else {
- asprintf(&tmp, "%c", a->state);
- }
- if (win != NULL) {
- mvwprintw(win, a->y, a->x, tmp);
- } else {
- mvprintw(a->y, a->x, tmp);
- }
- free(tmp);
- attroff(a->attrs);
- return (retval);
-}
-
-void
-register_anic(struct anic *a)
-{
- register_ui_elt(anic_cb, (void *) a, NULL);
-}