TK.ChildWidget

new ChildWidget(widget, name, config)

Defines a TK.Widget as a child for another widget. This function is used internally to simplify widget definitions. E.g. the TK.Icon of a TK.Button is defined as a TK.ChildWidget. TK.ChildWidgets are created/added after the initialization of the parent widget. If not configured explicitly, all options of the child widget can be accessed via TK.Widget.options[config.name + "." + option] on the parent widget.

Parameters:
Name Type Description
widget TK.Widget

The TK.Widget to add the TK.ChildWidget to.

name string

The identifier of the element inside the parent Element, TK.Widget[config.name].

config object

The configuration of the child element.

Properties:
Name Type Attributes Default Description
config.create TK.Widget

A TK.Widget class derivate to be used as child widget.

config.fixed boolean <optional>

A fixed child widget cannot be removed after initialization.

config.show boolean <optional>
false

Show/hide a non-fixed child widget on initialization.

config.option string <optional>
"show_"+config.name

A custom option of the parent widget to determine the visibility of the child element. If this is null, TK.Widget.options["show_"+ config.name] is used to toggle its visibility. The child element is visible, if this options is !== false.

config.append function <optional>

A function overriding the generic append mechanism. If not null, this function is supposed to take care of adding the child widget to the parent widgets DOM. Otherwise the element of the child widget is added to the element of the parent widget.

config.inherit_options boolean <optional>
false

Defines if both widgets share the same set of options. If true, Setting an option on the parent widget also sets the same option on the child widget. If false, the options of the child widget can be accessed via options[config.name + "." + option] in the parent widget.

config.map_options array <optional>
[<Object>]

A list of options to be mapped between parent and child. Keys are the options to be added to the parent, values the options names in the child widget. names in the parent to which the childrens options (defined as values) are mapped to. If one of these options is set on the parent widget, it also gets set on the child widget. This is a fine-grained version of config.inherit-options.

config.userset_ignore boolean <optional>
false

Do not care about the userset event of the parent widget, only keep track of set.

config.userset_delegate boolean <optional>
false

Delegates all user interaction from the child to the parent element. If the user triggers an event on the child widget, the userset function of the parent element is called.

config.static_events array <optional>
[]

An array of static events to be added to the parent widget. Each entry is a mapping between the name of the event and the callback function.

config.toggle_class boolean <optional>
false

Defines if the parent widget receives the class toolkit-has-[name] as soon as the child element is shown.

config.blacklist_options array.<string> <optional>

Array containing options names which are skipped on inherit_options.

Source: