blob: af70314605e54e2468fe774822cdeecd2945cc7c [file] [log] [blame]
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -03001#ifndef _PERF_UI_BROWSER_H_
2#define _PERF_UI_BROWSER_H_ 1
3
4#include <stdbool.h>
Arnaldo Carvalho de Melo211ef122010-08-10 14:54:09 -03005#include <sys/types.h>
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -03006#include "../types.h"
7
8#define HE_COLORSET_TOP 50
9#define HE_COLORSET_MEDIUM 51
10#define HE_COLORSET_NORMAL 52
11#define HE_COLORSET_SELECTED 53
12#define HE_COLORSET_CODE 54
Arnaldo Carvalho de Melo058b4cc2012-04-02 12:59:01 -030013#define HE_COLORSET_ADDR 55
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030014
15struct ui_browser {
Arnaldo Carvalho de Melod247eb62010-08-07 13:56:04 -030016 u64 index, top_idx;
17 void *top, *entries;
18 u16 y, x, width, height;
Arnaldo Carvalho de Melo08709162012-04-02 12:48:56 -030019 int current_color;
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030020 void *priv;
Arnaldo Carvalho de Melo3af6e332011-10-13 08:52:46 -030021 const char *title;
22 char *helpline;
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030023 unsigned int (*refresh)(struct ui_browser *self);
24 void (*write)(struct ui_browser *self, void *entry, int row);
25 void (*seek)(struct ui_browser *self, off_t offset, int whence);
Arnaldo Carvalho de Melo250611c2011-10-14 12:27:54 -030026 bool (*filter)(struct ui_browser *self, void *entry);
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030027 u32 nr_entries;
Arnaldo Carvalho de Meloc172f742011-10-18 14:31:35 -020028 bool navkeypressed;
29 bool use_navkeypressed;
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030030};
31
Arnaldo Carvalho de Melo08709162012-04-02 12:48:56 -030032int ui_browser__set_color(struct ui_browser *browser, int color);
Arnaldo Carvalho de Melo8f9bbc42010-08-11 14:51:47 -030033void ui_browser__set_percent_color(struct ui_browser *self,
34 double percent, bool current);
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030035bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row);
36void ui_browser__refresh_dimensions(struct ui_browser *self);
37void ui_browser__reset_index(struct ui_browser *self);
38
Arnaldo Carvalho de Melo8f9bbc42010-08-11 14:51:47 -030039void ui_browser__gotorc(struct ui_browser *self, int y, int x);
Arnaldo Carvalho de Melo59d038d2012-04-20 16:26:14 -030040void ui_browser__write_graph(struct ui_browser *browser, int graph);
Arnaldo Carvalho de Melo944e1ab2012-04-27 16:27:52 -030041void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column,
Arnaldo Carvalho de Melo83b1f2a2012-05-03 13:12:49 -030042 u64 start, u64 end);
Arnaldo Carvalho de Melob210b3b2011-02-25 11:33:31 -030043void __ui_browser__show_title(struct ui_browser *browser, const char *title);
44void ui_browser__show_title(struct ui_browser *browser, const char *title);
Arnaldo Carvalho de Melo59e8fe32010-08-10 15:44:20 -030045int ui_browser__show(struct ui_browser *self, const char *title,
46 const char *helpline, ...);
47void ui_browser__hide(struct ui_browser *self);
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030048int ui_browser__refresh(struct ui_browser *self);
Arnaldo Carvalho de Melo3af6e332011-10-13 08:52:46 -030049int ui_browser__run(struct ui_browser *browser, int delay_secs);
Arnaldo Carvalho de Melo900e14a2011-10-11 16:15:39 -030050void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries);
Arnaldo Carvalho de Melo4610e412011-10-26 12:04:37 -020051void ui_browser__handle_resize(struct ui_browser *browser);
Arnaldo Carvalho de Melo4656cca2012-05-03 13:07:05 -030052void __ui_browser__vline(struct ui_browser *browser, unsigned int column,
53 u16 start, u16 end);
Arnaldo Carvalho de Melo4610e412011-10-26 12:04:37 -020054
Arnaldo Carvalho de Melo7b275092011-10-29 12:15:04 -020055int ui_browser__warning(struct ui_browser *browser, int timeout,
56 const char *format, ...);
Arnaldo Carvalho de Melo4610e412011-10-26 12:04:37 -020057int ui_browser__help_window(struct ui_browser *browser, const char *text);
58bool ui_browser__dialog_yesno(struct ui_browser *browser, const char *text);
Namhyung Kimaa49f6e2012-03-16 17:50:52 +090059int ui_browser__input_window(const char *title, const char *text, char *input,
60 const char *exit_msg, int delay_sec);
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030061
Arnaldo Carvalho de Melo1056d3d2011-10-26 07:11:03 -020062void ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence);
63unsigned int ui_browser__argv_refresh(struct ui_browser *browser);
64
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030065void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence);
66unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self);
67
68void ui_browser__list_head_seek(struct ui_browser *self, off_t offset, int whence);
69unsigned int ui_browser__list_head_refresh(struct ui_browser *self);
70
71void ui_browser__init(void);
Arnaldo Carvalho de Meloc323cf02012-05-29 22:06:30 -030072void annotate_browser__init(void);
Arnaldo Carvalho de Meloef8f34a2010-08-06 17:35:02 -030073#endif /* _PERF_UI_BROWSER_H_ */