home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************/
- /* */
- /* T.H */
- /* */
- /* */
- /****************************************************************************/
- #ifndef __T_H
- #define __T_H
- #include "uw.h"
-
- /*---------------------------- dialog defines ------------------------------*/
- #define ADD_FAIL -1
- #define ADD_TO_END -1
-
- /*------------------------------- TUI types --------------------------------*/
- #define T_DIALOG 0x01 /* The main dlg parent */
- #define T_BOX 0x02 /* sub-boxes within the dlg */
- #define T_BUTTON 0x03 /* the button */
- #define T_CHECK 0x04 /* the checkable type */
- #define T_INPUT 0x05 /* string input type */
- #define T_SLIDER 0x06 /* slider track and box */
- #define T_ICON 0x07 /* icon with two images */
-
- /*------------------------------- TUI errors -------------------------------*/
- #define T_ERROR_NO_MEM 0x01 /* out of memory for TUI */
- #define T_ERROR_BAD_INX 0x02 /* invalid item index */
-
- /*------------------------------ flag values -------------------------------*/
- #define F_SELECTABLE 0x0001
- #define F_TABABLE 0x0002
- #define F_RADIO 0x0004
-
- #define F_EXIT_PRESS 0x0008
- #define F_EXIT_RELEASE 0x0010
- #define F_EXIT_OVER 0x0020
- #define F_IS_EXIT 0x0038
-
- #define F_SELECTED 0x0040
- #define F_TABBED 0x0080
- #define F_DESEL_RADIO 0x0100
- #define F_EXIT_ALL 0x0200
- #define F_FULL_TAB_ATT 0x0400
-
- #define F_LEFT_JUST 0x1000
- #define F_RIGHT_JUST 0x2000
-
- /*---------------------------------- styles --------------------------------*/
- #define S_NORMAL 0x00
- #define S_SHADOWED 0x01
-
- /*------------------------- slider char index values -----------------------*/
- #define SLIDER_LEFT 0
- #define SLIDER_RIGHT 1
- #define SLIDER_TOP 2
- #define SLIDER_BOTTOM 3
- #define SLIDER_TRACK 4
- #define SLIDER_BOX 5
-
- /*-------------------------- dialog processing flags -----------------------*/
- #define DO_NORMAL 0x0001 /* normal dialog processing */
- #define DO_RETURN_EVENT 0x0002 /* return unknown events */
-
- #define DO_RETURN_TAB 0x0004 /* command key defines */
- #define DO_RETURN_ENTER 0x0008
- #define DO_RETURN_LEFT 0x0010
- #define DO_RETURN_RIGHT 0x0020
- #define DO_RETURN_UP 0x0040
- #define DO_RETURN_DOWN 0x0080
-
- #define DO_RETURN_ARROW 0x00F0 /* return dialog arrow keys */
- #define DO_RETURN_CMD 0x00FC /* return dialog cmd keys */
-
- #define DO_INPUT_ADV 0x0100 /* advance tab on input */
-
- #define NO_SELECTION -1 /* just esc from do_dialog */
- #define EVENT_RETURNED -2 /* unprocessed event */
-
- /*------------------------------- help defines -----------------------------*/
- #define FNAME_LEN 41 /* TUI help defines */
- #define MATCH_LEN 41
-
- /*------------------------ TUI dialog object structres ---------------------*/
- typedef union ptr_union_struct /* structure for compatible */
- { /* pointer sizes between */
- uchar data[4]; /* large and small models! */
- uchar *ptr;
- } PTR_UNION;
-
- typedef struct tui_base_struct
- {
- usint flags; /* 16 bits for flags */
- uchar type; /* the type of TUI object */
- uchar x_off; /* x offset from parent */
- uchar y_off; /* x offset from parent */
- uchar width; /* width in cells */
- uchar height; /* height in cells */
- uchar p_att; /* primary attribute */
- uchar s_att; /* secondary attribute */
- uchar style; /* the style - shadow, norm */
- sint parent; /* index of the parent */
- PTR_UNION more; /* pointer to more params */
- sint hot_key; /* hot key to select item */
- sint transfer; /* dialog transfer index */
- uchar expansion[12]; /* for later expansion */
- } TUI_BASE;
-
- typedef struct tui_button_struct
- {
- uchar norm_att; /* normal attribute */
- uchar norm_f_att; /* normal first attribute */
- uchar sel_att; /* selected attribute */
- uchar sel_f_att; /* selected first attribute */
- uchar tab_color; /* tabbed text color! */
- uchar first_pos; /* first letter position */
- sint len; /* button text length */
- PTR_UNION text; /* the button text */
- uchar expansion[4]; /* for later expansion */
- } TUI_BUTTON;
-
- typedef struct tui_check_struct
- {
- uchar norm_att; /* normal attribute */
- uchar tab_color; /* tabbed text color! */
- uchar mark_pos; /* position for mark char */
- uchar mark_char; /* mark character itself */
- sint len; /* check text length */
- PTR_UNION text; /* the check text itself */
- uchar norm_f_att; /* normal first attribute */
- uchar first_pos; /* first letter position */
- uchar expansion[2]; /* for later expansion */
- } TUI_CHECK;
-
- typedef struct tui_input_struct
- {
- uchar norm_att; /* normal attribute */
- uchar tab_color; /* tabbed text color */
- sint len; /* input length */
- PTR_UNION text; /* the edited string */
- PTR_UNION mask; /* the mask for display */
- PTR_UNION tplt; /* validation characters */
- usint input_flags; /* input modes & bit values */
- uchar expansion[2]; /* for later expansion */
- } TUI_INPUT;
-
- typedef struct tui_slider_struct
- {
- uchar arrow_att; /* attribute for arrow */
- uchar track_att; /* attribute for track */
- uchar grab_att; /* attribute for grabber */
- uchar slider_chars[6]; /* the chars for the slider */
- long position; /* runs from 0..(total-1) */
- long page_amt; /* amt to page up/down */
- long total; /* total represented */
- uchar expansion[4]; /* for later expansion */
- } TUI_SLIDER;
-
- typedef struct tui_icon_struct
- {
- uchar norm_att; /* normal attribute */
- uchar sel_att; /* selected attribute */
- uchar tab_color; /* tabbed color! */
- PTR_UNION images; /* ptr to w x h images */
- uchar expansion[4]; /* for later expansion */
- } TUI_ICON;
-
- typedef struct tui_struct /* the actual TUI structure */
- {
- sint num_base; /* number of base items */
- long version_num; /* tui version number */
- uchar font_0_used; /* is the first font used? */
- char font_0_name[13]; /* filename for font 0 */
- uchar font_1_used; /* is the second font used? */
- char font_1_name[13]; /* filename for font 1 */
- uchar blink_set; /* is blink enable set? */
- uchar manager_used; /* do we use the manager? */
- uchar rows; /* number of rows for video */
- uchar back_att; /* main back window color */
- uchar back_bdr_att; /* main back border color */
- uchar palette[16]; /* the color palette */
- uchar expansion[457]; /* for later expansion */
-
- WINDOW *back_wnp; /* back screen window ptr */
- TUI_BASE *base;
- } TUI;
-
- /*---------------------------- TUI help structres --------------------------*/
- typedef struct tui_keyword_struct
- {
- sint line; /* keyword line */
- sint col; /* keyword column */
- sint dos_cmd; /* 1 if extra is dos cmd */
- char *search; /* str associated with kwd */
- char *keyword; /* the keyword itself */
- char *fname; /* filename if not in file */
- struct tui_keyword_struct *prev; /* pointer to prev keyword */
- struct tui_keyword_struct *next; /* pointer to next keyword */
- } TUI_KEYWORD;
-
- typedef struct tui_help_struct
- {
- uchar keyword_att;
- uchar hilite_att;
- uchar default_att;
- uchar first_char_att;
- sint num_lines;
- char **lines;
- char *line_atts;
- TUI_KEYWORD *keyword_list, *keyword_end;
- sint num_keywords;
- sint tab_size;
- sint first_col, curr_col;
- sint top_line, curr_line;
- sint chain_flag;
- WINDOW *wnp;
- char fname[FNAME_LEN];
- char match[MATCH_LEN];
- } TUI_HELP;
-
- /*------------------------ time/date/directory defines ---------------------*/
- typedef struct tui_fblk_struct /* provide common typedef for all compilers */
- {
- char reserved[21];
- char attrib;
- usint ftime;
- usint fdate;
- long fsize;
- char name[13];
- } TUI_FBLK;
-
- typedef struct tui_file_tmdt_struct
- {
- unsigned seconds : 5;
- unsigned minutes : 6;
- unsigned hours : 5;
- unsigned days : 5;
- unsigned months : 4;
- unsigned years : 7;
- } TUI_FILE_TMDT;
-
- typedef struct tui_dir_struct
- {
- char f_attrib;
- TUI_FILE_TMDT f_tmdt;
- long f_size;
- char f_name[9];
- char f_ext[4];
- } TUI_DIR;
-
- #ifndef ENQ_DEBUG
- #ifndef SOURCE_TRACE
- /*------------------------------ get macros --------------------------------*/
- #define get_dlg_wnp(tp, i) ((WINDOW *) (tp)->base[i].more.ptr)
- #define get_item_type(tp, i) ((tp)->base[i].type)
- #define get_item_x(tp, i) ((tp)->base[i].x_off)
- #define get_item_y(tp, i) ((tp)->base[i].y_off)
- #define get_item_w(tp, i) ((tp)->base[i].width)
- #define get_item_h(tp, i) ((tp)->base[i].height)
- #define get_box_att(tp, i) ((tp)->base[i].p_att)
- #define get_sldr_pos(tp, i) (((TUI_SLIDER *)((tp)->base[i].more.ptr))->position)
- #define get_str_text(tp, i) ((char *) ((TUI_BUTTON *)((tp)->base[i].more.ptr))->text.ptr)
- #define get_btn_text(tp, i) ((char *) ((TUI_BUTTON *)((tp)->base[i].more.ptr))->text.ptr)
- #define get_btn_att(tp, i) (((TUI_BUTTON *)((tp)->base[i].more.ptr))->norm_att)
- #define get_btn_f_att(tp, i) (((TUI_BUTTON *)((tp)->base[i].more.ptr))->norm_f_att)
- #define get_btn_sel_att(tp,i) (((TUI_BUTTON *)((tp)->base[i].more.ptr))->sel_att)
- #define get_check_text(tp, i) ((char *) ((TUI_CHECK *)((tp)->base[i].more.ptr))->text.ptr)
- #define get_inp_text(tp, i) ((char *) ((TUI_INPUT *)((tp)->base[i].more.ptr))->text.ptr)
- #define get_inp_mask(tp, i) ((char *) ((TUI_INPUT *)((tp)->base[i].more.ptr))->mask.ptr)
- #define get_inp_tplt(tp, i) ((char *) ((TUI_INPUT *)((tp)->base[i].more.ptr))->tplt.ptr)
-
- /*------------------------------ set macros --------------------------------*/
- #define set_item_x(tp,i,x) (tp)->base[i].x_off = x
- #define set_item_y(tp,i,x) (tp)->base[i].y_off = x
- #define set_item_w(tp,i,x) (tp)->base[i].width = x
- #define set_item_h(tp,i,x) (tp)->base[i].height = x
- #define set_box_att(tp,i,x) (tp)->base[i].p_att = x
- #define set_sldr_pos(tp,i,x) ((TUI_SLIDER *)((tp)->base[i].more.ptr))->position = x
- #define set_str_text(tp,i,s) set_base_btn_text(&(tp)->base[i], s)
- #define set_btn_text(tp,i,s) set_base_btn_text(&(tp)->base[i], s)
- #define set_btn_att(tp,i,x) ((TUI_BUTTON *)((tp)->base[i].more.ptr))->norm_att = x
- #define set_btn_f_att(tp,i,x) ((TUI_BUTTON *)((tp)->base[i].more.ptr))->norm_f_att = x
- #define set_btn_sel_att(tp,i,x) ((TUI_BUTTON *)((tp)->base[i].more.ptr))->sel_att = x
- #define set_check_text(tp,i,s) set_base_check_text(&(tp)->base[i], s)
- #define set_inp_strs(tp,i,t,m,p) set_base_input_strs(&(tp)->base[i], t, m, p)
-
- /*----------------------------- other macros -------------------------------*/
- #define is_valid_inx(tp, i) (range(1, i, ((tp)->num_base - 1)))
- #define is_selected(tp, i) ((tp)->base[i].flags & F_SELECTED)
- #define is_tabbed(tp, i) ((tp)->base[i].flags & F_TABBED)
- #define is_tabable(tp, i) ((tp)->base[i].flags & F_TABABLE)
- #define is_enabled(tp, i) ((tp)->base[i].flags & F_SELECTABLE)
-
- #define select(tp, i) ((tp)->base[i].flags |= F_SELECTED)
- #define deselect(tp, i) ((tp)->base[i].flags &= ~F_SELECTED)
- #define tabable(tp, i) ((tp)->base[i].flags |= F_TABABLE)
- #define detabable(tp, i) ((tp)->base[i].flags &= ~F_TABABLE)
- #define tab(tp, i) ((tp)->base[i].flags |= F_TABBED)
- #define detab(tp, i) ((tp)->base[i].flags &= ~F_TABBED)
- #define enable_item(tp, i) ((tp)->base[i].flags |= F_SELECTABLE)
- #define disable_item(tp, i) ((tp)->base[i].flags &= ~F_SELECTABLE)
-
- #endif
- #endif
-
- /*----------------------------- global variables ---------------------------*/
- #ifndef TUI_ERROR_DEFINED
- extern usint Tui_error;
- #endif
-
- /*------------------------------ tui prototypes ----------------------------*/
- #include "t_proto.h"
- #include "t_dbg.h"
-
- #endif /* __T_H */
-
- /*** END OF FILE ***/