[A] Added new style
This commit is contained in:
parent
50774eb359
commit
610a425508
BIN
docs/images/color_table.png
Normal file
BIN
docs/images/color_table.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
@ -152,7 +152,7 @@ void colorfull_table(void)
|
|||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
|
|
||||||
ft_table_t *table = ft_create_table();
|
ft_table_t *table = ft_create_table();
|
||||||
ft_set_border_style(table, FT_DOUBLE_STYLE);
|
ft_set_border_style(table, FT_NICE_STYLE);
|
||||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||||
|
|
||||||
/* Filling table with data */
|
/* Filling table with data */
|
||||||
@ -170,7 +170,6 @@ void colorfull_table(void)
|
|||||||
ft_set_cell_span(table, 8, 0, 4);
|
ft_set_cell_span(table, 8, 0, 4);
|
||||||
ft_wwrite_ln(table, L"Total result", L"", L"", L"", L"✖");
|
ft_wwrite_ln(table, L"Total result", L"", L"", L"", L"✖");
|
||||||
|
|
||||||
|
|
||||||
/* Setting text styles */
|
/* Setting text styles */
|
||||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_CONT_TEXT_STYLE, FT_TSTYLE_BOLD);
|
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_CONT_TEXT_STYLE, FT_TSTYLE_BOLD);
|
||||||
ft_set_cell_prop(table, 8, FT_ANY_COLUMN, FT_CPROP_CONT_TEXT_STYLE, FT_TSTYLE_BOLD);
|
ft_set_cell_prop(table, 8, FT_ANY_COLUMN, FT_CPROP_CONT_TEXT_STYLE, FT_TSTYLE_BOLD);
|
||||||
@ -178,7 +177,6 @@ void colorfull_table(void)
|
|||||||
ft_set_cell_prop(table, FT_ANY_ROW, 4, FT_CPROP_CONT_TEXT_STYLE, FT_TSTYLE_BOLD);
|
ft_set_cell_prop(table, FT_ANY_ROW, 4, FT_CPROP_CONT_TEXT_STYLE, FT_TSTYLE_BOLD);
|
||||||
ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_CONT_TEXT_STYLE, FT_TSTYLE_ITALIC);
|
ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_CONT_TEXT_STYLE, FT_TSTYLE_ITALIC);
|
||||||
|
|
||||||
|
|
||||||
/* Set alignment */
|
/* Set alignment */
|
||||||
ft_set_cell_prop(table, FT_ANY_ROW, 1, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_RIGHT);
|
ft_set_cell_prop(table, FT_ANY_ROW, 1, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_RIGHT);
|
||||||
ft_set_cell_prop(table, FT_ANY_ROW, 2, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_RIGHT);
|
ft_set_cell_prop(table, FT_ANY_ROW, 2, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_RIGHT);
|
||||||
@ -195,9 +193,13 @@ void colorfull_table(void)
|
|||||||
ft_set_cell_prop(table, 4, 3, FT_CPROP_CONT_BG_COLOR, FT_COLOR_LIGHT_RED);
|
ft_set_cell_prop(table, 4, 3, FT_CPROP_CONT_BG_COLOR, FT_COLOR_LIGHT_RED);
|
||||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_CONT_FG_COLOR, FT_COLOR_LIGHT_BLUE);
|
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_CONT_FG_COLOR, FT_COLOR_LIGHT_BLUE);
|
||||||
|
|
||||||
|
/* Move table to the center of the screen */
|
||||||
|
ft_set_tbl_prop(table, FT_TPROP_TOP_MARGIN, 1);
|
||||||
|
ft_set_tbl_prop(table, FT_TPROP_LEFT_MARGIN, 10);
|
||||||
|
|
||||||
const wchar_t *table_wstr = ft_to_wstring(table);
|
const wchar_t *table_wstr = ft_to_wstring(table);
|
||||||
if (table_wstr) {
|
if (table_wstr) {
|
||||||
fwprintf(stderr, L"Table:\n%ls\n ", table_wstr);
|
fwprintf(stderr, L"Table:\n%ls\n\n ", table_wstr);
|
||||||
} else {
|
} else {
|
||||||
fwprintf(stderr, L"Table conversion failed !!!\n ");
|
fwprintf(stderr, L"Table conversion failed !!!\n ");
|
||||||
}
|
}
|
||||||
|
29
lib/fort.c
29
lib/fort.c
@ -535,6 +535,7 @@ extern struct fort_border_style FORT_DOT_STYLE;
|
|||||||
extern struct fort_border_style FORT_EMPTY_STYLE;
|
extern struct fort_border_style FORT_EMPTY_STYLE;
|
||||||
extern struct fort_border_style FORT_SOLID_STYLE;
|
extern struct fort_border_style FORT_SOLID_STYLE;
|
||||||
extern struct fort_border_style FORT_SOLID_ROUND_STYLE;
|
extern struct fort_border_style FORT_SOLID_ROUND_STYLE;
|
||||||
|
extern struct fort_border_style FORT_NICE_STYLE;
|
||||||
extern struct fort_border_style FORT_DOUBLE_STYLE;
|
extern struct fort_border_style FORT_DOUBLE_STYLE;
|
||||||
extern struct fort_border_style FORT_DOUBLE2_STYLE;
|
extern struct fort_border_style FORT_DOUBLE2_STYLE;
|
||||||
extern struct fort_border_style FORT_BOLD_STYLE;
|
extern struct fort_border_style FORT_BOLD_STYLE;
|
||||||
@ -1490,6 +1491,29 @@ fort_status_t set_default_cell_property(uint32_t property, int value)
|
|||||||
}, \
|
}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define NICE_STYLE { \
|
||||||
|
/* border_chars */ \
|
||||||
|
{ \
|
||||||
|
"╔", "═", "╦", "╗", \
|
||||||
|
"║", "║", "║", \
|
||||||
|
"", "", "", "", \
|
||||||
|
"╚", "═", "╩", "╝", \
|
||||||
|
"┣", "┻", "┣", "┳", \
|
||||||
|
}, \
|
||||||
|
/* header_border_chars */ \
|
||||||
|
{ \
|
||||||
|
"╔", "═", "╦", "╗", \
|
||||||
|
"║", "║", "║", \
|
||||||
|
"╠", "═", "╬", "╣", \
|
||||||
|
"╚", "═", "╩", "╝", \
|
||||||
|
"┣", "╦", "┣", "╩", \
|
||||||
|
}, \
|
||||||
|
/* separator_chars */ \
|
||||||
|
{ \
|
||||||
|
"╟", "─", "╫", "╢", \
|
||||||
|
"╥", "╨", \
|
||||||
|
}, \
|
||||||
|
}
|
||||||
|
|
||||||
#define DOUBLE_STYLE { \
|
#define DOUBLE_STYLE { \
|
||||||
/* border_chars */ \
|
/* border_chars */ \
|
||||||
@ -1516,6 +1540,8 @@ fort_status_t set_default_cell_property(uint32_t property, int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define DOUBLE2_STYLE { \
|
#define DOUBLE2_STYLE { \
|
||||||
/* border_chars */ \
|
/* border_chars */ \
|
||||||
{ \
|
{ \
|
||||||
@ -1622,6 +1648,7 @@ struct fort_border_style FORT_DOT_STYLE = DOT_STYLE;
|
|||||||
struct fort_border_style FORT_EMPTY_STYLE = EMPTY_STYLE;
|
struct fort_border_style FORT_EMPTY_STYLE = EMPTY_STYLE;
|
||||||
struct fort_border_style FORT_SOLID_STYLE = SOLID_STYLE;
|
struct fort_border_style FORT_SOLID_STYLE = SOLID_STYLE;
|
||||||
struct fort_border_style FORT_SOLID_ROUND_STYLE = SOLID_ROUND_STYLE;
|
struct fort_border_style FORT_SOLID_ROUND_STYLE = SOLID_ROUND_STYLE;
|
||||||
|
struct fort_border_style FORT_NICE_STYLE = NICE_STYLE;
|
||||||
struct fort_border_style FORT_DOUBLE_STYLE = DOUBLE_STYLE;
|
struct fort_border_style FORT_DOUBLE_STYLE = DOUBLE_STYLE;
|
||||||
struct fort_border_style FORT_DOUBLE2_STYLE = DOUBLE2_STYLE;
|
struct fort_border_style FORT_DOUBLE2_STYLE = DOUBLE2_STYLE;
|
||||||
struct fort_border_style FORT_BOLD_STYLE = BOLD_STYLE;
|
struct fort_border_style FORT_BOLD_STYLE = BOLD_STYLE;
|
||||||
@ -2919,6 +2946,7 @@ struct ft_border_style *FT_DOT_STYLE = (struct ft_border_style *) &FORT_DOT_STYL
|
|||||||
struct ft_border_style *FT_EMPTY_STYLE = (struct ft_border_style *) &FORT_EMPTY_STYLE;
|
struct ft_border_style *FT_EMPTY_STYLE = (struct ft_border_style *) &FORT_EMPTY_STYLE;
|
||||||
struct ft_border_style *FT_SOLID_STYLE = (struct ft_border_style *) &FORT_SOLID_STYLE;
|
struct ft_border_style *FT_SOLID_STYLE = (struct ft_border_style *) &FORT_SOLID_STYLE;
|
||||||
struct ft_border_style *FT_SOLID_ROUND_STYLE = (struct ft_border_style *) &FORT_SOLID_ROUND_STYLE;
|
struct ft_border_style *FT_SOLID_ROUND_STYLE = (struct ft_border_style *) &FORT_SOLID_ROUND_STYLE;
|
||||||
|
struct ft_border_style *FT_NICE_STYLE = (struct ft_border_style *) &FORT_NICE_STYLE;
|
||||||
struct ft_border_style *FT_DOUBLE_STYLE = (struct ft_border_style *) &FORT_DOUBLE_STYLE;
|
struct ft_border_style *FT_DOUBLE_STYLE = (struct ft_border_style *) &FORT_DOUBLE_STYLE;
|
||||||
struct ft_border_style *FT_DOUBLE2_STYLE = (struct ft_border_style *) &FORT_DOUBLE2_STYLE;
|
struct ft_border_style *FT_DOUBLE2_STYLE = (struct ft_border_style *) &FORT_DOUBLE2_STYLE;
|
||||||
struct ft_border_style *FT_BOLD_STYLE = (struct ft_border_style *) &FORT_BOLD_STYLE;
|
struct ft_border_style *FT_BOLD_STYLE = (struct ft_border_style *) &FORT_BOLD_STYLE;
|
||||||
@ -2937,6 +2965,7 @@ static void set_border_props_for_props(fort_table_properties_t *properties, cons
|
|||||||
|| (struct fort_border_style *)style == &FORT_EMPTY_STYLE
|
|| (struct fort_border_style *)style == &FORT_EMPTY_STYLE
|
||||||
|| (struct fort_border_style *)style == &FORT_SOLID_STYLE
|
|| (struct fort_border_style *)style == &FORT_SOLID_STYLE
|
||||||
|| (struct fort_border_style *)style == &FORT_SOLID_ROUND_STYLE
|
|| (struct fort_border_style *)style == &FORT_SOLID_ROUND_STYLE
|
||||||
|
|| (struct fort_border_style *)style == &FORT_NICE_STYLE
|
||||||
|| (struct fort_border_style *)style == &FORT_DOUBLE_STYLE
|
|| (struct fort_border_style *)style == &FORT_DOUBLE_STYLE
|
||||||
|| (struct fort_border_style *)style == &FORT_DOUBLE2_STYLE
|
|| (struct fort_border_style *)style == &FORT_DOUBLE2_STYLE
|
||||||
|| (struct fort_border_style *)style == &FORT_BOLD_STYLE
|
|| (struct fort_border_style *)style == &FORT_BOLD_STYLE
|
||||||
|
@ -624,6 +624,7 @@ extern struct ft_border_style *FT_DOT_STYLE;
|
|||||||
extern struct ft_border_style *FT_EMPTY_STYLE;
|
extern struct ft_border_style *FT_EMPTY_STYLE;
|
||||||
extern struct ft_border_style *FT_SOLID_STYLE;
|
extern struct ft_border_style *FT_SOLID_STYLE;
|
||||||
extern struct ft_border_style *FT_SOLID_ROUND_STYLE;
|
extern struct ft_border_style *FT_SOLID_ROUND_STYLE;
|
||||||
|
extern struct ft_border_style *FT_NICE_STYLE;
|
||||||
extern struct ft_border_style *FT_DOUBLE_STYLE;
|
extern struct ft_border_style *FT_DOUBLE_STYLE;
|
||||||
extern struct ft_border_style *FT_DOUBLE2_STYLE;
|
extern struct ft_border_style *FT_DOUBLE2_STYLE;
|
||||||
extern struct ft_border_style *FT_BOLD_STYLE;
|
extern struct ft_border_style *FT_BOLD_STYLE;
|
||||||
|
@ -836,6 +836,7 @@ struct ft_border_style *FT_DOT_STYLE = (struct ft_border_style *) &FORT_DOT_STYL
|
|||||||
struct ft_border_style *FT_EMPTY_STYLE = (struct ft_border_style *) &FORT_EMPTY_STYLE;
|
struct ft_border_style *FT_EMPTY_STYLE = (struct ft_border_style *) &FORT_EMPTY_STYLE;
|
||||||
struct ft_border_style *FT_SOLID_STYLE = (struct ft_border_style *) &FORT_SOLID_STYLE;
|
struct ft_border_style *FT_SOLID_STYLE = (struct ft_border_style *) &FORT_SOLID_STYLE;
|
||||||
struct ft_border_style *FT_SOLID_ROUND_STYLE = (struct ft_border_style *) &FORT_SOLID_ROUND_STYLE;
|
struct ft_border_style *FT_SOLID_ROUND_STYLE = (struct ft_border_style *) &FORT_SOLID_ROUND_STYLE;
|
||||||
|
struct ft_border_style *FT_NICE_STYLE = (struct ft_border_style *) &FORT_NICE_STYLE;
|
||||||
struct ft_border_style *FT_DOUBLE_STYLE = (struct ft_border_style *) &FORT_DOUBLE_STYLE;
|
struct ft_border_style *FT_DOUBLE_STYLE = (struct ft_border_style *) &FORT_DOUBLE_STYLE;
|
||||||
struct ft_border_style *FT_DOUBLE2_STYLE = (struct ft_border_style *) &FORT_DOUBLE2_STYLE;
|
struct ft_border_style *FT_DOUBLE2_STYLE = (struct ft_border_style *) &FORT_DOUBLE2_STYLE;
|
||||||
struct ft_border_style *FT_BOLD_STYLE = (struct ft_border_style *) &FORT_BOLD_STYLE;
|
struct ft_border_style *FT_BOLD_STYLE = (struct ft_border_style *) &FORT_BOLD_STYLE;
|
||||||
@ -854,6 +855,7 @@ static void set_border_props_for_props(fort_table_properties_t *properties, cons
|
|||||||
|| (struct fort_border_style *)style == &FORT_EMPTY_STYLE
|
|| (struct fort_border_style *)style == &FORT_EMPTY_STYLE
|
||||||
|| (struct fort_border_style *)style == &FORT_SOLID_STYLE
|
|| (struct fort_border_style *)style == &FORT_SOLID_STYLE
|
||||||
|| (struct fort_border_style *)style == &FORT_SOLID_ROUND_STYLE
|
|| (struct fort_border_style *)style == &FORT_SOLID_ROUND_STYLE
|
||||||
|
|| (struct fort_border_style *)style == &FORT_NICE_STYLE
|
||||||
|| (struct fort_border_style *)style == &FORT_DOUBLE_STYLE
|
|| (struct fort_border_style *)style == &FORT_DOUBLE_STYLE
|
||||||
|| (struct fort_border_style *)style == &FORT_DOUBLE2_STYLE
|
|| (struct fort_border_style *)style == &FORT_DOUBLE2_STYLE
|
||||||
|| (struct fort_border_style *)style == &FORT_BOLD_STYLE
|
|| (struct fort_border_style *)style == &FORT_BOLD_STYLE
|
||||||
|
@ -696,6 +696,29 @@ fort_status_t set_default_cell_property(uint32_t property, int value)
|
|||||||
}, \
|
}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define NICE_STYLE { \
|
||||||
|
/* border_chars */ \
|
||||||
|
{ \
|
||||||
|
"╔", "═", "╦", "╗", \
|
||||||
|
"║", "║", "║", \
|
||||||
|
"", "", "", "", \
|
||||||
|
"╚", "═", "╩", "╝", \
|
||||||
|
"┣", "┻", "┣", "┳", \
|
||||||
|
}, \
|
||||||
|
/* header_border_chars */ \
|
||||||
|
{ \
|
||||||
|
"╔", "═", "╦", "╗", \
|
||||||
|
"║", "║", "║", \
|
||||||
|
"╠", "═", "╬", "╣", \
|
||||||
|
"╚", "═", "╩", "╝", \
|
||||||
|
"┣", "╦", "┣", "╩", \
|
||||||
|
}, \
|
||||||
|
/* separator_chars */ \
|
||||||
|
{ \
|
||||||
|
"╟", "─", "╫", "╢", \
|
||||||
|
"╥", "╨", \
|
||||||
|
}, \
|
||||||
|
}
|
||||||
|
|
||||||
#define DOUBLE_STYLE { \
|
#define DOUBLE_STYLE { \
|
||||||
/* border_chars */ \
|
/* border_chars */ \
|
||||||
@ -722,6 +745,8 @@ fort_status_t set_default_cell_property(uint32_t property, int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define DOUBLE2_STYLE { \
|
#define DOUBLE2_STYLE { \
|
||||||
/* border_chars */ \
|
/* border_chars */ \
|
||||||
{ \
|
{ \
|
||||||
@ -828,6 +853,7 @@ struct fort_border_style FORT_DOT_STYLE = DOT_STYLE;
|
|||||||
struct fort_border_style FORT_EMPTY_STYLE = EMPTY_STYLE;
|
struct fort_border_style FORT_EMPTY_STYLE = EMPTY_STYLE;
|
||||||
struct fort_border_style FORT_SOLID_STYLE = SOLID_STYLE;
|
struct fort_border_style FORT_SOLID_STYLE = SOLID_STYLE;
|
||||||
struct fort_border_style FORT_SOLID_ROUND_STYLE = SOLID_ROUND_STYLE;
|
struct fort_border_style FORT_SOLID_ROUND_STYLE = SOLID_ROUND_STYLE;
|
||||||
|
struct fort_border_style FORT_NICE_STYLE = NICE_STYLE;
|
||||||
struct fort_border_style FORT_DOUBLE_STYLE = DOUBLE_STYLE;
|
struct fort_border_style FORT_DOUBLE_STYLE = DOUBLE_STYLE;
|
||||||
struct fort_border_style FORT_DOUBLE2_STYLE = DOUBLE2_STYLE;
|
struct fort_border_style FORT_DOUBLE2_STYLE = DOUBLE2_STYLE;
|
||||||
struct fort_border_style FORT_BOLD_STYLE = BOLD_STYLE;
|
struct fort_border_style FORT_BOLD_STYLE = BOLD_STYLE;
|
||||||
|
@ -162,6 +162,7 @@ extern struct fort_border_style FORT_DOT_STYLE;
|
|||||||
extern struct fort_border_style FORT_EMPTY_STYLE;
|
extern struct fort_border_style FORT_EMPTY_STYLE;
|
||||||
extern struct fort_border_style FORT_SOLID_STYLE;
|
extern struct fort_border_style FORT_SOLID_STYLE;
|
||||||
extern struct fort_border_style FORT_SOLID_ROUND_STYLE;
|
extern struct fort_border_style FORT_SOLID_ROUND_STYLE;
|
||||||
|
extern struct fort_border_style FORT_NICE_STYLE;
|
||||||
extern struct fort_border_style FORT_DOUBLE_STYLE;
|
extern struct fort_border_style FORT_DOUBLE_STYLE;
|
||||||
extern struct fort_border_style FORT_DOUBLE2_STYLE;
|
extern struct fort_border_style FORT_DOUBLE2_STYLE;
|
||||||
extern struct fort_border_style FORT_BOLD_STYLE;
|
extern struct fort_border_style FORT_BOLD_STYLE;
|
||||||
|
Loading…
Reference in New Issue
Block a user