browser.h 1.5 KB

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