IncSet.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef HEADER_IncSet
  2. #define HEADER_IncSet
  3. /*
  4. htop - IncSet.h
  5. (C) 2005-2012 Hisham H. Muhammad
  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 <stddef.h>
  11. #include "FunctionBar.h"
  12. #include "Panel.h"
  13. #include "Vector.h"
  14. #define INCMODE_MAX 128
  15. typedef enum {
  16. INC_SEARCH = 0,
  17. INC_FILTER = 1
  18. } IncType;
  19. typedef struct IncMode_ {
  20. char buffer[INCMODE_MAX + 1];
  21. int index;
  22. FunctionBar* bar;
  23. bool isFilter;
  24. } IncMode;
  25. typedef struct IncSet_ {
  26. IncMode modes[2];
  27. IncMode* active;
  28. Panel* panel;
  29. FunctionBar* defaultBar;
  30. bool filtering;
  31. bool found;
  32. } IncSet;
  33. static inline const char* IncSet_filter(const IncSet* this) {
  34. return this->filtering ? this->modes[INC_FILTER].buffer : NULL;
  35. }
  36. void IncSet_setFilter(IncSet* this, const char* filter);
  37. typedef const char* (*IncMode_GetPanelValue)(Panel*, int);
  38. void IncSet_reset(IncSet* this, IncType type);
  39. IncSet* IncSet_new(FunctionBar* bar);
  40. void IncSet_delete(IncSet* this);
  41. bool IncSet_handleKey(IncSet* this, int ch, Panel* panel, IncMode_GetPanelValue getPanelValue, Vector* lines);
  42. const char* IncSet_getListItemValue(Panel* panel, int i);
  43. void IncSet_activate(IncSet* this, IncType type, Panel* panel);
  44. void IncSet_drawBar(const IncSet* this, int attr);
  45. int IncSet_synthesizeEvent(IncSet* this, int x);
  46. #endif