-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.h
62 lines (47 loc) · 1.63 KB
/
ui.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Copyright (C) 2011 Przemyslaw Pawelczyk <[email protected]>
*
* This software is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2.
* See <http://www.gnu.org/licenses/gpl-2.0.txt>.
*
* This software is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/** \file ui.h
* User interface common stuff.
*/
#ifndef UI_H
#define UI_H
#include <inttypes.h>
/** UI operations that must be supported. */
typedef struct ui_ops {
/* log(char *format, ...) */
int (*log)(const char *, ...);
/**< Logs given message. */
/* yesno(char *format, ...) */
int (*yesno)(const char *, ...);
/**< Asks yes/no question. */
/* start_op(char *title, int steps_no) */
int (*start_op)(const char *, int);
/**< Informs about start of operation with given name and steps number. */
/* end_op() */
int (*end_op)();
/**< Informs about end of previously started operation. */
/* next_step(char *name) */
int (*next_step)(const char *);
/**< Informs about operation advancing to next step. */
/* set_step_prog_max(uint64_t max) */
int (*set_step_prog_max)(uint64_t);
/**< Sets current step highest possible progress value (1 by default). */
/* set_step_prog_val(uint64_t val) */
int (*set_step_prog_val)(uint64_t);
/**< Sets current step progress value. */
} ui_ops_t;
/** Chosen UI operations used by vidma. */
extern ui_ops_t *ui;
/** UI operations for CLI. */
extern ui_ops_t ui_cli;
#endif /* UI_H */