browser.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. void ui_browser__set_color(struct ui_browser *self, int color);
  24. void ui_browser__set_percent_color(struct ui_browser *self,
  25. double percent, bool current);
  26. bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row);
  27. void ui_browser__refresh_dimensions(struct ui_browser *self);
  28. void ui_browser__reset_index(struct ui_browser *self);
  29. void ui_browser__gotorc(struct ui_browser *self, int y, int x);
  30. void ui_browser__add_exit_key(struct ui_browser *self, int key);
  31. void ui_browser__add_exit_keys(struct ui_browser *self, int keys[]);
  32. void __ui_browser__show_title(struct ui_browser *browser, const char *title);
  33. void ui_browser__show_title(struct ui_browser *browser, const char *title);
  34. int ui_browser__show(struct ui_browser *self, const char *title,
  35. const char *helpline, ...);
  36. void ui_browser__hide(struct ui_browser *self);
  37. int ui_browser__refresh(struct ui_browser *self);
  38. int ui_browser__run(struct ui_browser *self);
  39. void ui_browser__rb_tree_seek(struct ui_browser *self, off_t offset, int whence);
  40. unsigned int ui_browser__rb_tree_refresh(struct ui_browser *self);
  41. void ui_browser__list_head_seek(struct ui_browser *self, off_t offset, int whence);
  42. unsigned int ui_browser__list_head_refresh(struct ui_browser *self);
  43. void ui_browser__init(void);
  44. #endif /* _PERF_UI_BROWSER_H_ */