summaryrefslogtreecommitdiff
path: root/ui.h
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2017-01-19 01:09:03 +0200
committerTobias Klauser <tklauser@distanz.ch>2017-01-25 13:23:34 +0100
commit60648a858b83b63e8dbdd1c45bb901d1206ae444 (patch)
tree04e14eac4d7e81dd31305f0cac334a341609f6b0 /ui.h
parenta1351738ba11c8e2d38f6df5276cc59f7acb2d2f (diff)
flowtop: Add tab control to switch between tables
Add ui_tab API to create ui tab control to switch between different ui tables which may contain different aggregated info per unique pid/port/proto/dst/src. Meanwhile there is only 1 ui tab entry for flows table. Added some missing cds_list_{next,prev,last}_entry functions into urcu-list-compat.h header. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'ui.h')
-rw-r--r--ui.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/ui.h b/ui.h
index 9db3c08..40bf4f1 100644
--- a/ui.h
+++ b/ui.h
@@ -9,6 +9,7 @@
enum ui_event_id {
UI_EVT_SCROLL_LEFT,
UI_EVT_SCROLL_RIGHT,
+ UI_EVT_SELECT_NEXT,
};
enum ui_align {
@@ -25,7 +26,7 @@ struct ui_text {
struct ui_col {
struct cds_list_head entry;
uint32_t id;
- char *name;
+ const char *name;
uint32_t len;
int pos;
int color;
@@ -43,6 +44,25 @@ struct ui_table {
int width;
int height;
int scroll_x;
+ const char *delim;
+};
+
+struct ui_tab;
+
+enum ui_tab_event_t {
+ UI_TAB_EVT_OPEN,
+ UI_TAB_EVT_CLOSE,
+};
+
+typedef void (* ui_tab_event_cb) (struct ui_tab *tab, enum ui_tab_event_t evt,
+ uint32_t id);
+
+struct ui_tab {
+ struct ui_col *active;
+ struct ui_table tbl;
+ int color;
+
+ ui_tab_event_cb on_tab_event;
};
extern void ui_table_init(struct ui_table *tbl);
@@ -51,10 +71,11 @@ extern void ui_table_clear(struct ui_table *tbl);
extern void ui_table_pos_set(struct ui_table *tbl, int y, int x);
extern void ui_table_height_set(struct ui_table *tbl, int height);
-extern void ui_table_col_add(struct ui_table *tbl, uint32_t id, char *name,
+extern void ui_table_col_add(struct ui_table *tbl, uint32_t id, const char *name,
uint32_t len);
extern void ui_table_col_color_set(struct ui_table *tbl, int col_id, int color);
extern void ui_table_col_align_set(struct ui_table *tbl, int col_id, enum ui_align align);
+extern void ui_table_col_delim_set(struct ui_table *tbl, const char *delim);
extern void ui_table_row_add(struct ui_table *tbl);
extern void ui_table_row_show(struct ui_table *tbl);
@@ -66,4 +87,13 @@ extern void ui_table_header_print(struct ui_table *tbl);
extern void ui_table_event_send(struct ui_table *tbl, enum ui_event_id id);
+extern struct ui_tab *ui_tab_create(void);
+extern void ui_tab_destroy(struct ui_tab *tab);
+extern void ui_tab_pos_set(struct ui_tab *tab, int y, int x);
+extern void ui_tab_event_cb_set(struct ui_tab *tab, ui_tab_event_cb cb);
+extern void ui_tab_active_color_set(struct ui_tab *tab, int color);
+extern void ui_tab_show(struct ui_tab *tab);
+extern void ui_tab_entry_add(struct ui_tab *tab, uint32_t id, const char *name);
+extern void ui_tab_event_send(struct ui_tab *tab, uint32_t id);
+
#endif /* UI_H */