htop/Panel.h

115 lines
2.5 KiB
C
Raw Normal View History

2006-06-06 20:28:42 +00:00
/* Do not edit this file. It was automatically generated. */
2006-05-30 13:47:28 +00:00
#ifndef HEADER_Panel
#define HEADER_Panel
/*
2006-06-06 20:28:42 +00:00
htop - Panel.h
2011-05-26 16:35:07 +00:00
(C) 2004-2011 Hisham H. Muhammad
2006-05-30 13:47:28 +00:00
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
//#link curses
2011-12-26 21:35:57 +00:00
#include "Object.h"
#include "Vector.h"
2006-05-30 13:47:28 +00:00
typedef struct Panel_ Panel;
typedef enum HandlerResult_ {
HANDLED,
IGNORED,
BREAK_LOOP
} HandlerResult;
#define EVENT_SETSELECTED -1
2006-05-30 13:47:28 +00:00
typedef HandlerResult(*Panel_EventHandler)(Panel*, int);
typedef struct PanelClass_ {
const ObjectClass super;
const Panel_EventHandler eventHandler;
} PanelClass;
#define As_Panel(this_) ((PanelClass*)((this_)->super.klass))
#define Panel_eventHandlerFn(this_) As_Panel(this_)->eventHandler
#define Panel_eventHandler(this_, ev_) As_Panel(this_)->eventHandler((Panel*)(this_), ev_)
2006-05-30 13:47:28 +00:00
struct Panel_ {
Object super;
PanelClass* class;
2006-05-30 13:47:28 +00:00
int x, y, w, h;
WINDOW* window;
Vector* items;
int selected;
int scrollV, scrollH;
int scrollHAmount;
2006-05-30 13:47:28 +00:00
int oldSelected;
bool needsRedraw;
RichString header;
char* eventHandlerBuffer;
2006-05-30 13:47:28 +00:00
};
2006-06-06 20:28:42 +00:00
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
#ifndef MAX
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
2006-05-30 13:47:28 +00:00
#define KEY_CTRLN 0016 /* control-n key */
#define KEY_CTRLP 0020 /* control-p key */
#define KEY_CTRLF 0006 /* control-f key */
#define KEY_CTRLB 0002 /* control-b key */
2006-05-30 13:47:28 +00:00
extern PanelClass Panel_class;
Panel* Panel_new(int x, int y, int w, int h, bool owner, ObjectClass* type);
2006-05-30 13:47:28 +00:00
void Panel_delete(Object* cast);
void Panel_init(Panel* this, int x, int y, int w, int h, ObjectClass* type, bool owner);
2006-05-30 13:47:28 +00:00
void Panel_done(Panel* this);
RichString* Panel_getHeader(Panel* this);
2006-05-30 13:47:28 +00:00
2010-02-25 01:43:18 +00:00
extern void Panel_setHeader(Panel* this, const char* header);
2006-05-30 13:47:28 +00:00
void Panel_move(Panel* this, int x, int y);
void Panel_resize(Panel* this, int w, int h);
void Panel_prune(Panel* this);
void Panel_add(Panel* this, Object* o);
void Panel_insert(Panel* this, int i, Object* o);
void Panel_set(Panel* this, int i, Object* o);
Object* Panel_get(Panel* this, int i);
Object* Panel_remove(Panel* this, int i);
Object* Panel_getSelected(Panel* this);
void Panel_moveSelectedUp(Panel* this);
void Panel_moveSelectedDown(Panel* this);
int Panel_getSelectedIndex(Panel* this);
2009-06-02 04:51:23 +00:00
int Panel_size(Panel* this);
2006-05-30 13:47:28 +00:00
void Panel_setSelected(Panel* this, int selected);
void Panel_draw(Panel* this, bool focus);
2009-06-02 04:51:23 +00:00
bool Panel_onKey(Panel* this, int key);
2006-05-30 13:47:28 +00:00
HandlerResult Panel_selectByTyping(Panel* this, int ch);
2006-05-30 13:47:28 +00:00
#endif