blob: 70057178ee34873dd22f53885a4c5b1372b7c786 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -03002#ifndef _PERF_UI_BROWSER_H_
3#define _PERF_UI_BROWSER_H_ 1
4
Borislav Petkovd944c4e2014-04-25 21:31:02 +02005#include <linux/types.h>
Arnaldo Carvalho de Meloc5220242018-03-15 17:52:53 -03006#include <stdarg.h>
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -03007
8#define HE_COLORSET_TOP 50
9#define HE_COLORSET_MEDIUM 51
10#define HE_COLORSET_NORMAL 52
11#define HE_COLORSET_SELECTED 53
Taeung Song78ce08d2016-01-08 17:16:11 +090012#define HE_COLORSET_JUMP_ARROWS 54
Arnaldo Carvalho de Melo058b4cc2012-04-02 12:59:01 -030013#define HE_COLORSET_ADDR 55
Arnaldo Carvalho de Melo6692c262013-03-28 11:34:10 -030014#define HE_COLORSET_ROOT 56
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030015
16struct ui_browser {
Arnaldo Carvalho de Melod247eb62010-08-07 13:56:04 -030017 u64 index, top_idx;
18 void *top, *entries;
Arnaldo Carvalho de Melofaae6f62015-08-11 17:14:40 -030019 u16 y, x, width, height, rows, columns, horiz_scroll;
Arnaldo Carvalho de Melo08709162012-04-02 12:48:56 -030020 int current_color;
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030021 void *priv;
Arnaldo Carvalho de Melo3af6e332011-10-13 08:52:46 -030022 const char *title;
23 char *helpline;
Arnaldo Carvalho de Melofa70b5d2014-07-01 16:34:42 -030024 void (*refresh_dimensions)(struct ui_browser *browser);
Arnaldo Carvalho de Melo316c7132013-11-05 15:32:36 -030025 unsigned int (*refresh)(struct ui_browser *browser);
26 void (*write)(struct ui_browser *browser, void *entry, int row);
27 void (*seek)(struct ui_browser *browser, off_t offset, int whence);
28 bool (*filter)(struct ui_browser *browser, void *entry);
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030029 u32 nr_entries;
Arnaldo Carvalho de Meloc172f742011-10-18 14:31:35 -020030 bool navkeypressed;
31 bool use_navkeypressed;
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030032};
33
Arnaldo Carvalho de Melo08709162012-04-02 12:48:56 -030034int ui_browser__set_color(struct ui_browser *browser, int color);
Arnaldo Carvalho de Melo316c7132013-11-05 15:32:36 -030035void ui_browser__set_percent_color(struct ui_browser *browser,
Arnaldo Carvalho de Melo8f9bbc42010-08-11 14:51:47 -030036 double percent, bool current);
Arnaldo Carvalho de Melo316c7132013-11-05 15:32:36 -030037bool ui_browser__is_current_entry(struct ui_browser *browser, unsigned row);
38void ui_browser__refresh_dimensions(struct ui_browser *browser);
39void ui_browser__reset_index(struct ui_browser *browser);
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030040
Arnaldo Carvalho de Melo316c7132013-11-05 15:32:36 -030041void ui_browser__gotorc(struct ui_browser *browser, int y, int x);
Arnaldo Carvalho de Melo26270a02015-08-11 12:24:27 -030042void ui_browser__write_nstring(struct ui_browser *browser, const char *msg,
43 unsigned int width);
Arnaldo Carvalho de Meloc5220242018-03-15 17:52:53 -030044void ui_browser__vprintf(struct ui_browser *browser, const char *fmt, va_list args);
Arnaldo Carvalho de Melo517dfdb2015-08-11 12:50:55 -030045void ui_browser__printf(struct ui_browser *browser, const char *fmt, ...);
Arnaldo Carvalho de Melo59d038d2012-04-20 16:26:14 -030046void ui_browser__write_graph(struct ui_browser *browser, int graph);
Arnaldo Carvalho de Melo944e1ab2012-04-27 16:27:52 -030047void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column,
Arnaldo Carvalho de Melo83b1f2a2012-05-03 13:12:49 -030048 u64 start, u64 end);
Jin Yao7e63a132017-07-07 13:06:35 +080049void ui_browser__mark_fused(struct ui_browser *browser, unsigned int column,
50 unsigned int row, bool arrow_down);
Arnaldo Carvalho de Melob210b3b2011-02-25 11:33:31 -030051void __ui_browser__show_title(struct ui_browser *browser, const char *title);
52void ui_browser__show_title(struct ui_browser *browser, const char *title);
Arnaldo Carvalho de Melo316c7132013-11-05 15:32:36 -030053int ui_browser__show(struct ui_browser *browser, const char *title,
Arnaldo Carvalho de Melo59e8fe32010-08-10 15:44:20 -030054 const char *helpline, ...);
Arnaldo Carvalho de Melo316c7132013-11-05 15:32:36 -030055void ui_browser__hide(struct ui_browser *browser);
56int ui_browser__refresh(struct ui_browser *browser);
Arnaldo Carvalho de Melo3af6e332011-10-13 08:52:46 -030057int ui_browser__run(struct ui_browser *browser, int delay_secs);
Arnaldo Carvalho de Melo900e14a2011-10-11 16:15:39 -030058void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries);
Arnaldo Carvalho de Melo4610e412011-10-26 12:04:37 -020059void ui_browser__handle_resize(struct ui_browser *browser);
Arnaldo Carvalho de Melo4656cca2012-05-03 13:07:05 -030060void __ui_browser__vline(struct ui_browser *browser, unsigned int column,
61 u16 start, u16 end);
Arnaldo Carvalho de Melo4610e412011-10-26 12:04:37 -020062
Arnaldo Carvalho de Melo7b275092011-10-29 12:15:04 -020063int ui_browser__warning(struct ui_browser *browser, int timeout,
64 const char *format, ...);
Arnaldo Carvalho de Melo4610e412011-10-26 12:04:37 -020065int ui_browser__help_window(struct ui_browser *browser, const char *text);
66bool ui_browser__dialog_yesno(struct ui_browser *browser, const char *text);
Namhyung Kimaa49f6e2012-03-16 17:50:52 +090067int ui_browser__input_window(const char *title, const char *text, char *input,
68 const char *exit_msg, int delay_sec);
Kan Liangce80d3b2015-08-28 05:48:04 -040069struct perf_env;
70int tui__header_window(struct perf_env *env);
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030071
Arnaldo Carvalho de Melo1056d3d2011-10-26 07:11:03 -020072void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence);
73unsigned int ui_browser__argv_refresh(struct ui_browser *browser);
74
Arnaldo Carvalho de Melo316c7132013-11-05 15:32:36 -030075void ui_browser__rb_tree_seek(struct ui_browser *browser, off_t offset, int whence);
76unsigned int ui_browser__rb_tree_refresh(struct ui_browser *browser);
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030077
Arnaldo Carvalho de Melo316c7132013-11-05 15:32:36 -030078void ui_browser__list_head_seek(struct ui_browser *browser, off_t offset, int whence);
79unsigned int ui_browser__list_head_refresh(struct ui_browser *browser);
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030080
81void ui_browser__init(void);
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030082#endif /* _PERF_UI_BROWSER_H_ */