DynamicColumn.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef HEADER_DynamicColumn
  2. #define HEADER_DynamicColumn
  3. /*
  4. htop - DynamicColumn.h
  5. (C) 2023 htop dev team
  6. Released under the GNU GPLv2+, see the COPYING file
  7. in the source distribution for its full text.
  8. */
  9. #include <stdbool.h>
  10. #include "Hashtable.h"
  11. #include "Process.h"
  12. #include "RichString.h"
  13. #include "Table.h"
  14. #define DYNAMIC_MAX_COLUMN_WIDTH 64
  15. #define DYNAMIC_DEFAULT_COLUMN_WIDTH -5
  16. typedef struct DynamicColumn_ {
  17. char name[32]; /* unique, internal-only name */
  18. char* heading; /* displayed in main screen */
  19. char* caption; /* displayed in setup menu (short name) */
  20. char* description; /* displayed in setup menu (detail) */
  21. int width; /* display width +/- for value alignment */
  22. bool enabled; /* false == ignore this column (until enabled) */
  23. Table* table; /* pointer to DynamicScreen or ProcessTable */
  24. } DynamicColumn;
  25. Hashtable* DynamicColumns_new(void);
  26. void DynamicColumns_delete(Hashtable* dynamics);
  27. const char* DynamicColumn_name(unsigned int key);
  28. void DynamicColumn_done(DynamicColumn* this);
  29. const DynamicColumn* DynamicColumn_lookup(Hashtable* dynamics, unsigned int key);
  30. const DynamicColumn* DynamicColumn_search(Hashtable* dynamics, const char* name, unsigned int* key);
  31. bool DynamicColumn_writeField(const Process* proc, RichString* str, unsigned int key);
  32. #endif