home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / screen / intui110 / t.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-07  |  11.0 KB  |  282 lines

  1. /****************************************************************************/
  2. /*                                                                                                                                                    */
  3. /* T.H                                                                      */
  4. /*                                                                                                                                                    */
  5. /*                                                                                                                                                    */
  6. /****************************************************************************/
  7. #include "uw.h"
  8. #include "uw_globx.h"
  9. #include "uw_keys.h"
  10.  
  11. /*---------------------------- dialog defines ------------------------------*/
  12. #define        ADD_FAIL                -1
  13. #define        ADD_TO_END            -1
  14. #define        DEFINE_LEN            21
  15.  
  16. #define        T_DIALOG                0x01                                    /* The main dlg parent            */
  17. #define        T_BOX                        0x02                                    /* sub-boxes within the dlg    */
  18. #define        T_BUTTON                0x03                                    /* the button                                */
  19. #define        T_CHECK                    0x04                                    /* the checkable type                */
  20. #define        T_INPUT                    0x05                                    /* string input type                */
  21. #define        T_SLIDER                0x06                                    /* slider track and box            */
  22. #define        T_ICON                    0x07                                    /* icon with two images            */
  23.  
  24. #define        F_SELECTABLE        0x0001                                /* flag values                            */
  25. #define        F_TABABLE                0x0002
  26. #define        F_RADIO                    0x0004
  27.  
  28. #define        F_EXIT_PRESS        0x0008
  29. #define        F_EXIT_RELEASE    0x0010
  30. #define        F_EXIT_OVER            0x0020
  31. #define        F_IS_EXIT                0x0038
  32.  
  33. #define        F_SELECTED            0x0040
  34. #define        F_TABBED                0x0080
  35. #define        F_DESEL_RADIO        0x0100
  36. #define        F_EXIT_ALL            0x0200
  37.  
  38. #define        S_NORMAL                0x00                                    /* various styles                        */
  39. #define        S_SHADOWED            0x01
  40.  
  41. #define        SLIDER_LEFT            0                                            /* slider char index values    */
  42. #define        SLIDER_RIGHT        1
  43. #define        SLIDER_TOP            2
  44. #define        SLIDER_BOTTOM        3
  45. #define        SLIDER_TRACK        4
  46. #define        SLIDER_BOX            5
  47.  
  48. #define        DO_NORMAL                0x0001                                /* normal dialog processing    */
  49. #define        DO_RETURN_EVENT    0x0002                                /* return unknown events        */
  50.  
  51. #define        DO_RETURN_TAB        0x0004                                /* command key defines            */
  52. #define        DO_RETURN_ENTER    0x0008
  53. #define        DO_RETURN_LEFT    0x0010
  54. #define        DO_RETURN_RIGHT    0x0020
  55. #define        DO_RETURN_UP        0x0040
  56. #define        DO_RETURN_DOWN    0x0080
  57.  
  58. #define        DO_RETURN_ARROW    0x00F0                                /* return dialog arrow keys    */
  59. #define        DO_RETURN_CMD        0x00FC                                /* return dialog cmd keys        */
  60.  
  61. #define        DO_INPUT_ADV        0x0100                                /* advance tab on input       */
  62.  
  63. #define        NO_SELECTION        -1                                        /* just esc from do_dialog    */
  64. #define        EVENT_RETURNED    -2                                        /* unprocessed event                */
  65.  
  66. #define        FNAME_LEN       41                                        /* TUI help defines                    */
  67. #define        MATCH_LEN       41
  68.  
  69. /*------------------------ TUI dialog object structres ---------------------*/
  70. typedef union ptr_union_struct                                    /* structure for compatible    */
  71. {                                                                                                /* pointer sizes between        */
  72.     uchar        data[4];                              /* large and small models!    */
  73.     uchar        *ptr;
  74. } PTR_UNION;
  75.  
  76. typedef struct tui_base_struct
  77. {                                                                                                /* common pieces                        */
  78.     uint            flags;                                                            /* 16 bits for flags                 */
  79.     uchar            type;                                                                /* the type of TUI object        */
  80.     uchar            x_off;                                                            /* x offset from parent            */
  81.     uchar            y_off;                                                            /* x offset from parent            */
  82.     uchar            width;                                /* width in cells           */
  83.     uchar            height;                               /* height in cells          */
  84.     uchar            p_att;                                                            /* primary attribute                 */
  85.     uchar            s_att;                                                            /* secondary attribute             */
  86.     uchar            style;                                                            /* the style - shadow, norm    */
  87.     int                parent;                                                            /* index of the parent            */
  88.     PTR_UNION    more;                                                                /* pointer to more params        */
  89.     int                hot_key;                                                        /* hot key to select item        */
  90.     int                transfer;                                                        /* dialog transfer index        */
  91.     uchar            expansion[12];                                            /* for later expansion            */
  92. } TUI_BASE;
  93.  
  94. typedef struct tui_button_struct
  95. {
  96.     uchar            norm_att;                                                        /* normal attribute                 */
  97.     uchar            norm_f_att;                                                    /* normal first attribute        */
  98.     uchar            sel_att;                                                        /* selected attribute                */
  99.     uchar            sel_f_att;                                                    /* selected first attribute    */
  100.     uchar            tab_color;                                                    /* tabbed text color!                */
  101.     uchar            first_pos;                                                    /* first letter position        */
  102.     int                len;                                                                /* button text length                */
  103.     PTR_UNION    text;                               /* the button text                  */
  104.     uchar            expansion[4];                                                /* for later expansion            */
  105. } TUI_BUTTON;
  106.  
  107. typedef struct tui_check_struct
  108. {
  109.     uchar            norm_att;                                                        /* normal attribute                 */
  110.     uchar            tab_color;                                                    /* tabbed text color!                */
  111.     uchar            mark_pos;                                                        /* position for mark char        */
  112.     uchar            mark_char;                                                    /* mark character itself        */
  113.     int                len;                                                                /* check text length                */
  114.     PTR_UNION    text;                               /* the check text itself        */
  115.     uchar            norm_f_att;                                                    /* normal first attribute        */
  116.     uchar            first_pos;                                                    /* first letter position        */
  117.     uchar            expansion[2];                                                /* for later expansion            */
  118. } TUI_CHECK;
  119.  
  120. typedef struct tui_input
  121. {
  122.     uchar            norm_att;                                                        /* normal attribute                 */
  123.     uchar            tab_color;                                                    /* tabbed text color                */
  124.     int                len;                                                                /* input length                            */
  125.     PTR_UNION    text;                                                                /* the edited string                */
  126.     PTR_UNION    mask;                                                                /* the mask for display            */
  127.     PTR_UNION    template;                                                        /* validation characters        */
  128.     uchar     input_flags;                                                /* strip mode, char display    */
  129.     uchar            expansion[3];                                                /* for later expansion            */
  130. } TUI_INPUT;
  131.  
  132. typedef struct tui_slider
  133. {
  134.     uchar        arrow_att;                                                        /* attribute for arrow            */
  135.     uchar        track_att;                                                        /* attribute for track            */
  136.     uchar        grab_att;                                                            /* attribute for grabber    */
  137.     uchar        slider_chars[6];                                            /* the chars for the slider    */
  138.     long    position;                                                            /* runs from 0..(total-1)      */
  139.     long        page_amt;                                                            /* amt to page up/down             */
  140.     long        total;                                                                /* total represented                */
  141.     uchar        expansion[4];                                                    /* for later expansion            */
  142. } TUI_SLIDER;
  143.  
  144. typedef struct tui_icon_struct
  145. {
  146.     uchar            norm_att;                                                        /* normal attribute                 */
  147.     uchar            sel_att;                                                        /* selected attribute                */
  148.     uchar            tab_color;                                                    /* tabbed color!                        */
  149.     PTR_UNION    images;                             /* ptr to w x h images            */
  150.     uchar            expansion[4];                                                /* for later expansion            */
  151. } TUI_ICON;
  152.  
  153. typedef struct tui_struct                                                /* the actual TUI structure    */
  154. {
  155.     int                num_base;                                                        /* number of base items            */
  156.     long            version_num;                                                /* tui version number                */
  157.     uchar            font_0_used;                                                /* is the first font used?    */
  158.     char            font_0_name[13];                                        /* filename for font 0            */
  159.     uchar            font_1_used;                                                /* is the second font used?    */
  160.     char            font_1_name[13];                                        /* filename for font 1            */
  161.     uchar            blink_set;                                                    /* is blink enable set?            */
  162.     uchar            manager_used;                                                /* do we use the manager?        */
  163.     uchar            rows;                                                                /* number of rows for video    */
  164.     uchar            back_att;                                                        /* main back window color        */
  165.     uchar            back_bdr_att;                                                /* main back border color        */
  166.     uchar            palette[16];                                                /* the color palette                */
  167.     uchar            expansion[457];                                            /* for later expansion            */
  168.  
  169.     WINDOW        *back_wnp;                                                    /* back screen window ptr        */
  170.     TUI_BASE    *base;
  171. } TUI;
  172.  
  173. /*---------------------------- TUI help structres --------------------------*/
  174. typedef struct tui_keyword
  175. {
  176.     int    line;                                                                    /* keyword line             */
  177.     int    col;                                     /* keyword column           */
  178.     int    dos_cmd;                                                                /* 1 if extra is dos cmd         */
  179.     char   *search;                                      /* str associated with kwd    */
  180.     char   *keyword;                                                            /* the keyword itself       */
  181.     char      *fname;                                                                /* filename if not in file    */
  182.     struct tui_keyword *prev;                            /* pointer to prev keyword    */
  183.     struct tui_keyword *next;                            /* pointer to next keyword  */
  184. } TUI_KEYWORD;
  185.  
  186. typedef struct help_struct
  187. {
  188.     uchar            keyword_att;
  189.     uchar            hilite_att;
  190.     uchar            default_att;
  191.     uchar            first_char_att;
  192.     int              num_lines;
  193.     char             **lines;
  194.     char             *line_atts;
  195.     TUI_KEYWORD    *keyword_list, *keyword_end;
  196.     int              num_keywords;
  197.     int              tab_size;
  198.     int              first_col, curr_col;
  199.     int              top_line, curr_line;
  200.     int              chain_flag;
  201.     WINDOW           *wnp;
  202.     char             fname[FNAME_LEN];
  203.     char             match[MATCH_LEN];
  204. } TUI_HELP;
  205.  
  206. /*------------------------ time/date/directory defines ---------------------*/
  207.  
  208. typedef struct  file_blk
  209. {                                                        /* provide common def for Borland and Microsoft */
  210.     char        reserved[21];
  211.     char        attrib;
  212.     unsigned    ftime;
  213.     unsigned    fdate;
  214.     long        fsize;
  215.     char        name[13];
  216. } FBLK;
  217.  
  218. typedef struct ft_struct
  219. {
  220.     unsigned seconds    : 5;
  221.     unsigned minutes    : 6;
  222.     unsigned hours        : 5;
  223. } FILE_TIME;
  224.  
  225. typedef struct fd_struct
  226. {
  227.     unsigned days            : 5;
  228.     unsigned months     : 4;
  229.     unsigned years        : 7;
  230. } FILE_DATE;
  231.  
  232. typedef struct dir_struct
  233. {
  234.     char                f_attrib;
  235.     FILE_TIME        f_time;
  236.     FILE_DATE        f_date;
  237.     long                f_size;
  238.     char                f_name[9];
  239.     char                f_ext[4];
  240. } DIR;
  241.  
  242. /*------------------------------ get macros --------------------------------*/
  243. #define get_dlg_wnp(tp, i)         (WINDOW *) tp->base[i].more.ptr
  244. #define    get_item_type(tp, i)    tp->base[i].type
  245. #define    get_item_x(tp, i)             tp->base[i].x_off
  246. #define    get_item_y(tp, i)             tp->base[i].y_off
  247. #define    get_item_w(tp, i)             tp->base[i].width
  248. #define    get_item_h(tp, i)            tp->base[i].height
  249.  
  250. #define    get_box_att(tp, i)         tp->base[i].p_att
  251.  
  252. #define    get_sldr_pos(tp, i)         ((TUI_SLIDER *)(tp->base[i].more.ptr))->position
  253.  
  254. #define    get_str_text(tp, i)         ((TUI_BUTTON *)(tp->base[i].more.ptr))->text.ptr
  255.  
  256. #define    get_btn_text(tp, i)         ((TUI_BUTTON *)(tp->base[i].more.ptr))->text.ptr
  257. #define    get_btn_att(tp, i)         ((TUI_BUTTON *)(tp->base[i].more.ptr))->norm_att
  258.  
  259. #define    get_check_text(tp, i)    ((TUI_CHECK *)(tp->base[i].more.ptr))->text.ptr
  260.  
  261. #define    get_inp_text(tp, i)        ((TUI_INPUT *)(tp->base[i].more.ptr))->text.ptr
  262. #define    get_inp_mask(tp, i)        ((TUI_INPUT *)(tp->base[i].more.ptr))->mask.ptr
  263. #define    get_inp_tplt(tp, i)        ((TUI_INPUT *)(tp->base[i].more.ptr))->template.ptr
  264.  
  265. /*------------------------------ set macros --------------------------------*/
  266. #define set_btn_text(tp,i,s)    set_base_btn_text(&tp->base[i], s)
  267. #define set_str_text(tp,i,s)    set_base_btn_text(&tp->base[i], s)
  268. #define set_inp_strs(tp,i,t,m,p)    set_base_input_strs(&tp->base[i], t, m, p)
  269.  
  270. /*----------------------------- other macros -------------------------------*/
  271. #define    is_valid_inx(tp, i)         range(1, i, (tp->num_base - 1))
  272. #define    is_selected(tp, i)       (tp->base[i].flags & F_SELECTED)
  273. #define    is_tabbed(tp, i)         (tp->base[i].flags & F_TABBED)
  274.  
  275. #define    select(tp, i)                     tp->base[i].flags |= F_SELECTED
  276. #define    deselect(tp, i)                 tp->base[i].flags &= ~F_SELECTED
  277. #define    tab(tp, i)                          tp->base[i].flags |= F_TABBED
  278. #define    detab(tp, i)                      tp->base[i].flags &= ~F_TABBED
  279.  
  280. #include "t_proto.h"
  281. /*** END OF FILE ***/
  282.