#  Copyright (c) 1990 The Regents of the University of California.
#  Copyright (c) 1994-1996 Sun Microsystems, Inc.
#  See the file "license.terms" for information on usage and redistribution
#  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
#

=head1 NAME

option - Add/retrieve window options to/from the option database

=for category Creating and Configuring Widgets

=head1 SYNOPSIS

I<$widget>-E<gt>B<optionAdd>(I<pattern>=E<gt>I<value >?,I<priority>?)

I<$widget>-E<gt>B<optionClear>

I<$widget>-E<gt>B<optionGet>(I<name,class>)

I<$widget>-E<gt>B<optionReadfile>(I<fileName>?,I<priority>?)

=head1 DESCRIPTION

The B<option> methods allow you to add entries to the Tk option
database or to retrieve options from the database.  The B<optionAdd>
method adds a new option to the database.
I<Pattern> contains
the option being specified, and consists of names and/or classes
separated by asterisks or dots, in the usual X format.  I<Value>
contains a text string to associate with I<pattern>;  this is the
value that will be returned in calls to B<Tk_GetOption> or by
invocations of the B<optionGet> method.  If I<priority>
is specified, it indicates the priority level for this option
(see below for legal values);  it defaults to B<interactive>.
This method always returns an empty string.

The B<optionClear> method clears the option database.  Default
options (from the
B<RESOURCE_MANAGER> property or the B<.Xdefaults>
file) will be reloaded automatically the next time an
option is added to the database or removed from it.  This method
always returns an empty string.

The B<optionGet> method returns the value of the option
specified for I<$widget> under I<name> and I<class>.
The "pathname" to I<$widget> from its B<MainWindow>
and the classes of the widgets that "path" passes through
are used to determine the prefix to use when looking up the option.
(The B<MainWindow>'s name is the B<appname> and its class
is (by default) derived from the name of the script.)

If several entries in the option
database match I<$widget>, I<name>, and I<class>, then
the method returns whichever was created with highest
I<priority> level.  If there are several matching
entries at the same priority level, then it returns whichever entry
was I<most recently entered> into the option database.  If there are
no matching entries, then the empty string is returned.

The B<optionReadfile> method reads I<fileName>,
which should have the standard format for an
X resource database such as B<.Xdefaults>, and adds all the
options specified in that file to the option database.  If I<priority>
is specified, it indicates the priority level at which to enter the
options;  I<priority> defaults to B<interactive>.

The I<priority> arguments to the B<option> methods are
normally specified symbolically using one of the following values:

=over 4

=item B<widgetDefault>

Level 20.  Used for default values hard-coded into widgets.

=item B<startupFile>

Level 40.  Used for options specified in application-specific
startup files.

=item B<userDefault>

Level 60.  Used for options specified in user-specific defaults
files, such as B<.Xdefaults>, resource databases loaded into
the X server, or user-specific startup files.

=item B<interactive>

Level 80.  Used for options specified interactively after the application
starts running.  If I<priority> isn't specified, it defaults to
this level.

=back

Any of the above keywords may be abbreviated.  In addition, priorities
may be specified numerically using integers between 0 and 100,
inclusive.  The numeric form is probably a bad idea except for new priority
levels other than the ones given above.

=head1 BUGS

The priority scheme used by core Tk is not the same as used by normal Xlib
routines. In particular is assumes that the order of the entries is defined,
but user commands like B<xrdb -merge> can change the order.

=head1 KEYWORDS

database, option, priority, retrieve
