2012-11-10 00:31:37 +00:00
|
|
|
#ifndef HEADER_IncSet
|
|
|
|
#define HEADER_IncSet
|
|
|
|
/*
|
|
|
|
htop - IncSet.h
|
|
|
|
(C) 2005-2012 Hisham H. Muhammad
|
2020-10-05 07:51:32 +00:00
|
|
|
Released under the GNU GPLv2, see the COPYING file
|
2012-11-10 00:31:37 +00:00
|
|
|
in the source distribution for its full text.
|
|
|
|
*/
|
|
|
|
|
2020-09-18 17:23:04 +00:00
|
|
|
#include <stdbool.h>
|
2020-09-19 11:55:23 +00:00
|
|
|
#include <stddef.h>
|
2020-09-18 17:23:04 +00:00
|
|
|
|
2012-11-10 00:31:37 +00:00
|
|
|
#include "FunctionBar.h"
|
|
|
|
#include "Panel.h"
|
2020-09-19 11:55:23 +00:00
|
|
|
#include "Vector.h"
|
2012-11-10 00:31:37 +00:00
|
|
|
|
|
|
|
#define INCMODE_MAX 40
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
INC_SEARCH = 0,
|
|
|
|
INC_FILTER = 1
|
|
|
|
} IncType;
|
|
|
|
|
|
|
|
typedef struct IncMode_ {
|
2014-04-24 22:50:03 +00:00
|
|
|
char buffer[INCMODE_MAX+1];
|
2012-11-10 00:31:37 +00:00
|
|
|
int index;
|
|
|
|
FunctionBar* bar;
|
|
|
|
bool isFilter;
|
|
|
|
} IncMode;
|
|
|
|
|
|
|
|
typedef struct IncSet_ {
|
|
|
|
IncMode modes[2];
|
|
|
|
IncMode* active;
|
|
|
|
FunctionBar* defaultBar;
|
|
|
|
bool filtering;
|
2016-05-05 13:30:06 +00:00
|
|
|
bool found;
|
2012-11-10 00:31:37 +00:00
|
|
|
} IncSet;
|
|
|
|
|
2020-10-27 20:26:37 +00:00
|
|
|
static inline const char* IncSet_filter(const IncSet* this) {
|
|
|
|
return this->filtering ? this->modes[INC_FILTER].buffer : NULL;
|
|
|
|
}
|
|
|
|
|
2012-11-10 00:31:37 +00:00
|
|
|
typedef const char* (*IncMode_GetPanelValue)(Panel*, int);
|
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
void IncSet_reset(IncSet* this, IncType type);
|
2018-11-03 19:59:55 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
IncSet* IncSet_new(FunctionBar* bar);
|
2012-11-10 00:31:37 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
void IncSet_delete(IncSet* this);
|
2012-11-10 00:31:37 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
bool IncSet_next(IncSet* this, IncType type, Panel* panel, IncMode_GetPanelValue getPanelValue);
|
2018-11-03 19:59:55 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
bool IncSet_prev(IncSet* this, IncType type, Panel* panel, IncMode_GetPanelValue getPanelValue);
|
2018-11-03 19:59:55 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
bool IncSet_handleKey(IncSet* this, int ch, Panel* panel, IncMode_GetPanelValue getPanelValue, Vector* lines);
|
2012-11-10 00:31:37 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
const char* IncSet_getListItemValue(Panel* panel, int i);
|
2012-11-10 00:31:37 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
void IncSet_activate(IncSet* this, IncType type, Panel* panel);
|
2012-11-10 00:31:37 +00:00
|
|
|
|
2020-10-05 13:14:54 +00:00
|
|
|
void IncSet_drawBar(const IncSet* this);
|
2012-11-10 00:31:37 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
int IncSet_synthesizeEvent(IncSet* this, int x);
|
2015-03-23 20:04:53 +00:00
|
|
|
|
2012-11-10 00:31:37 +00:00
|
|
|
#endif
|