The Renderer
class supports z-axis
layering by drawing and keeping widgets on top of others as
shown in the figure beneath. Layers are set up automatically,
whenever a widget with a certain depth does not match the
existing layers. Thus you usually will not have to deal with the
layer internals of the Renderer
class,
but instead adjust the layers using the different
widgets. Sometimes it might be necessary to manually adjust
portions of the layer behaviour, especially if layers should be
activated automatically on certain actions.
The currently active layer, which has the input focus, can be
get and set using the active_layer
attribute or set_active_layer()
method.
layer = renderer.active_layer renderer.set_active_layer (2)
an list containing the indices of the attached widgets for keyboard navigation,
a list containing the widgets attached to the layer,
an EventManager
subclass, which
deals with the events sent to the layer.
You should not modify the contents nor the objects directly but
instead use the respective Renderer
methods instead.
The set_active_layer()
methods accepts
both, a tuple as returned by active_layer
as well as an integer, which denotes the layer to activate
(similarily to the depth attribute of the
BaseWidget
class).
Both, the method and attribute, allow you to manipulate the active layer directly, so that you can enforce the focus on a certain dialog window for example.
It is also possible to cycle through the layers
programmatically,using the
switch_layer()
method. The figure
beaneath shows, what happens on each invocation.
renderer.switch_layer () # Step 1 renderer.switch_layer () # Step 2 renderer.switch_layer () # Step 3
To enhance the accessibility of widgets on the screen, the
Renderer
implements the
IIndexable
interface class to let the
user navigate through widgets using the keyboard. Each installed
layer manages its own indexing list, so that the navigation by
default always happens on the currently active layer.
The Renderer
determines the order,
widgets are navigated through, using their
index attribute. The invocation of
switch_index()
will set the keyboard
focus to the widget with the next higher
index value. If the last widget is reached,
the first widget will receive the focus again as shown in the
figure below.