New mega-widgets built using [incr Tk] should be derived from
either itk::Widget
or
itk::Toplevel
. Both classes are subclasses of
itk::Archetype
.
The following methods are built into all mega-widgets. For a mega-widget having the Tk name pathName, the following methods are supported:
pathname
cget
-option
Return the current value of option option.
pathname
componentReturn a list of the well-known components.
pathname
component name
command
[arg
...]Invoke the given command command as a method on the component called name, optionally with additional arguments.
pathname
configureReturn a list describing all of the available options.
pathname
configure -optionReturn the current value of option
option
.
pathname
configure -option
value
...Set the value of option option
to value
. Multiple option-value pairs
can be supplied.
The cget and configure commands work just like the corresponding Tk widget commands.
These methods are used in the implementation of a mega-widget:
itk_component add [-protected
] [-private
] [--]symbolicName
{widget pathName
[arg
...] } [ { ignore -option
... keep -option
... rename -option -newName resourceClass resourceClass
usual [tag
] } ]
Commands in this format create a widget and register it as a mega-widget component. The optional block containing ignore, keep, rename, and usual commands controls how the configuration options for this component are merged into the master option list for the mega-widget.
Ignore
removes one or more configuration
options from the composite list (the default behavior).
Keep
integrates one or more configuration options
into the composite list, keeping them the same. Rename integrates the
configuration option into the composite list with a different name.
Usual
finds the usual option handling commands for
the specified tag name and executes them.
itk_option add optName
...Add an option that was previously ignored back into the master option list.
Remove an option that was previously merged into the master option list.
option
resourceName resourceClass init
[configBody
]Define a new configuration option for a mega-widget class.
option
value
...]Called when a mega-widget is constructed to initialize the master option list.
The following variables can be accessed within a mega-widget class:
itk_option
(symbolicName
)An array element containing the Tk window pathname for the
component named symbolicName
.
itk_interior
Contains the name of the top-level widget or frame within a mega-widget that acts as a container for new components.
itk_option
(-option
)An array element containing the current value of the
configuration option named
option
.