162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _PERF_UI_BROWSER_H_ 362306a36Sopenharmony_ci#define _PERF_UI_BROWSER_H_ 1 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <linux/types.h> 662306a36Sopenharmony_ci#include <stdarg.h> 762306a36Sopenharmony_ci#include <sys/types.h> 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#define HE_COLORSET_TOP 50 1062306a36Sopenharmony_ci#define HE_COLORSET_MEDIUM 51 1162306a36Sopenharmony_ci#define HE_COLORSET_NORMAL 52 1262306a36Sopenharmony_ci#define HE_COLORSET_SELECTED 53 1362306a36Sopenharmony_ci#define HE_COLORSET_JUMP_ARROWS 54 1462306a36Sopenharmony_ci#define HE_COLORSET_ADDR 55 1562306a36Sopenharmony_ci#define HE_COLORSET_ROOT 56 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_cistruct ui_browser { 1862306a36Sopenharmony_ci u64 index, top_idx; 1962306a36Sopenharmony_ci void *top, *entries; 2062306a36Sopenharmony_ci u16 y, x, width, height, rows, columns, horiz_scroll; 2162306a36Sopenharmony_ci u8 extra_title_lines; 2262306a36Sopenharmony_ci int current_color; 2362306a36Sopenharmony_ci void *priv; 2462306a36Sopenharmony_ci const char *title; 2562306a36Sopenharmony_ci char *helpline; 2662306a36Sopenharmony_ci const char *no_samples_msg; 2762306a36Sopenharmony_ci void (*refresh_dimensions)(struct ui_browser *browser); 2862306a36Sopenharmony_ci unsigned int (*refresh)(struct ui_browser *browser); 2962306a36Sopenharmony_ci void (*write)(struct ui_browser *browser, void *entry, int row); 3062306a36Sopenharmony_ci void (*seek)(struct ui_browser *browser, off_t offset, int whence); 3162306a36Sopenharmony_ci bool (*filter)(struct ui_browser *browser, void *entry); 3262306a36Sopenharmony_ci u32 nr_entries; 3362306a36Sopenharmony_ci bool navkeypressed; 3462306a36Sopenharmony_ci bool use_navkeypressed; 3562306a36Sopenharmony_ci}; 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ciint ui_browser__set_color(struct ui_browser *browser, int color); 3862306a36Sopenharmony_civoid ui_browser__set_percent_color(struct ui_browser *browser, 3962306a36Sopenharmony_ci double percent, bool current); 4062306a36Sopenharmony_cibool ui_browser__is_current_entry(struct ui_browser *browser, unsigned row); 4162306a36Sopenharmony_civoid ui_browser__refresh_dimensions(struct ui_browser *browser); 4262306a36Sopenharmony_civoid ui_browser__reset_index(struct ui_browser *browser); 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_civoid ui_browser__gotorc_title(struct ui_browser *browser, int y, int x); 4562306a36Sopenharmony_civoid ui_browser__gotorc(struct ui_browser *browser, int y, int x); 4662306a36Sopenharmony_civoid ui_browser__write_nstring(struct ui_browser *browser, const char *msg, 4762306a36Sopenharmony_ci unsigned int width); 4862306a36Sopenharmony_civoid ui_browser__vprintf(struct ui_browser *browser, const char *fmt, va_list args); 4962306a36Sopenharmony_civoid ui_browser__printf(struct ui_browser *browser, const char *fmt, ...); 5062306a36Sopenharmony_civoid ui_browser__write_graph(struct ui_browser *browser, int graph); 5162306a36Sopenharmony_civoid __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column, 5262306a36Sopenharmony_ci u64 start, u64 end); 5362306a36Sopenharmony_civoid ui_browser__mark_fused(struct ui_browser *browser, unsigned int column, 5462306a36Sopenharmony_ci unsigned int row, int diff, bool arrow_down); 5562306a36Sopenharmony_civoid __ui_browser__show_title(struct ui_browser *browser, const char *title); 5662306a36Sopenharmony_civoid ui_browser__show_title(struct ui_browser *browser, const char *title); 5762306a36Sopenharmony_ciint ui_browser__show(struct ui_browser *browser, const char *title, 5862306a36Sopenharmony_ci const char *helpline, ...); 5962306a36Sopenharmony_civoid ui_browser__hide(struct ui_browser *browser); 6062306a36Sopenharmony_ciint ui_browser__refresh(struct ui_browser *browser); 6162306a36Sopenharmony_ciint ui_browser__run(struct ui_browser *browser, int delay_secs); 6262306a36Sopenharmony_civoid ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries); 6362306a36Sopenharmony_civoid ui_browser__handle_resize(struct ui_browser *browser); 6462306a36Sopenharmony_civoid __ui_browser__vline(struct ui_browser *browser, unsigned int column, 6562306a36Sopenharmony_ci u16 start, u16 end); 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ciint ui_browser__warning(struct ui_browser *browser, int timeout, 6862306a36Sopenharmony_ci const char *format, ...); 6962306a36Sopenharmony_ciint ui_browser__help_window(struct ui_browser *browser, const char *text); 7062306a36Sopenharmony_cibool ui_browser__dialog_yesno(struct ui_browser *browser, const char *text); 7162306a36Sopenharmony_ciint ui_browser__input_window(const char *title, const char *text, char *input, 7262306a36Sopenharmony_ci const char *exit_msg, int delay_sec); 7362306a36Sopenharmony_cistruct perf_env; 7462306a36Sopenharmony_ciint tui__header_window(struct perf_env *env); 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_civoid ui_browser__argv_seek(struct ui_browser *browser, off_t offset, int whence); 7762306a36Sopenharmony_ciunsigned int ui_browser__argv_refresh(struct ui_browser *browser); 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_civoid ui_browser__rb_tree_seek(struct ui_browser *browser, off_t offset, int whence); 8062306a36Sopenharmony_ciunsigned int ui_browser__rb_tree_refresh(struct ui_browser *browser); 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_civoid ui_browser__list_head_seek(struct ui_browser *browser, off_t offset, int whence); 8362306a36Sopenharmony_ciunsigned int ui_browser__list_head_refresh(struct ui_browser *browser); 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_civoid ui_browser__init(void); 8662306a36Sopenharmony_ci#endif /* _PERF_UI_BROWSER_H_ */ 87