summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/printcell_helper.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib/printcell_helper.h')
-rw-r--r--apps/plugins/lib/printcell_helper.h68
1 files changed, 55 insertions, 13 deletions
diff --git a/apps/plugins/lib/printcell_helper.h b/apps/plugins/lib/printcell_helper.h
index adc98e5a5f..f58e73c0a5 100644
--- a/apps/plugins/lib/printcell_helper.h
+++ b/apps/plugins/lib/printcell_helper.h
@@ -21,25 +21,67 @@
21 21
22#ifndef _PRINTCELL_LIST_H_ 22#ifndef _PRINTCELL_LIST_H_
23#define _PRINTCELL_LIST_H_ 23#define _PRINTCELL_LIST_H_
24#ifndef PRINTCELL_MAX_COLUMNS
25#define PRINTCELL_MAX_COLUMNS 16 /* Max 32 (hidecol_flags)*/
26#endif
27
24#define PRINTCELL_MAXLINELEN MAX_PATH 28#define PRINTCELL_MAXLINELEN MAX_PATH
29#define PC_COL_FLAG(col) ((uint32_t)(col >= 0 \
30 && col < PRINTCELL_MAX_COLUMNS) ? 1u<<col : -1u)
31
32#define PRINTCELL_COLUMN_IS_VISIBLE(flag, col) ((flag & PC_COL_FLAG(col)) == 0)
33#define PRINTCELL_COLUMN_FLAG(col) (PC_COL_FLAG(col))
25 34
26/* sets the printcell function enabled */ 35struct printcell_settings
27void printcell_enable(struct gui_synclist *gui_list, bool enable, bool separator); 36{
37 bool cell_separator;
38 char title_delimeter;
39 char text_delimeter;
40 uint32_t hidecol_flags;
41};
28 42
29/* sets title and calculates cell widths each column is identified by '$' character 43/* Printcell initialization - Sets title and calculates cell widths
30 ex 3 columns title = "Col1$Col2$Col3" also accepts $*WIDTH$ 44* by default each column is identified by '$' character
31 ex 3 columns varying width title = "$*64$Col1$*128$Col2$Col3 45* ex 3 columns title = "Col1$Col2$Col3" also accepts $*WIDTH$
32 returns number of columns 46* ex 3 columns varying width title = "$*64$Col1$*128$Col2$Col3
47* supplying struct printcell_settings pcs allows changing default settings
48* supply NULL to use defaults
49*
50* Returns number of columns
33*/ 51*/
34int printcell_set_columns(struct gui_synclist *gui_list, 52int printcell_set_columns(struct gui_synclist *gui_list,
35 char * title, enum themable_icons icon); 53 struct printcell_settings * pcs,
54 char * title, enum themable_icons icon);
55
56/* Sets the printcell function enabled (use after initializing with set_column)
57 * Note you should call printcell_enable(false) if the list might be reused */
58void printcell_enable(bool enable);
36 59
37/* increments the current selected column negative increment is allowed 60/* Increments the current selected column negative increment is allowed
38 returns the selected column 61 returns the selected column
39 range: -1(no selection) to ncols - 1 */ 62 range: -1(no selection) to ncols - 1 */
40int printcell_increment_column(struct gui_synclist *gui_list, int increment, bool wrap); 63int printcell_increment_column(int increment, bool wrap);
64
65/* Return index of the currently selected column (-1 to ncols - 1) */
66int printcell_get_column_selected(void);
67
68/* Return the text of currently selected column buffer should be sized
69 * for max item len, buf[PRINTCELL_MAXLINELEN] is a safe bet */
70char *printcell_get_column_text(int selcol, char *buf, size_t bufsz);
41 71
42/* return the text of currently selected column buffer should be sized 72/* Return the text of currently selected column title should be sized
43 * for max item len, buf[PRINTCELL_MAXLINELEN] is a safe bet */ 73 * for max item len, buf[PRINTCELL_MAXLINELEN] is a safe bet */
44char *printcell_get_selected_column_text(struct gui_synclist *gui_list, char *buf, size_t bufsz); 74char *printcell_get_title_text(int selcol, char *buf, size_t bufsz);
75
76
77/* Hide or show a specified column - supply col = -1 to affect all columns */
78void printcell_set_column_visible(int col, bool visible);
79
80/* Return visibility of a specified column
81* returns (1 visible or 0 hidden)
82* if supply col == -1 a flag with visibility of all columns will be returned
83* NOTE: flag denotes a hidden column by a 1 in the column bit (1 << col#)
84* PRINTCELL_COLUMN_IS_VISIBLE(flag,col) macro will convert to bool
85*/
86uint32_t printcell_get_column_visibility(int col);
45#endif /*_PRINTCELL_LIST_H_*/ 87#endif /*_PRINTCELL_LIST_H_*/