browser.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef _PERF_UI_BROWSER_H_
  2. #define _PERF_UI_BROWSER_H_ 1
  3. #include <stdbool.h>
  4. #include <newt.h>
  5. #include "../types.h"
  6. #define HE_COLORSET_TOP 50
  7. #define HE_COLORSET_MEDIUM 51
  8. #define HE_COLORSET_NORMAL 52
  9. #define HE_COLORSET_SELECTED 53
  10. #define HE_COLORSET_CODE 54
  11. struct ui_browser {
  12. newtComponent form, sb;
  13. u64 index, top_idx;
  14. void *top, *entries;
  15. u16 y, x, width, height;
  16. void *priv;
  17. unsigned int (*refresh)(struct ui_browser *self);
  18. void (*write)(struct ui_browser *self, void *entry, int row);
  19. void (*seek)(struct ui_browser *self, off_t offset, int whence);
  20. u32 nr_entries;
  21. };
  22. int ui_browser__percent_color(double percent, bool current);
  23. bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row);
  24. void ui_browser__refresh_dimensions(struct ui_browser *self);
  25. void ui_browser__reset_index(struct ui_browser *self);
  26. int ui_browser__show(struct ui_browser *self, const char *title);
  27. int ui_browser__refresh(struct ui_browser *self);
  28. int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es);
  29. void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence);
  30. unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self);
  31. void ui_browser__list_head_seek(struct ui_browser *self, off_t offset, int whence);
  32. unsigned int ui_browser__list_head_refresh(struct ui_browser *self);
  33. void ui_browser__init(void);
  34. #endif /* _PERF_UI_BROWSER_H_ */