root/scripts/lxdialog/dialog.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 
   2 /*
   3  *  dialog.h -- common declarations for all dialog modules
   4  *
   5  *  AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
   6  *
   7  *  This program is free software; you can redistribute it and/or
   8  *  modify it under the terms of the GNU General Public License
   9  *  as published by the Free Software Foundation; either version 2
  10  *  of the License, or (at your option) any later version.
  11  *
  12  *  This program is distributed in the hope that it will be useful,
  13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  *  GNU General Public License for more details.
  16  *
  17  *  You should have received a copy of the GNU General Public License
  18  *  along with this program; if not, write to the Free Software
  19  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20  */
  21 
  22 #include <sys/types.h>
  23 #include <fcntl.h>
  24 #include <unistd.h>
  25 #include <ctype.h>
  26 #include <stdlib.h>
  27 #include <string.h>
  28 
  29 #include CURSES_LOC
  30 
  31 #define ESC 27
  32 #define TAB 9
  33 #define MAX_LEN 2048
  34 #define BUF_SIZE (10*1024)
  35 #define MIN(x,y) (x < y ? x : y)
  36 #define MAX(x,y) (x > y ? x : y)
  37 
  38 
  39 #ifndef ACS_ULCORNER
  40 #define ACS_ULCORNER '+'
  41 #endif
  42 #ifndef ACS_LLCORNER
  43 #define ACS_LLCORNER '+'
  44 #endif
  45 #ifndef ACS_URCORNER
  46 #define ACS_URCORNER '+'
  47 #endif
  48 #ifndef ACS_LRCORNER
  49 #define ACS_LRCORNER '+'
  50 #endif
  51 #ifndef ACS_HLINE
  52 #define ACS_HLINE '-'
  53 #endif
  54 #ifndef ACS_VLINE
  55 #define ACS_VLINE '|'
  56 #endif
  57 #ifndef ACS_LTEE
  58 #define ACS_LTEE '+'
  59 #endif
  60 #ifndef ACS_RTEE
  61 #define ACS_RTEE '+'
  62 #endif
  63 #ifndef ACS_UARROW
  64 #define ACS_UARROW '^'
  65 #endif
  66 #ifndef ACS_DARROW
  67 #define ACS_DARROW 'v'
  68 #endif
  69 
  70 /* 
  71  * Attribute names
  72  */
  73 #define screen_attr                   attributes[0]
  74 #define shadow_attr                   attributes[1]
  75 #define dialog_attr                   attributes[2]
  76 #define title_attr                    attributes[3]
  77 #define border_attr                   attributes[4]
  78 #define button_active_attr            attributes[5]
  79 #define button_inactive_attr          attributes[6]
  80 #define button_key_active_attr        attributes[7]
  81 #define button_key_inactive_attr      attributes[8]
  82 #define button_label_active_attr      attributes[9]
  83 #define button_label_inactive_attr    attributes[10]
  84 #define inputbox_attr                 attributes[11]
  85 #define inputbox_border_attr          attributes[12]
  86 #define searchbox_attr                attributes[13]
  87 #define searchbox_title_attr          attributes[14]
  88 #define searchbox_border_attr         attributes[15]
  89 #define position_indicator_attr       attributes[16]
  90 #define menubox_attr                  attributes[17]
  91 #define menubox_border_attr           attributes[18]
  92 #define item_attr                     attributes[19]
  93 #define item_selected_attr            attributes[20]
  94 #define tag_attr                      attributes[21]
  95 #define tag_selected_attr             attributes[22]
  96 #define tag_key_attr                  attributes[23]
  97 #define tag_key_selected_attr         attributes[24]
  98 #define check_attr                    attributes[25]
  99 #define check_selected_attr           attributes[26]
 100 #define uarrow_attr                   attributes[27]
 101 #define darrow_attr                   attributes[28]
 102 
 103 /* number of attributes */
 104 #define ATTRIBUTE_COUNT               29
 105 
 106 /*
 107  * Global variables
 108  */
 109 extern bool use_colors;
 110 extern bool use_shadow;
 111 
 112 extern chtype attributes[];
 113 
 114 extern const char *backtitle;
 115 
 116 /*
 117  * Function prototypes
 118  */
 119 extern void create_rc (const char *filename);
 120 extern int parse_rc (void);
 121 
 122 
 123 void init_dialog (void);
 124 void end_dialog (void);
 125 void attr_clear (WINDOW * win, int height, int width, chtype attr);
 126 void dialog_clear (void);
 127 void color_setup (void);
 128 void print_autowrap (WINDOW * win, const char *prompt, int width, int y, int x);
 129 void print_button (WINDOW * win, const char *label, int y, int x, int selected);
 130 void draw_box (WINDOW * win, int y, int x, int height, int width, chtype box,
 131                 chtype border);
 132 void draw_shadow (WINDOW * win, int y, int x, int height, int width);
 133 
 134 int first_alpha (const char *string, const char *exempt);
 135 int dialog_yesno (const char *title, const char *prompt, int height, int width);
 136 int dialog_msgbox (const char *title, const char *prompt, int height,
 137                 int width, int pause);
 138 int dialog_textbox (const char *title, const char *file, int height, int width);
 139 int dialog_menu (const char *title, const char *prompt, int height, int width,
 140                 int menu_height, const char *choice, int item_no, 
 141                 const char * const * items);
 142 int dialog_checklist (const char *title, const char *prompt, int height,
 143                 int width, int list_height, int item_no,
 144                 const char * const * items, int flag);
 145 extern unsigned char dialog_input_result[];
 146 int dialog_inputbox (const char *title, const char *prompt, int height,
 147                 int width, const char *init);
 148 
 149 /*
 150  * This is the base for fictitious keys, which activate
 151  * the buttons.
 152  *
 153  * Mouse-generated keys are the following:
 154  *   -- the first 32 are used as numbers, in addition to '0'-'9'
 155  *   -- the lowercase are used to signal mouse-enter events (M_EVENT + 'o')
 156  *   -- uppercase chars are used to invoke the button (M_EVENT + 'O')
 157  */
 158 #define M_EVENT (KEY_MAX+1)
 159 
 160 
 161 /*
 162  * The `flag' parameter in checklist is used to select between
 163  * radiolist and checklist
 164  */
 165 #define FLAG_CHECK 1
 166 #define FLAG_RADIO 0

/* [previous][next][first][last][top][bottom][index][help] */