/* Sysmon window stuff. */ #ifndef WINDOW_H #define WINDOW_H #include #include #ifndef ETREE_H # include "etree.h" #endif /*************************************************************************/ typedef struct { int what; /* See WA_* below */ int nargs; ETree **args; } WinAction; #define WA_CLEAR 0 #define WA_CURSOR 1 #define WA_COLOR 2 #define WA_BORDERCOLOR 3 #define WA_TITLECOLOR 4 #define WA_PRINTF 5 #define WA_BEEP 6 #define WA_SETSTATE 50 #define WA_IF 100 /* args[0] = condition, args[1] = # actions */ #define WA_ELSE 101 /* args[0] = # actions */ #define WA_NOELSE 102 /* ELSE that should not be executed */ /*************************************************************************/ /* Color definitions: */ #define C_BLACK 0x1000000 #define C_BLUE 0x1000001 #define C_GREEN 0x1000002 #define C_CYAN 0x1000003 #define C_RED 0x1000004 #define C_MAGENTA 0x1000005 #define C_YELLOW 0x1000006 #define C_GREY 0x1000007 #define C_WHITE 0x1000008 /*************************************************************************/ typedef struct window_struct Window; struct window_struct { Window *next, *prev; char *name; int flags; /* See WF_* below */ int x, y, width, height; /* Position and dimensions */ char *title; /* Title string */ int cx, cy; /* Current cursor position */ int fg, bg; /* Foreground and background colors */ int borderfg, borderbg; /* Colors for border */ int titlefg, titlebg; /* Colors for title */ WinAction **drawlist; /* What to do to draw the window's contents */ int drawlist_size; /* Size of the array */ WINDOW *curses_win; /* [n]curses window structure */ int attr; /* Last attribute value used */ struct timeval lastdraw; /* Last time we refreshed */ int refresh; /* How often to refresh, in milliseconds */ }; #define WF_BORDER 1 /* Draw a border */ #define WF_WRAP 2 /* Wrap text at right edge */ #define WF_SCROLL 4 /* Scroll when texts hits bottom */ /*************************************************************************/ /*************************************************************************/ /* Size of the screen */ extern int scrwidth, scrheight; /* Is color available? */ extern int has_color; /* List of all windows. */ extern Window *winlist; /* Window which is currently being redrawn. */ extern Window *current_window; /*************************************************************************/ /* Set up the screen stuff. */ extern void screen_setup(void); /* Redraw everything on the screen. */ extern void screen_refresh(void); /* Like screen_refresh(), but clear the screen first. */ extern void screen_redraw(void); /* Allocate a new Window structure and link it to the global list. */ extern Window *win_new(void); /* Draw a window on the screen. */ extern void win_open(Window *w); /* Update a window's contents. */ extern void win_refresh(Window *w); /* Remove a window from the screen. */ extern void win_close(Window *w); /* Free a window's data. */ extern void win_kill(Window *w); /* Find a window by name. */ extern Window *win_find(const char *name); /*************************************************************************/ #endif /* WINDOW_H */