home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.3 / ConfigWidg.3 < prev    next >
Encoding:
Text File  |  1995-07-26  |  56.5 KB  |  858 lines

  1.  
  2.  
  3.  
  4.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  5.  
  6.  
  7.  
  8.      _________________________________________________________________
  9.  
  10.      NNNNAAAAMMMMEEEE
  11.           Tk_ConfigureWidget,       Tk_Offset,       Tk_ConfigureInfo,
  12.           Tk_FreeOptions - process configuration options for widgets
  13.  
  14.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  15.           ####iiiinnnncccclllluuuuddddeeee <<<<ttttkkkk....hhhh>>>>
  16.  
  17.           int
  18.           TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((_i_n_t_e_r_p, _t_k_w_i_n, _s_p_e_c_s, _a_r_g_c, _a_r_g_v, _w_i_d_g_R_e_c, _f_l_a_g_s))))
  19.  
  20.           int
  21.           TTTTkkkk____OOOOffffffffsssseeeetttt((((_t_y_p_e, _f_i_e_l_d))))
  22.  
  23.           int
  24.           TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeIIIInnnnffffoooo((((_i_n_t_e_r_p, _t_k_w_i_n, _s_p_e_c_s, _w_i_d_g_R_e_c, _a_r_g_v_N_a_m_e, _f_l_a_g_s))))
  25.  
  26.           TTTTkkkk____FFFFrrrreeeeeeeeOOOOppppttttiiiioooonnnnssss((((_s_p_e_c_s, _w_i_d_g_R_e_c, _d_i_s_p_l_a_y, _f_l_a_g_s))))                |
  27.  
  28.      AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  29.           Tcl_Interp      *_i_n_t_e_r_p    (in)      Interpreter to use  for
  30.                                                returning         error
  31.                                                messages.
  32.  
  33.           Tk_Window       _t_k_w_i_n      (in)      Window     used      to
  34.                                                represent        widget
  35.                                                (needed  to  set  up  X
  36.                                                resources).
  37.  
  38.           Tk_ConfigSpec   *_s_p_e_c_s     (in)      Pointer    to     table
  39.                                                specifying        legal
  40.                                                configuration   options
  41.                                                for this widget.
  42.  
  43.           int             _a_r_g_c       (in)      Number of arguments  in
  44.                                                _a_r_g_v.
  45.  
  46.           char            **_a_r_g_v     (in)      Command-line    options
  47.                                                for configuring widget.
  48.  
  49.           char            *_w_i_d_g_R_e_c   (in/out)  Points to widget record
  50.                                                structure.   Fields  in
  51.                                                this   structure    get
  52.                                                modified             by
  53.                                                TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt   to
  54.                                                hold      configuration
  55.                                                information.
  56.  
  57.           int             _f_l_a_g_s      (in)      If  non-zero,  then  it
  58.                                                specifies    an   OR-ed
  59.                                                combination  of   flags
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/23/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  71.  
  72.  
  73.  
  74.                                                that     control    the
  75.                                                processing           of
  76.                                                configuration
  77.                                                information.
  78.                                                TK_CONFIG_ARGV_ONLY
  79.                                                causes    the    option
  80.                                                database  and  defaults
  81.                                                to be ignored, and flag
  82.                                                bits TK_CONFIG_USER_BIT
  83.                                                and higher are used  to
  84.                                                selectively     disable
  85.                                                entries in _s_p_e_c_s.
  86.  
  87.           type name       _t_y_p_e       (in)      The name of the type of
  88.                                                a widget record.
  89.  
  90.           field name      _f_i_e_l_d      (in)      The name of a field  in
  91.                                                records of type _t_y_p_e.
  92.  
  93.           char            *_a_r_g_v_N_a_m_e  (in)      The name  used  on  Tcl
  94.                                                command  lines to refer
  95.                                                to a particular  option
  96.                                                (e.g.  when  creating a
  97.                                                widget or invoking  the
  98.                                                ccccoooonnnnffffiiiigggguuuurrrreeee        widget
  99.                                                command).  If non-NULL,
  100.                                                then   information   is
  101.                                                returned only for  this
  102.                                                option.   If NULL, then
  103.                                                information is returned
  104.                                                for    all    available
  105.                                                options.
  106.  
  107.           Display         *_d_i_s_p_l_a_y   (in)      Display      containing
  108.                                                widget  whose record is
  109.                                                being freed;  needed in
  110.                                                order    to   free   up
  111.                                                resources.
  112.      _________________________________________________________________
  113.  
  114.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  115.           TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt is called to configure various aspects of
  116.           a  widget,  such as colors, fonts, border width, etc.  It is
  117.           intended as a convenience procedure to reduce the amount  of
  118.           code  that  must be written in individual widget managers to
  119.           handle configuration information.  It is  typically  invoked
  120.           when  widgets  are  created,  and  again  when the ccccoooonnnnffffiiiigggguuuurrrreeee
  121.           command  is  invoked  for  a  widget.    Although   intended
  122.           primarily  for  widgets,  TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt  can be used in
  123.           other situations where _a_r_g_c-_a_r_g_v information is to  be  used
  124.           to fill in a record structure, such as configuring graphical
  125.           elements for a canvas widget or entries of a menu.
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 7/23/95)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  137.  
  138.  
  139.  
  140.           TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt  processes   a   table   specifying   the
  141.           configuration  options  that  are  supported  (_s_p_e_c_s)  and a
  142.           collection of command-line arguments (_a_r_g_c and _a_r_g_v) to fill
  143.           in  fields  of  a  record  (_w_i_d_g_R_e_c).   It  uses  the option
  144.           database and defaults specified in _s_p_e_c_s to fill  in  fields
  145.           of    _w_i_d_g_R_e_c    that    are    not   specified   in   _a_r_g_v.
  146.           TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt normally returns  the  value  TCL_OK;  in
  147.           this  case  it  does  not modify _i_n_t_e_r_p.  If an error occurs
  148.           then TCL_ERROR is returned and TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt will leave
  149.           an  error  message  in  _i_n_t_e_r_p->_r_e_s_u_l_t  in  the standard Tcl
  150.           fashion.  In the event of  an  error  return,  some  of  the
  151.           fields   of   _w_i_d_g_R_e_c   could  already  have  been  set,  if
  152.           configuration  information   for   them   was   successfully
  153.           processed  before the error occurred.  The other fields will  |
  154.           be set to reasonable initial values so  that  TTTTkkkk____FFFFrrrreeeeeeeeOOOOppppttttiiiioooonnnnssss  |
  155.           can be called for cleanup.
  156.  
  157.           The _s_p_e_c_s array specifies the kinds of configuration options
  158.           expected  by  the widget.  Each of its entries specifies one
  159.           configuration option and has the following structure:
  160.  
  161.                typedef struct {
  162.                    int _t_y_p_e;
  163.                    char *_a_r_g_v_N_a_m_e;
  164.                    char *_d_b_N_a_m_e;
  165.                    char *_d_b_C_l_a_s_s;
  166.                    char *_d_e_f_V_a_l_u_e;
  167.                    int _o_f_f_s_e_t;
  168.                    int _s_p_e_c_F_l_a_g_s;
  169.                    Tk_CustomOption *_c_u_s_t_o_m_P_t_r;                          |
  170.                } Tk_ConfigSpec;
  171.           The _t_y_p_e field indicates what type of  configuration  option
  172.           this   is  (e.g.  TK_CONFIG_COLOR  for  a  color  value,  or
  173.           TK_CONFIG_INT  for  an  integer  value).   The  _t_y_p_e   field
  174.           indicates  how  to use the value of the option (more on this
  175.           below).  The _a_r_g_v_N_a_m_e field is a string such as ``-font'' or
  176.           ``-bg'',  which  is  compared  with  the  values in _a_r_g_v (if
  177.           _a_r_g_v_N_a_m_e is NULL it means this  is  a  grouped  entry;   see
  178.           GROUPED  ENTRIES  below).  The _d_b_N_a_m_e and _d_b_C_l_a_s_s fields are
  179.           used to look up a  value  for  this  option  in  the  option
  180.           database.   The _d_e_f_V_a_l_u_e field specifies a default value for
  181.           this configuration option if no value is specified in either
  182.           _a_r_g_v  or  the  option  database.   _O_f_f_s_e_t indicates where in
  183.           _w_i_d_g_R_e_c  to  store  information  about  this   option,   and
  184.           _s_p_e_c_F_l_a_g_s  contains  additional  information  to control the
  185.           processing of this configuration option (see  FLAGS  below).
  186.           The   last  field,  _c_u_s_t_o_m_P_t_r,  is  only  used  if  _t_y_p_e  is
  187.           TK_CONFIG_CUSTOM;  see CUSTOM OPTION TYPES below.
  188.  
  189.           TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt first processes _a_r_g_v  to  see  which  (if
  190.           any)  configuration  options are specified there.  _A_r_g_v must
  191.  
  192.  
  193.      Page 3                                          (printed 7/23/95)
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  201.  
  202.  
  203.  
  204.           contain an even number of fields;  the first of each pair of
  205.           fields  must  match  the  _a_r_g_v_N_a_m_e  of  some  entry in _s_p_e_c_s
  206.           (unique abbreviations are acceptable), and the second  field
  207.           of  the  pair  contains  the  value  for  that configuration
  208.           option.  If there are entries in _s_p_e_c for which  there  were
  209.           no  matching  entries  in  _a_r_g_v, TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt uses the
  210.           _d_b_N_a_m_e and _d_b_C_l_a_s_s fields of the _s_p_e_c_s entry  to  probe  the
  211.           option  database;   if  a value is found, then it is used as
  212.           the value for the option.  Finally, if no entry is found  in
  213.           the  option  database, the _d_e_f_V_a_l_u_e field of the _s_p_e_c_s entry
  214.           is used as the value for the configuration option.   If  the
  215.           _d_e_f_V_a_l_u_e  is  NULL, or if the TK_CONFIG_DONT_SET_DEFAULT bit
  216.           is set in _f_l_a_g_s, then there is no  default  value  and  this
  217.           _s_p_e_c_s entry will be ignored if no value is specified in _a_r_g_v
  218.           or the option database.
  219.  
  220.           Once a string value has been determined for a  configuration
  221.           option,  TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt translates the string value into
  222.           a  more  useful  form,  such  as  a   color   if   _t_y_p_e   is
  223.           TK_CONFIG_COLOR  or  an  integer  if  _t_y_p_e is TK_CONFIG_INT.
  224.           This value is then  stored  in  the  record  pointed  to  by
  225.           _w_i_d_g_R_e_c.   This  record  is  assumed  to contain information
  226.           relevant to the manager of the widget;  its  exact  type  is
  227.           unknown  to  TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt.   The  _o_f_f_s_e_t field of each
  228.           _s_p_e_c_s  entry  indicates  where  in  _w_i_d_g_R_e_c  to  store   the
  229.           information about this configuration option.  You should use
  230.           the TTTTkkkk____OOOOffffffffsssseeeetttt macro to generate _o_f_f_s_e_t values (see below for
  231.           a  description  of  TTTTkkkk____OOOOffffffffsssseeeetttt).   The  location indicated by
  232.           _w_i_d_g_R_e_c and _o_f_f_s_e_t will be referred to as the ``target''  in
  233.           the descriptions below.
  234.  
  235.           The _t_y_p_e field of each entry in _s_p_e_c_s determines what to  do
  236.           with  the  string  value  of that configuration option.  The
  237.           legal values for _t_y_p_e, and the corresponding actions, are:
  238.  
  239.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____AAAACCCCTTTTIIIIVVVVEEEE____CCCCUUUURRRRSSSSOOOORRRR
  240.                The value must be an ASCII string identifying a  cursor  |
  241.                in  a  form  suitable  for passing to TTTTkkkk____GGGGeeeettttCCCCuuuurrrrssssoooorrrr. The  |
  242.                value is converted to a CCCCuuuurrrrssssoooorrrr by calling  TTTTkkkk____GGGGeeeettttCCCCuuuurrrrssssoooorrrr  |
  243.                and  the  result is stored in the target.  In addition,  |
  244.                the resulting cursor is  made  the  active  cursor  for  |
  245.                _t_k_w_i_n  by  calling XXXXDDDDeeeeffffiiiinnnneeeeCCCCuuuurrrrssssoooorrrr.  If TK_CONFIG_NULL_OK  |
  246.                is specified in _s_p_e_c_F_l_a_g_s then  the  value  may  be  an  |
  247.                empty  string,  in  which  case  the target and _t_k_w_i_n's  |
  248.                active cursor will be set to  NNNNoooonnnneeee.   If  the  previous  |
  249.                value  of  the  target wasn't NNNNoooonnnneeee, then it is freed by  |
  250.                passing it to TTTTkkkk____FFFFrrrreeeeeeeeCCCCuuuurrrrssssoooorrrr.                             |
  251.  
  252.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____AAAANNNNCCCCHHHHOOOORRRR                                                   ||
  253.                The value must be an ASCII string identifying an anchor  |
  254.                point in one of the ways accepted by TTTTkkkk____GGGGeeeettttAAAAnnnncccchhhhoooorrrr.  The  |
  255.                string   is   converted   to  a  TTTTkkkk____AAAAnnnncccchhhhoooorrrr  by  calling  |
  256.  
  257.  
  258.  
  259.      Page 4                                          (printed 7/23/95)
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  267.  
  268.  
  269.  
  270.                TTTTkkkk____GGGGeeeettttAAAAnnnncccchhhhoooorrrr and the result is stored in the target.
  271.  
  272.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____BBBBIIIITTTTMMMMAAAAPPPP
  273.                The value must be an ASCII string identifying a  bitmap
  274.                in  a  form  suitable for passing to TTTTkkkk____GGGGeeeettttBBBBiiiittttmmmmaaaapppp.  The
  275.                value is converted to a PPPPiiiixxxxmmmmaaaapppp by calling  TTTTkkkk____GGGGeeeettttBBBBiiiittttmmmmaaaapppp
  276.                and   the   result   is   stored  in  the  target.   If  |
  277.                TK_CONFIG_NULL_OK is specified in  _s_p_e_c_F_l_a_g_s  then  the  |
  278.                value  may be an empty string, in which case the target  |
  279.                is set to NNNNoooonnnneeee.  If the previous value  of  the  target
  280.                wasn't  NNNNoooonnnneeee,  then  it  is  freed  by  passing  it  to
  281.                TTTTkkkk____FFFFrrrreeeeeeeeBBBBiiiittttmmmmaaaapppp.
  282.  
  283.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____BBBBOOOOOOOOLLLLEEEEAAAANNNN
  284.                The value must be an ASCII string specifying a  boolean
  285.                value.  Any of the values ``true'', ``yes'', ``on'', or
  286.                ``1'', or an abbreviation of one of these values, means
  287.                true;  any of the values ``false'', ``no'', ``off'', or
  288.                ``0'', or an abbreviation of one of these values, means
  289.                false.   The  target is expected to be an integer;  for
  290.                true values it will be set to 1 and for false values it
  291.                will be set to 0.
  292.  
  293.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____BBBBOOOORRRRDDDDEEEERRRR
  294.                The value must be an ASCII string identifying a  border
  295.                color in a form suitable for passing to TTTTkkkk____GGGGeeeetttt3333DDDDBBBBoooorrrrddddeeeerrrr.
  296.                The value is converted to a (TTTTkkkk____3333DDDDBBBBoooorrrrddddeeeerrrr ****) by  calling
  297.                TTTTkkkk____GGGGeeeetttt3333DDDDBBBBoooorrrrddddeeeerrrr  and the result is stored in the target.  |
  298.                If TK_CONFIG_NULL_OK is specified in _s_p_e_c_F_l_a_g_s then the  |
  299.                value  may be an empty string, in which case the target  |
  300.                will be set to NULL.  If  the  previous  value  of  the
  301.                target  wasn't  NULL, then it is freed by passing it to
  302.                TTTTkkkk____FFFFrrrreeeeeeee3333DDDDBBBBoooorrrrddddeeeerrrr.
  303.  
  304.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____CCCCAAAAPPPP____SSSSTTTTYYYYLLLLEEEE
  305.                The value must be an ASCII  string  identifying  a  cap  |
  306.                style  in  one  of the ways accepted by TTTTkkkk____GGGGeeeettttCCCCaaaappppSSSSttttyyyylllleeee.  |
  307.                The  string  is   converted   to   an   integer   value  |
  308.                corresponding    to    the   cap   style   by   calling  |
  309.                TTTTkkkk____GGGGeeeettttCCCCaaaappppSSSSttttyyyylllleeee and the result is stored in the target.
  310.  
  311.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____CCCCOOOOLLLLOOOORRRR
  312.                The value must be an ASCII string identifying  a  color
  313.                in  a  form  suitable  for passing to TTTTkkkk____GGGGeeeettttCCCCoooolllloooorrrr.  The
  314.                value  is  converted  to  an  (XXXXCCCCoooolllloooorrrr  ****)  by   calling
  315.                TTTTkkkk____GGGGeeeettttCCCCoooolllloooorrrr and the result is stored in the target.  If  |
  316.                TK_CONFIG_NULL_OK is specified in  _s_p_e_c_F_l_a_g_s  then  the  |
  317.                value  may be an empty string, in which case the target  |
  318.                will be set to NNNNoooonnnneeee.  If  the  previous  value  of  the
  319.                target  wasn't  NULL, then it is freed by passing it to
  320.                TTTTkkkk____FFFFrrrreeeeeeeeCCCCoooolllloooorrrr.
  321.  
  322.  
  323.  
  324.  
  325.      Page 5                                          (printed 7/23/95)
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  333.  
  334.  
  335.  
  336.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____CCCCUUUURRRRSSSSOOOORRRR
  337.                This option  is  identical  to  TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____AAAACCCCTTTTIIIIVVVVEEEE____CCCCUUUURRRRSSSSOOOORRRR
  338.                except  that  the new cursor is not made the active one
  339.                for _t_k_w_i_n.
  340.  
  341.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____CCCCUUUUSSSSTTTTOOOOMMMM
  342.                This option allows applications to  define  new  option  |
  343.                types.   The  _c_u_s_t_o_m_P_t_r  field of the entry points to a  |
  344.                structure  defining  the  new  option  type.   See  the  |
  345.                section CUSTOM OPTION TYPES below for details.
  346.  
  347.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____DDDDOOOOUUUUBBBBLLLLEEEE
  348.                The value must be an ASCII floating-point number in the
  349.                format  accepted by ssssttttrrrrttttoooollll.  The string is converted to
  350.                a ddddoooouuuubbbblllleeee value, and the value is stored in the target.
  351.  
  352.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____EEEENNNNDDDD
  353.                Marks the end of the table.  The last  entry  in  _s_p_e_c_s
  354.                must  have  this  type;   all  of  its other fields are
  355.                ignored and it will never match any arguments.
  356.  
  357.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____FFFFOOOONNNNTTTT
  358.                The value must be an ASCII string identifying a font in
  359.                a  form  suitable for passing to TTTTkkkk____GGGGeeeettttFFFFoooonnnnttttSSSSttttrrrruuuucccctttt.  The
  360.                value is converted to an  (XXXXFFFFoooonnnnttttSSSSttttrrrruuuucccctttt  ****)  by  calling
  361.                TTTTkkkk____GGGGeeeettttFFFFoooonnnnttttSSSSttttrrrruuuucccctttt  and  the  result  is  stored  in  the
  362.                target.  If TK_CONFIG_NULL_OK is specified in _s_p_e_c_F_l_a_g_s  |
  363.                then  the  value  may be an empty string, in which case  |
  364.                the target will be set to NULL.  If the previous  value
  365.                of  the target wasn't NULL, then it is freed by passing
  366.                it to TTTTkkkk____FFFFrrrreeeeeeeeFFFFoooonnnnttttSSSSttttrrrruuuucccctttt.
  367.  
  368.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____IIIINNNNTTTT
  369.                The value must be an ASCII integer string in the format
  370.                accepted  by ssssttttrrrrttttoooollll (e.g. ``0'' and ``0x'' prefixes may
  371.                be  used  to  specify  octal  or  hexadecimal  numbers,
  372.                respectively).   The  string is converted to an integer
  373.                value and the integer is stored in the target.
  374.  
  375.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____JJJJOOOOIIIINNNN____SSSSTTTTYYYYLLLLEEEE
  376.                The value must be an ASCII string  identifying  a  join  |
  377.                style  in  one of the ways accepted by TTTTkkkk____GGGGeeeettttJJJJooooiiiinnnnSSSSttttyyyylllleeee.  |
  378.                The  string  is   converted   to   an   integer   value  |
  379.                corresponding    to   the   join   style   by   calling  |
  380.                TTTTkkkk____GGGGeeeettttJJJJooooiiiinnnnSSSSttttyyyylllleeee and the result is stored in the target.  |
  381.  
  382.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____JJJJUUUUSSSSTTTTIIIIFFFFYYYY                                                  ||
  383.                The  value  must  be  an  ASCII  string  identifying  a  |
  384.                justification method in one of  the  ways  accepted  by  |
  385.                TTTTkkkk____GGGGeeeettttJJJJuuuussssttttiiiiffffyyyy.  The string is converted to a TTTTkkkk____JJJJuuuussssttttiiiiffffyyyy  |
  386.                by calling TTTTkkkk____GGGGeeeettttJJJJuuuussssttttiiiiffffyyyy and the result  is  stored  in  |
  387.                the target.                                              |
  388.  
  389.  
  390.  
  391.      Page 6                                          (printed 7/23/95)
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  399.  
  400.  
  401.  
  402.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____MMMMMMMM                                                       ||
  403.                The  value must specify a screen distance in one of the  |
  404.                forms acceptable  to  TTTTkkkk____GGGGeeeettttSSSSccccrrrreeeeeeeennnnMMMMMMMM.   The  string  is  |
  405.                converted  to  double-precision floating-point distance  |
  406.                in millimeters and the value is stored in the target.    |
  407.  
  408.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____PPPPIIIIXXXXEEEELLLLSSSS                                                   ||
  409.                The value must specify screen units in one of the forms  |
  410.                acceptable to TTTTkkkk____GGGGeeeettttPPPPiiiixxxxeeeellllssss.  The string is converted to  |
  411.                an  integer  distance in pixels and the value is stored  |
  412.                in the target.
  413.  
  414.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____RRRREEEELLLLIIIIEEEEFFFF
  415.                The value must be an ASCII string identifying a  relief
  416.                in  a  form  suitable for passing to TTTTkkkk____GGGGeeeettttRRRReeeelllliiiieeeeffff.  The
  417.                value is  converted  to  an  integer  relief  value  by
  418.                calling  TTTTkkkk____GGGGeeeettttRRRReeeelllliiiieeeeffff  and  the result is stored in the
  419.                target.
  420.  
  421.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____SSSSTTTTRRRRIIIINNNNGGGG
  422.                A copy of the value is made by allocating memory  space  |
  423.                with   mmmmaaaalllllllloooocccc   and   copying   the   value   into  the  |
  424.                dynamically-allocated space.   A  pointer  to  the  new  |
  425.                string  is  stored in the target.  If TK_CONFIG_NULL_OK  |
  426.                is specified in _s_p_e_c_F_l_a_g_s then  the  value  may  be  an  |
  427.                empty  string,  in which case the target will be set to  |
  428.                NULL.  If the previous value of the target wasn't NULL,  |
  429.                then it is freed by passing it to ffffrrrreeeeeeee.
  430.  
  431.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____SSSSYYYYNNNNOOOONNNNYYYYMMMM
  432.                This _t_y_p_e value identifies  special  entries  in  _s_p_e_c_s
  433.                that  are synonyms for other entries.  If an _a_r_g_v value
  434.                matches the _a_r_g_v_N_a_m_e of a TK_CONFIG_SYNONYM entry,  the
  435.                entry  isn't used directly. Instead, TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt
  436.                searches _s_p_e_c_s for another entry whose _a_r_g_v_N_a_m_e is  the
  437.                same  as  the  _d_b_N_a_m_e  field  in  the TK_CONFIG_SYNONYM
  438.                entry;  this new entry is used just as if its  _a_r_g_v_N_a_m_e
  439.                had  matched  the  _a_r_g_v  value.   The synonym mechanism
  440.                allows multiple _a_r_g_v values to be  used  for  a  single
  441.                configuration   option,  such  as  ``-background''  and
  442.                ``-bg''.
  443.  
  444.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____UUUUIIIIDDDD
  445.                The value is translated to a TTTTkkkk____UUUUiiiidddd (by passing  it  to
  446.                TTTTkkkk____GGGGeeeettttUUUUiiiidddd).   The  resulting  value  is  stored  in the
  447.                target.  If TK_CONFIG_NULL_OK is specified in _s_p_e_c_F_l_a_g_s  |
  448.                and  the  value is an empty string then the target will  |
  449.                be set to NULL.                                          |
  450.  
  451.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____WWWWIIIINNNNDDDDOOOOWWWW                                                   ||
  452.                The value must be a window path name.  It is translated  |
  453.                to a TTTTkkkk____WWWWiiiinnnnddddoooowwww token and the token  is  stored  in  the  |
  454.  
  455.  
  456.  
  457.      Page 7                                          (printed 7/23/95)
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  465.  
  466.  
  467.  
  468.                target.
  469.  
  470.  
  471.      GGGGRRRROOOOUUUUPPPPEEEEDDDD EEEENNNNTTTTRRRRIIIIEEEESSSS
  472.           In some cases it is useful to  generate  multiple  resources
  473.           from  a  single  configuration  value.  For example, a color
  474.           name might be used both to generate the background color for
  475.           a  widget  (using  TK_CONFIG_COLOR)  and  to  generate a 3-D
  476.           border to draw around the widget  (using  TK_CONFIG_BORDER).
  477.           In  cases  like  this it is possible to specify that several
  478.           consecutive entries in _s_p_e_c_s are to be treated as  a  group.
  479.           The  first  entry  is  used  to determine a value (using its
  480.           _a_r_g_v_N_a_m_e, _d_b_N_a_m_e, _d_b_C_l_a_s_s, and _d_e_f_V_a_l_u_e fields).  The  value
  481.           will  be  processed several times (one for each entry in the
  482.           group),  generating   multiple   different   resources   and
  483.           modifying  multiple  targets  within  _w_i_d_g_R_e_c.   Each of the
  484.           entries after the first  must  have  a  NULL  value  in  its
  485.           _a_r_g_v_N_a_m_e  field;   this  indicates  that  the entry is to be
  486.           grouped with the entry that precedes it.  Only the _t_y_p_e  and
  487.           _o_f_f_s_e_t fields are used from these follow-on entries.
  488.  
  489.  
  490.      FFFFLLLLAAAAGGGGSSSS
  491.           The _f_l_a_g_s argument passed to TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt is  used  in
  492.           conjunction  with  the  _s_p_e_c_F_l_a_g_s  fields  in the entries of
  493.           _s_p_e_c_s to provide additional control over the  processing  of
  494.           configuration  options.   These  values  are  used  in three
  495.           different ways as described below.
  496.  
  497.           First, if the _f_l_a_g_s argument to TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt  has  the
  498.           TK_CONFIG_ARGV_ONLY     bit     set     (i.e.,    _f_l_a_g_s    |
  499.           TK_CONFIG_ARGV_ONLY != 0),  then  the  option  database  and
  500.           _d_e_f_V_a_l_u_e  fields are not used.  In this case, if an entry in
  501.           _s_p_e_c_s doesn't match a field in _a_r_g_v  then  nothing  happens:
  502.           the  corresponding  target  isn't modified.  This feature is
  503.           useful when the goal  is  to  modify  certain  configuration
  504.           options while leaving others in their current state, such as
  505.           when a ccccoooonnnnffffiiiigggguuuurrrreeee widget command is being processed.
  506.  
  507.           Second, the _s_p_e_c_F_l_a_g_s field of an entry in _s_p_e_c_s may be used  |
  508.           to  control  the  processing  of that entry.  Each _s_p_e_c_F_l_a_g_s  |
  509.           field may consists of an OR-ed combination of the  following  |
  510.           values:                                                       |
  511.  
  512.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____CCCCOOOOLLLLOOOORRRR____OOOONNNNLLLLYYYY                                               ||
  513.                If  this  bit  is  set  then  the  entry  will  only be  |
  514.                considered if the display for _t_k_w_i_n has more  than  one  |
  515.                bit  plane.   If the display is monochromatic then this  |
  516.                _s_p_e_c_s entry will be ignored.                             |
  517.  
  518.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____MMMMOOOONNNNOOOO____OOOONNNNLLLLYYYY                                                ||
  519.                If  this  bit  is  set  then  the  entry  will  only be  |
  520.  
  521.  
  522.  
  523.      Page 8                                          (printed 7/23/95)
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  531.  
  532.  
  533.  
  534.                considered if the display for _t_k_w_i_n has exactly one bit  |
  535.                plane.   If  the display is not monochromatic then this  |
  536.                _s_p_e_c_s entry will be ignored.                             |
  537.  
  538.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____NNNNUUUULLLLLLLL____OOOOKKKK                                                  ||
  539.                This  bit  is  only  relevant for some types of entries  |
  540.                (see  the  descriptions  of  the  various  entry  types  |
  541.                above).  If this bit is set, it indicates that an empty  |
  542.                string value for the field  is  acceptable  and  if  it  |
  543.                occurs  then  the target should be set to NULL or NNNNoooonnnneeee,  |
  544.                depending on the type of  the  target.   This  flag  is  |
  545.                typically  used  to  allow  a  feature to be turned off  |
  546.                entirely, e.g. set a cursor value to  NNNNoooonnnneeee  so  that  a  |
  547.                window  simply  inherits  its parent's cursor.  If this  |
  548.                bit isn't set  then  empty  strings  are  processed  as  |
  549.                strings, which generally results in an error.            |
  550.  
  551.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____DDDDOOOONNNNTTTT____SSSSEEEETTTT____DDDDEEEEFFFFAAAAUUUULLLLTTTT                                         ||
  552.                If this bit is one, it means that the _d_e_f_V_a_l_u_e field of  |
  553.                the entry should only be used for returning the default  |
  554.                value     in    TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeIIIInnnnffffoooo.     In    calls    to  |
  555.                TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt no  default  will  be  supplied  for  |
  556.                entries  with  this  flag  set;  it is assumed that the  |
  557.                caller has already supplied  a  default  value  in  the  |
  558.                target  location.   This  flag  provides  a performance  |
  559.                optimization where  it  is  expensive  to  process  the  |
  560.                default  string:   the  client  can compute the default  |
  561.                once, save the value, and  provide  it  before  calling  |
  562.                TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt.                                      |
  563.  
  564.           TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGG____OOOOPPPPTTTTIIIIOOOONNNN____SSSSPPPPEEEECCCCIIIIFFFFIIIIEEEEDDDD                                         ||
  565.                This  bit  is  set  and  cleared by TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt.  |
  566.                Whenever TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt returns, this bit  will  be  |
  567.                set  in  all the entries where a value was specified in  |
  568.                _a_r_g_v.  It will be zero in all other entries.  This  bit  |
  569.                provides  a  way  for clients to determine which values  |
  570.                actually changed in a call to TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt.
  571.  
  572.           The TK_CONFIG_MONO_ONLY and TK_CONFIG_COLOR_ONLY  flags  are
  573.           typically  used  to  specify  different  default  values for
  574.           monochrome and color displays.  This is done by creating two
  575.           entries  in  _s_p_e_c_s  that  are  identical  except  for  their
  576.           _d_e_f_V_a_l_u_e and _s_p_e_c_F_l_a_g_s fields.  One entry  should  have  the
  577.           value  TK_CONFIG_MONO_ONLY  in its _s_p_e_c_F_l_a_g_s and the default
  578.           value for monochrome displays in its  _d_e_f_V_a_l_u_e;   the  other
  579.           entry  entry  should  have the value TK_CONFIG_COLOR_ONLY in
  580.           its  _s_p_e_c_F_l_a_g_s  and  the  appropriate  _d_e_f_V_a_l_u_e  for   color
  581.           displays.
  582.  
  583.           Third, it is possible to use _f_l_a_g_s and _s_p_e_c_F_l_a_g_s together to
  584.           selectively  disable  some  entries.   This  feature  is not
  585.           needed very often.  It is  useful  in  cases  where  several
  586.  
  587.  
  588.  
  589.      Page 9                                          (printed 7/23/95)
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  597.  
  598.  
  599.  
  600.           similar  kinds  of widgets are implemented in one place.  It
  601.           allows a single _s_p_e_c_s table  to  be  created  with  all  the
  602.           configuration  options  for  all  the  widget  types.   When
  603.           processing a particular widget type, only  entries  relevant
  604.           to  that  type  will  be  used.   This effect is achieved by
  605.           setting the high-order bits (those in positions equal to  or
  606.           greater  than  TK_CONFIG_USER_BIT) in _s_p_e_c_F_l_a_g_s values or in
  607.           _f_l_a_g_s.  In order for a particular entry in _s_p_e_c_s to be used,
  608.           its  high-order  bits must match exactly the high-order bits
  609.           of the _f_l_a_g_s value passed to TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt.  If a _s_p_e_c_s
  610.           table  is being used for N different widget types, then N of
  611.           the high-order bits will be used.   Each  _s_p_e_c_s  entry  will
  612.           have one of more of those bits set in its _s_p_e_c_F_l_a_g_s field to
  613.           indicate the widget types for which  this  entry  is  valid.
  614.           When  calling  TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt,  _f_l_a_g_s will have a single
  615.           one of these bits set to select the entries for the  desired
  616.           widget type.  For a working example of this feature, see the
  617.           code in tkButton.c.
  618.  
  619.  
  620.      TTTTKKKK____OOOOFFFFFFFFSSSSEEEETTTT
  621.           The TTTTkkkk____OOOOffffffffsssseeeetttt macro is provided as a safe way of  generating
  622.           the  _o_f_f_s_e_t  values for entries in Tk_ConfigSpec structures.
  623.           It takes two arguments:  the name of a type of  record,  and
  624.           the  name  of  a  field in that record.  It returns the byte
  625.           offset of the named field in records of the given type.
  626.  
  627.  
  628.      TTTTKKKK____CCCCOOOONNNNFFFFIIIIGGGGUUUURRRREEEEIIIINNNNFFFFOOOO
  629.           The  TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeIIIInnnnffffoooo  procedure  may  be  used  to   obtain
  630.           information  about  one  or  all  of the options for a given
  631.           widget.  Given  a  token  for  a  window  (_t_k_w_i_n),  a  table
  632.           describing  the configuration options for a class of widgets
  633.           (_s_p_e_c_s), a pointer to a widget record containing the current
  634.           information  for  a  widget  (_w_i_d_g_R_e_c),  and a NULL _a_r_g_v_N_a_m_e
  635.           argument, TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeIIIInnnnffffoooo generates a string describing all
  636.           of  the configuration options for the window.  The string is
  637.           placed in _i_n_t_e_r_p->_r_e_s_u_l_t.   Under  normal  circumstances  it
  638.           returns   TCL_OK;   if  an  error  occurs  then  it  returns
  639.           TCL_ERROR and _i_n_t_e_r_p->_r_e_s_u_l_t contains an error message.
  640.  
  641.           If _a_r_g_v_N_a_m_e is NULL, then the value left  in  _i_n_t_e_r_p->_r_e_s_u_l_t
  642.           by  TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeIIIInnnnffffoooo  consists  of  a  list  of  one or more
  643.           entries, each of which describes  one  configuration  option
  644.           (i.e.  one  entry  in  _s_p_e_c_s).   Each entry in the list will
  645.           contain either two or five  values.   If  the  corresponding
  646.           entry  in  _s_p_e_c_s  has  type TK_CONFIG_SYNONYM, then the list
  647.           will contain two values:  the _a_r_g_v_N_a_m_e for the entry and the
  648.           _d_b_N_a_m_e (synonym name).  Otherwise the list will contain five
  649.           values:  _a_r_g_v_N_a_m_e, _d_b_N_a_m_e, _d_b_C_l_a_s_s,  _d_e_f_V_a_l_u_e,  and  current
  650.           value.   The  current value is computed from the appropriate
  651.           field of _w_i_d_g_R_e_c by calling procedures like TTTTkkkk____NNNNaaaammmmeeeeOOOOffffCCCCoooolllloooorrrr.
  652.  
  653.  
  654.  
  655.      Page 10                                         (printed 7/23/95)
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  663.  
  664.  
  665.  
  666.           If the _a_r_g_v_N_a_m_e argument to  TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeIIIInnnnffffoooo  is  non-NULL,
  667.           then  it  indicates  a  single  option,  and  information is
  668.           returned  only  for  that  option.   The  string  placed  in
  669.           _i_n_t_e_r_p->_r_e_s_u_l_t  will be a list containing two or five values
  670.           as  described  above;   this  will  be  identical   to   the
  671.           corresponding  sublist  that  would  have  been  returned if
  672.           _a_r_g_v_N_a_m_e had been NULL.
  673.  
  674.           The _f_l_a_g_s argument to TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeIIIInnnnffffoooo is used  to  restrict
  675.           the    _s_p_e_c_s    entries    to    consider,   just   as   for
  676.           TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt.
  677.  
  678.  
  679.      TTTTKKKK____FFFFRRRREEEEEEEEOOOOPPPPTTTTIIIIOOOONNNNSSSS
  680.           The TTTTkkkk____FFFFrrrreeeeeeeeOOOOppppttttiiiioooonnnnssss procedure may be  invoked  during  widget  |
  681.           cleanup  to  release  all  of  the resources associated with  |
  682.           configuration options.  It scans through _s_p_e_c_s and for  each  |
  683.           entry  corresponding  to  a resource that must be explicitly  |
  684.           freed (e.g. those with type TK_CONFIG_COLOR), it  frees  the  |
  685.           resource  in  the widget record.  If the field in the widget  |
  686.           record doesn't refer to a resource (e.g.  it contains a null  |
  687.           pointer)  then  no  resource is freed for that entry.  After  |
  688.           freeing a resource, TTTTkkkk____FFFFrrrreeeeeeeeOOOOppppttttiiiioooonnnnssss  sets  the  corresponding  |
  689.           field of the widget record to null.
  690.  
  691.  
  692.      CCCCUUUUSSSSTTTTOOOOMMMM OOOOPPPPTTTTIIIIOOOONNNN TTTTYYYYPPPPEEEESSSS
  693.           Applications can extend  the  built-in  configuration  types  |
  694.           with additional configuration types by writing procedures to  |
  695.           parse and print  options  of  the  a  type  and  creating  a  |
  696.           structure pointing to those procedures:                       |
  697.  
  698.                typedef struct Tk_CustomOption {                         |
  699.                    Tk_OptionParseProc *_p_a_r_s_e_P_r_o_c;                       |
  700.                    Tk_OptionPrintProc *_p_r_i_n_t_P_r_o_c;                       |
  701.                    ClientData _c_l_i_e_n_t_D_a_t_a;                               |
  702.                } Tk_CustomOption;                                       |
  703.  
  704.                typedef int Tk_OptionParseProc(                          |
  705.                    ClientData _c_l_i_e_n_t_D_a_t_a,                               |
  706.                    Tcl_Interp *_i_n_t_e_r_p,                                  |
  707.                    Tk_Window _t_k_w_i_n,                                     |
  708.                    char *_v_a_l_u_e,                                         |
  709.                    char *_w_i_d_g_R_e_c,                                       |
  710.                    int _o_f_f_s_e_t);                                         |
  711.  
  712.                typedef char *Tk_OptionPrintProc(                        |
  713.                    ClientData _c_l_i_e_n_t_D_a_t_a,                               |
  714.                    Tk_Window _t_k_w_i_n,                                     |
  715.                    char *_w_i_d_g_R_e_c,                                       |
  716.                    int _o_f_f_s_e_t,                                          |
  717.                    Tcl_FreeProc **_f_r_e_e_P_r_o_c_P_t_r);                         |
  718.  
  719.  
  720.  
  721.      Page 11                                         (printed 7/23/95)
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  729.  
  730.  
  731.  
  732.           The Tk_CustomOption structure contains three  fields,  which  |
  733.           are pointers to the two procedures and a _c_l_i_e_n_t_D_a_t_a value to  |
  734.           be passed to those procedures when they  are  invoked.   The  |
  735.           _c_l_i_e_n_t_D_a_t_a  value typically points to a structure containing  |
  736.           information that is needed by the procedures when  they  are  |
  737.           parsing and printing options.                                 |
  738.  
  739.           The _p_a_r_s_e_P_r_o_c procedure is invoked by TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt  to  |
  740.           parse  a  string and store the resulting value in the widget  |
  741.           record.  The _c_l_i_e_n_t_D_a_t_a argument is a copy of the _c_l_i_e_n_t_D_a_t_a  |
  742.           field in the Tk_CustomOption structure.  The _i_n_t_e_r_p argument  |
  743.           points to a Tcl interpreter used for error reporting.  _T_k_w_i_n  |
  744.           is  a copy of the _t_k_w_i_n argument to TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt.  The  |
  745.           _v_a_l_u_e argument is a string  describing  the  value  for  the  |
  746.           option;  it could have been specified explicitly in the call  |
  747.           to TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt or  it  could  come  from  the  option  |
  748.           database  or  a default.  _V_a_l_u_e will never be a null pointer  |
  749.           but it may point to an empty string.  _R_e_c_o_r_d_P_t_r is the  same  |
  750.           as the _w_i_d_g_R_e_c argument to TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt;  it points to  |
  751.           the  start  of  the  widget  record  to  modify.   The  last  |
  752.           argument,  _o_f_f_s_e_t,  gives the offset in bytes from the start  |
  753.           of the widget record to the location where the option  value  |
  754.           is  to be placed.  The procedure should translate the string  |
  755.           to whatever form is appropriate for the option and store the  |
  756.           value  in  the  widget  record.   It  should normally return  |
  757.           TCL_OK, but if an error occurs in translating the string  to  |
  758.           a  value  then it should return TCL_ERROR and store an error  |
  759.           message in _i_n_t_e_r_p->_r_e_s_u_l_t.                                    |
  760.  
  761.           The _p_r_i_n_t_P_r_o_c procedure is  called  by  TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeIIIInnnnffffoooo  to  |
  762.           produce  a  string value describing an existing option.  Its  |
  763.           _c_l_i_e_n_t_D_a_t_a, _t_k_w_i_n, _w_i_d_g_R_e_c, and _o_f_f_s_e_t  arguments  all  have  |
  764.           the  same meaning as for Tk_OptionParseProc procedures.  The  |
  765.           _p_r_i_n_t_P_r_o_c procedure should examine the option whose value is  |
  766.           stored  at  _o_f_f_s_e_t  in  _w_i_d_g_R_e_c, produce a string describing  |
  767.           that option, and return a pointer to  the  string.   If  the  |
  768.           string  is  stored in dynamically-allocated memory, then the  |
  769.           procedure  must  set  *_f_r_e_e_P_r_o_c_P_t_r  to  the  address  of   a  |
  770.           procedure   to   call   to   free   the   string's   memory;  |
  771.           TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeIIIInnnnffffoooo  will  call  this  procedure  when  it   is  |
  772.           finished with the string.  If the result string is stored in  |
  773.           static memory then _p_r_i_n_t_P_r_o_c need not do anything  with  the  |
  774.           _f_r_e_e_P_r_o_c_P_t_r argument.                                         |
  775.  
  776.           Once  _p_a_r_s_e_P_r_o_c  and  _p_r_i_n_t_P_r_o_c  have  been  defined  and  a  |
  777.           Tk_CustomOption structure has been created for them, options  |
  778.           of this new  type  may  be  manipulated  with  Tk_ConfigSpec  |
  779.           entries  whose  _t_y_p_e  fields  are TK_CONFIG_CUSTOM and whose  |
  780.           _c_u_s_t_o_m_P_t_r fields point to the Tk_CustomOption structure.
  781.  
  782.  
  783.      EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  784.  
  785.  
  786.  
  787.      PPPPaaaaggggeeee 11112222                                         ((((pppprrrriiiinnnntttteeeedddd 7777////22223333////99995555))))
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.      TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))       TTTTkkkk ((((3333....3333))))        TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt((((3333))))
  795.  
  796.  
  797.  
  798.           Although the explanation  of  TTTTkkkk____CCCCoooonnnnffffiiiigggguuuurrrreeeeWWWWiiiiddddggggeeeetttt  is  fairly
  799.           complicated,  its actual use is pretty straightforward.  The
  800.           easiest way to get started is  to  copy  the  code  from  an
  801.           existing  widget.   The  library  implementation  of  frames
  802.           (tkFrame.c)  has  a  simple  configuration  table,  and  the
  803.           library  implementation  of  buttons (tkButton.c) has a much
  804.           more complex table that uses many  of  the  fancy  _s_p_e_c_F_l_a_g_s
  805.           mechanisms.
  806.  
  807.  
  808.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  809.           anchor,  bitmap,  boolean,   border,   cap   style,   color,
  810.           configuration   options,   cursor,   custom,  double,  font,
  811.           integer, join style, justify, millimeters,  pixels,  relief,
  812.           synonym, uid
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.      Page 13                                         (printed 7/23/95)
  854.  
  855.  
  856.  
  857.