~nloomans/ft_select

ref: 9783305a370e42cdcc43c542a2172cc8b95e8b9b ft_select/inc/derive.h -rw-r--r-- 1.1 KiB
9783305aNoah Loomans confirm selection by pressing return 1 year, 10 months ago
                                                                                
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
#ifndef DERIVE_H
# define DERIVE_H

#include "state.h"
#include "error.h"

/*
** empty line followed by a vertical bar
*/
# define DERIVE_PADDING_TOP 2
/*
** vertical bar followed by an empty line
*/
# define DERIVE_PADDING_BOTTOM 2
/*
** 2 spaces followed by a horizontal bar followed by a single space
*/
# define DERIVE_PADDING_LEFT 4
/*
** single space followed by a horizontal bar followed by 2 spaces
*/
# define DERIVE_PADDING_RIGHT 4
/*
** Either '  ', '[ ', or '[*'
*/
# define DERIVE_OPTION_PADDING_LEFT 2
/*
** Either ' ', ']'
*/
# define DERIVE_OPTION_PADDING_RIGHT 1

struct	s_derived_dimensions
{
	size_t	rows;
	size_t	columns;
};

t_error	derive_dimensions(
			struct s_derived_dimensions *res,
			struct s_state_terminal terminal,
			t_list2 options);
t_error	derive_column_width(
			size_t **res,
			struct s_derived_dimensions dimensions,
			t_list2 options);
t_error	derive_rows(
			struct s_state_option ****res,
			struct s_derived_dimensions dimensions,
			t_list2 options);
void	derive_free_rows(
			struct s_derived_dimensions dimensions,
			struct s_state_option ****rows);

#endif