1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#------------------------------------------------------------------------------
# Copyright (c) 2013-2025, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from atom.api import Typed, ForwardTyped
from .container import Container
from .widget import Widget, ProxyWidget
class ProxyStackItem(ProxyWidget):
""" The abstract definition of a proxy StackItem object.
"""
#: A reference to the StackItem declaration.
declaration = ForwardTyped(lambda: StackItem)
class StackItem(Widget):
""" A widget which can be used as an item in a Stack.
A StackItem is a widget which can be used as a child of a Stack
widget. It can have at most a single child widget which is an
instance of Container.
"""
#: A reference to the ProxyStackItem object.
proxy = Typed(ProxyStackItem)
def stack_widget(self):
""" Get the stack widget defined for the item.
The stack widget is the last child Container.
"""
for child in reversed(self.children):
if isinstance(child, Container):
return child
|