/* Name: cc.h Author: Michal Sudolsky Date: 24.08.2005 13:30 */ // modified by Juraj Kolesar #include // of course we have to include curses library #include // we use glib dynamic structures GList and GSList to store // menu, list and table items //and of course we use a lot of other standard libraries #include #include #include #include #include #include #include #include /* {{{ definition of universal constans for different terminals ************/ #define SHIFT_PRESSED 1 #define ALTR_PRESSED 2 #define CTRL_PRESSED 4 #define ALTL_PRESSED 8 #define MOUSE_NONE 0 #define MOUSE_GPM 1 #define MOUSE_XTERM 2 #define BUTTONCLICK 100 #define DOUBLECLICK 250 #define WAITTICK 300 #define REPEATTICK 50 #define MOUSEREFRESH 5 #define MAXLEN_NUMBER_STRING 16 #define MAXLEN_SHORTCUT_STRING 22 // CTRL+ALT+SHIFT+CENTER #define MAXLEN_COLOR_STRING 15 #define MAX_PREVIOUS_DIALOGS 64 #define MIN_MB_VX 10 #define MAX_MB_VX 64 #define MIN_MB_VY 5 #define DEF_FOB_VX 45 #define DEF_FOB_VY 22 #define MIN_FOB_VX 23 #define MIN_FOB_VY 13 #define TIMER_GRANULATE 1000000 // nanoseconds #define LUCORN 0 #define LDCORN 1 #define RUCORN 2 #define RDCORN 3 #define LTEE 4 #define UTEE 5 #define RTEE 6 #define DTEE 7 #define HLINE 8 #define VLINE 9 #define CROSS 10 #define CHESS 11 #define LARROW 12 #define RARROW 13 #define UARROW 14 #define DARROW 15 #define BITMAPX 80 #define BITMAPY 25 #define TP_FADE 127 #define TS_UP 0 #define TS_DOWN 1 #define TS_HIGH 2 #define TS_PUSH 3 #define TS_EXPUSH 4 #define SC_UP 0 #define SC_DOWN 1 #define SC_PUSH 2 #define EX_NONE 0 #define EX_UP 1 #define EX_DOWN 2 #define DM_BOTTOM 0 #define DM_MARK_TOP 1 #define DM_TOP_BOTTOM 2 /* }}} */ /* {{{ Definition of data structures representing standard UI objects ******/ typedef struct _TEXT{ /* {{{ LABEL *****************************************/ char type; char *text; long ctext; }TEXT; /* }}} */ typedef struct _EDIT{ /* {{{ TEXT BOX **************************************/ char type; char style; long curpos, maskpos, scroll, cbmask, cfmask, ctext; char *text; void (*change)(); }EDIT; /* }}} */ typedef struct _BUTTON{ /* {{{ BUTTON **************************************/ char type; char *text; char style; bool checked; long cback[2], ctext[3], cutext[3], cfocus[3]; bool hasfocus; char status; void (*push)(); }BUTTON; /* }}} */ typedef struct _SCROLL{ /* {{{ SCROLL BOX **********************************/ char type; long pos, smoothpos, minpos, maxpos, pagecnt, cnt; long cmark, cbar, carrowup, carrowdown; bool vert, smooth; char sup, sdown, spageup, spagedown; void (*change)(); }SCROLL; /* }}} */ typedef struct _COMBO{ /* {{{ COMBO BOX ************************************/ char type; long activeline, scroll, cbutback[2], cbutfront[2], lstvy; char pushed; void (*change)(); long maxvisitems; struct _Cc_Win *list, *edit; GList *activeitem; }COMBO; /* }}} */ typedef struct _LIST{ /* {{{ LIST BOX **************************************/ char type; long activeline, cborder, ccells, ctext, cselected, cseltext, cactive, cactivetext; char combotyp; GList *lines; void (*change)(); void (*dblclk)(); struct _Cc_Win *hscroll, *vscroll; struct _Cc_Win *hfade, *vfade; char exvscroll, exhscroll; GSList *lencells; long numlines, maxitemlen, oldscrollpos; GList *activeitem, *scrollupitem; }LIST; /* }}} */ typedef struct _STATUS{ /* {{{ STATUS **************************************/ char type; long pos, maxpos; long cbfull, ctfull, ctclear; bool vert, vtext; char *text; }STATUS; /* }}} */ typedef struct _PAINT{ /* {{{ PAINT ****************************************/ char type; char style; long color; }PAINT; /* }}} */ typedef struct _MENU{ /* {{{ MENU ******************************************/ char type; long activeline, cborder, ctext, cutext, cactive, cactivetext, cactiveutext; GList *lines; void (*change)(); void (*select)(); bool vert; struct _Cc_Win *hfade, *vfade; }MENU; /* }}} */ typedef struct _DIALOG{ /* {{{ DIALOG **************************************/ char type; char *caption; char style; char state; long tmpx, tmpy, tmpvx, tmpvy; struct _Cc_Win *bclose, *bmaximize, *bminimize; struct _Cc_Win *menu; struct _Cc_Win *hfade, *vfade; long cbactive, cbinactive; bool modal; void (*resize)(); void (*sizeok)(); void (*close)(); }DIALOG; /* }}} */ typedef struct _FADE{ /* {{{ FADE ******************************************/ char type; }FADE; /* }}} */ typedef union _UNION{ /* {{{ UNION *****************************************/ char type; TEXT text; EDIT edit; BUTTON button; SCROLL scroll; COMBO combo; LIST list; STATUS status; PAINT paint; MENU menu; DIALOG dialog; FADE fade; }UNION; /* }}} */ typedef struct _Cc_Win{ /* {{{ WIN *****************************************/ struct _Cc_Win *next, *parent, *child, *childend, *lastfocus; long x, y, vx, vy, svx, svy, flx, fly, frx, fry, style; long cback; bool active, hasmodal; bool (*acel)(); attr_t *windata; attr_t attr; bool redrawed; UNION *extra; char stat; void *user; }Cc_Win; #define __Cc_Win /* }}} */ typedef struct _Cc_Timer{ /* {{{ TIMER */ struct _Cc_Timer *next; Cc_Win *win; long period; long tminus; long prior; void (*timer)(); }Cc_Timer; #define __Cc_Timer /* }}} */ /* }}} */ #include "share/cuchar.h" #include "cc_main.h" #include "cc_user.h" #include "cc_mouse.h" #include "cc_key.h" #include "cc_term.h" #include "cc_extra.h"