campo-sirio/xvaga/xvt_type.h

461 lines
8.9 KiB
C
Raw Normal View History

#ifndef BOOLEAN
#define BOOLEAN short
#endif
#ifndef FALSE
#define FALSE 0
#define TRUE 1
#endif
#ifdef LINUX
#define _MAX_PATH 512
#define _MAX_EXT 6
#define _MAX_DRIVE 6
#define _MAX_DIR 512
#define _MAX_FNAME 512
#endif
typedef unsigned long WINDOW;
typedef unsigned int UNIT_TYPE;
typedef unsigned long ULONG;
typedef unsigned long XVT_ERRMSG;
typedef wchar_t XVT_WCHAR;
typedef short MENU_TAG;
typedef short CURSOR;
typedef char* DATA_PTR;
#define EOL_SEQ "\015\012"
typedef struct
{
short top, left, bottom, right;
} RCT;
typedef long XVT_HELP_TID;
typedef unsigned long COLOR;
typedef unsigned long XVT_COLOR_TYPE;
typedef unsigned long XVT_FONT_ATTR_MASK;
typedef unsigned long XVT_FONT_STYLE_MASK;
typedef long PICTURE;
typedef void* XVT_IMAGE;
typedef enum {
XVT_IMAGE_NONE,
XVT_IMAGE_CL8,
XVT_IMAGE_RGB,
XVT_IMAGE_MONO,
} XVT_IMAGE_FORMAT;
#define XVT_FNTID void*
typedef void* XVT_PALETTE;
typedef unsigned long XVT_PALETTE_ATTR;
#define XVT_ESC_GET_PRINTER_INFO 883
typedef enum e_display_type {
XVT_DISPLAY_MONO, /* monochromatic display */
XVT_DISPLAY_GRAY_16, /* 16-entry grayscale */
XVT_DISPLAY_GRAY_256, /* 256-entry grayscale */
XVT_DISPLAY_COLOR_16, /* 16-entry color */
XVT_DISPLAY_COLOR_256, /* 256-entry color */
XVT_DISPLAY_DIRECT_COLOR, /* full color capabilities */
} XVT_DISPLAY_TYPE;
typedef enum {
XVT_PALETTE_NONE,
XVT_PALETTE_STOCK,
XVT_PALETTE_CURRENT,
XVT_PALETTE_CUBE16,
XVT_PALETTE_CUBE256,
XVT_PALETTE_USER
} XVT_PALETTE_TYPE;
typedef enum { /* response from ask fcn */
RESP_DEFAULT, /* default button */
RESP_2, /* second button */
RESP_3, /* third button */
} ASK_RESPONSE;
typedef enum { /* result from file open & save dialogs */
FL_BAD, /* error occurred */
FL_CANCEL, /* cancel button clicked */
FL_OK, /* OK button clicked */
} FL_STATUS;
typedef struct
{
char path[_MAX_DIR];
} DIRECTORY;
typedef struct s_mitem {
MENU_TAG tag; /* menu tag */
char *text; /* text to appear in menu */
short mkey; /* mnemonic */
unsigned enabled: 1; /* enabled? */
unsigned checked: 1; /* checked? */
unsigned checkable: 1; /* checkable? */
unsigned separator: 1; /* separator? */
struct s_mitem *child; /* pointer to submenu */
} MENU_ITEM;
typedef enum e_popup_alignment {
XVT_POPUP_CENTER,
XVT_POPUP_LEFT_ALIGN,
XVT_POPUP_RIGHT_ALIGN,
XVT_POPUP_OVER_ITEM
} XVT_POPUP_ALIGNMENT;
#define SZ_FNAME _MAX_FNAME
typedef struct { /* file specification */
DIRECTORY dir; /* directory */
char type[6]; /* file type/extension */
char name[_MAX_FNAME]; /* filename */
char creator[6]; /* file creator */
} FILE_SPEC;
typedef struct
{
void* pr;
} PRINT_RCD;
typedef struct
{
short v, h;
} PNT;
typedef struct { char* str; long data; void* next; } SLIST_ITEM;
typedef SLIST_ITEM* SLIST_ELT;
typedef struct { SLIST_ELT head; long count; } xvtList;
typedef xvtList* SLIST;
typedef enum { /* drawing (transfer) mode */
M_COPY,
M_OR,
M_XOR,
M_CLEAR,
M_NOT_COPY,
M_NOT_OR,
M_NOT_XOR,
M_NOT_CLEAR
} DRAW_MODE;
typedef enum e_pen_style { /* pen style */
P_SOLID, /* solid */
P_DOT, /* dotted line */
P_DASH /* dashed line */
} PEN_STYLE;
typedef enum {
PAT_NONE, /* no pattern */
PAT_HOLLOW, /* hollow */
PAT_SOLID, /* solid fill */
PAT_HORZ, /* horizontal lines */
PAT_VERT, /* vertical lines */
PAT_FDIAG, /* diagonal lines -- top-left to bottom-right */
PAT_BDIAG, /* diagonal lines -- top-right to bottom-left */
PAT_CROSS, /* horizontal and vertical crossing lines */
PAT_DIAGCROSS, /* diagonal crossing lines */
PAT_RUBBER, /* rubber banding */
PAT_SPECIAL
} PAT_STYLE;
typedef struct { /* color pen tool */
short width; /* width */
PAT_STYLE pat; /* pattern */
PEN_STYLE style; /* style */
COLOR color; /* color */
} CPEN;
typedef struct
{
PAT_STYLE pat;
COLOR color;
} CBRUSH;
typedef struct { /* color drawing tools */
CPEN pen; /* color pen */
CBRUSH brush; /* color brush */
DRAW_MODE mode; /* drawing mode */
COLOR fore_color; /* foreground color */
COLOR back_color; /* background color */
BOOLEAN opaque_text; /* is text opaque*/
} DRAW_CTOOLS;
typedef enum { /* scrollbar activity */
SC_NONE, /* nowhere (ignore) */
SC_LINE_UP, /* one line up */
SC_LINE_DOWN, /* one line down */
SC_PAGE_UP, /* previous page */
SC_PAGE_DOWN, /* next page */
SC_THUMB, /* thumb repositioning */
SC_THUMBTRACK /* thumb tracking */
} SCROLL_CONTROL;
typedef enum { /* type of window */
W_NONE, /* marker for end of WIN_DEF array */
W_DOC, /* document window */
W_PLAIN, /* window with plain border */
W_DBL, /* window with double border */
W_PRINT, /* XVT internal use only */
W_TASK, /* task window */
W_SCREEN, /* screen window */
W_NO_BORDER, /* no border */
W_PIXMAP, /* pixmap */
W_MODAL, /* modal window */
WD_MODAL, /* modal dialog */
WD_MODELESS, /* modeless dialog */
WC_PUSHBUTTON, /* button control */
WC_RADIOBUTTON, /* radio button control */
WC_CHECKBOX, /* check box control */
WC_HSCROLL, /* horizontal scrollbar control */
WC_VSCROLL, /* vertical scrollbar control */
WC_EDIT, /* edit control */
WC_TEXT, /* static text control */
WC_LBOX, /* list box control */
WC_LISTBUTTON, /* button with list */
WC_LISTEDIT, /* edit with field list */
WC_GROUPBOX, /* group box */
WC_TEXTEDIT, /* text edit object */
WC_ICON, /* icon control */
WO_TE, /* text edit */
} WIN_TYPE;
typedef enum {
SEV_NONE,
SEV_WARNING,
SEV_ERROR,
SEV_FATAL,
} XVT_ERRSEV;
typedef enum { /* type of scrollbar */
HSCROLL, /* horizontal */
VSCROLL, /* vertical */
HVSCROLL, /* either */
} SCROLL_TYPE;
typedef struct s_ctlinfo {
WIN_TYPE type;
WINDOW win;
union {
struct s_scroll {
SCROLL_CONTROL what;
short pos;
} scroll;
struct s_edit {
BOOLEAN focus_change;
BOOLEAN active;
} edit;
struct s_lbox {
BOOLEAN dbl_click;
} lbox;
struct s_listedit {
BOOLEAN focus_change;
BOOLEAN active;
} listedit;
} v;
} CONTROL_INFO;
typedef struct s_xvt_color_component {
XVT_COLOR_TYPE type; /* color component being defined */
COLOR color; /* RGB color value */
} XVT_COLOR_COMPONENT;
typedef struct s_win_def {
WIN_TYPE wtype; /* WC_* or WO_* type */
RCT rct;
char *text;
UNIT_TYPE units;
XVT_COLOR_COMPONENT * ctlcolors;
union {
struct s_win_def_win { /* WINDOW's */
short int menu_rid; /* menu resource id */
MENU_ITEM *menu_p; /* pointer to menu tree */
long flags; /* WSF_* flags */
XVT_FNTID ctl_font_id; /* control font id */
} win;
struct s_win_def_dlg { /* DIALOG's */
long flags; /* WSF_* flags */
XVT_FNTID ctl_font_id; /* control font id */
} dlg;
struct s_win_def_ctl { /* CONTROL's */
short int ctrl_id;
short int icon_id; /* for icons only */
long flags; /* CTL_* flags */
XVT_FNTID font_id; /* logical font */
} ctl;
struct s_win_def_tx { /* text edit objects */
unsigned short attrib; /* TX_* flags */
XVT_FNTID font_id; /* logical font */
short margin; /* right margin */
short limit; /* max chars */
short int tx_id; /* text ID */
} tx;
} v;
} WIN_DEF;
typedef enum {
E_CREATE, /* creation */
E_DESTROY, /* destruction */
E_FOCUS, /* window focus gain/loss */
E_SIZE, /* resize */
E_UPDATE, /* update */
E_CLOSE, /* close window request */
E_MOUSE_DOWN, /* mouse down */
E_MOUSE_UP, /* mouse up */
E_MOUSE_MOVE, /* mouse move */
E_MOUSE_DBL, /* mouse double click */
E_CHAR, /* character typed */
E_VSCROLL, /* vert. window scrollbar activity */
E_HSCROLL, /* horz. window scrollbar activity */
E_COMMAND, /* menu command */
E_FONT, /* font menu selection */
E_CONTROL, /* control activity */
E_TIMER, /* timer */
E_QUIT, /* application shutdown request */
E_HELP, /* help invoked */
E_USER, /* user defined */
} EVENT_TYPE;
typedef struct s_event {
EVENT_TYPE type;
union {
struct s_mouse {
PNT where;
BOOLEAN shift;
BOOLEAN control;
short button;
} mouse;
struct s_char {
XVT_WCHAR ch;
BOOLEAN shift;
BOOLEAN control;
BOOLEAN virtual_key;
unsigned long modifiers;
} chr;
BOOLEAN active;
BOOLEAN query;
struct s_scroll_info {
SCROLL_CONTROL what;
short pos;
} scroll;
struct s_cmd {
MENU_TAG tag;
BOOLEAN shift;
BOOLEAN control;
} cmd;
struct s_size {
short height;
short width;
} size;
struct s_efont {
XVT_FNTID font_id;
} font;
struct s_ctl {
short id;
CONTROL_INFO ci;
} ctl;
struct s_update {
RCT rct;
} update;
struct s_timer {
long id;
} timer;
struct s_user {
long id;
void *ptr;
} user;
struct s_help {
WINDOW obj;
MENU_TAG tag;
XVT_HELP_TID tid;
}help;
} v;
} EVENT;
typedef unsigned long EVENT_MASK;
typedef long (* EVENT_HANDLER) (WINDOW win, EVENT *ep);
typedef BOOLEAN (* XVT_ERRMSG_HANDLER) (XVT_ERRMSG err, DATA_PTR context);
typedef enum { /* std. clipboard format */
CB_TEXT, /* ASCII text */
CB_PICT, /* encapsulated picture */
CB_APPL /* app's own (must have name) */
} CB_FORMAT;
typedef struct s_xvt_config {
short menu_bar_ID; /* task menubar ResID */
short about_box_ID; /* default aboutbox ResID */
char *base_appl_name; /* application's "filename" */
char *appl_name; /* application's name */
char *taskwin_title; /* title for task window */
} XVT_CONFIG;