InfoScreen.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef HEADER_InfoScreen
  2. #define HEADER_InfoScreen
  3. /*
  4. htop - InfoScreen.h
  5. (C) 2016 Hisham H. Muhammad
  6. (C) 2020,2022 htop dev team
  7. Released under the GNU GPLv2+, see the COPYING file
  8. in the source distribution for its full text.
  9. */
  10. #include <stdbool.h>
  11. #include "FunctionBar.h"
  12. #include "IncSet.h"
  13. #include "Macros.h"
  14. #include "Object.h"
  15. #include "Panel.h"
  16. #include "Process.h"
  17. #include "Vector.h"
  18. typedef struct InfoScreen_ {
  19. Object super;
  20. const Process* process;
  21. Panel* display;
  22. IncSet* inc;
  23. Vector* lines;
  24. } InfoScreen;
  25. typedef void(*InfoScreen_Scan)(InfoScreen*);
  26. typedef void(*InfoScreen_Draw)(InfoScreen*);
  27. typedef void(*InfoScreen_OnErr)(InfoScreen*);
  28. typedef bool(*InfoScreen_OnKey)(InfoScreen*, int);
  29. typedef struct InfoScreenClass_ {
  30. const ObjectClass super;
  31. const InfoScreen_Scan scan;
  32. const InfoScreen_Draw draw;
  33. const InfoScreen_OnErr onErr;
  34. const InfoScreen_OnKey onKey;
  35. } InfoScreenClass;
  36. #define As_InfoScreen(this_) ((const InfoScreenClass*)(((InfoScreen*)(this_))->super.klass))
  37. #define InfoScreen_scan(this_) As_InfoScreen(this_)->scan((InfoScreen*)(this_))
  38. #define InfoScreen_draw(this_) As_InfoScreen(this_)->draw((InfoScreen*)(this_))
  39. #define InfoScreen_onErr(this_) As_InfoScreen(this_)->onErr((InfoScreen*)(this_))
  40. #define InfoScreen_onKey(this_, ch_) As_InfoScreen(this_)->onKey((InfoScreen*)(this_), ch_)
  41. InfoScreen* InfoScreen_init(InfoScreen* this, const Process* process, FunctionBar* bar, int height, const char* panelHeader);
  42. InfoScreen* InfoScreen_done(InfoScreen* this);
  43. ATTR_FORMAT(printf, 2, 3)
  44. void InfoScreen_drawTitled(InfoScreen* this, const char* fmt, ...);
  45. void InfoScreen_addLine(InfoScreen* this, const char* line);
  46. void InfoScreen_appendLine(InfoScreen* this, const char* line);
  47. void InfoScreen_run(InfoScreen* this);
  48. #endif