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 42 43 44 45 46 47 48 49 50 51 52
|
#------------------------------------------------------------------------------
# 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, Str
from enaml.core.declarative import d_
from enaml.icon import Icon
from .widget import Widget, ProxyWidget
class ProxyMdiWindow(ProxyWidget):
""" The abstract definition of a proxy MdiWindow.
"""
#: A reference to the MdiWindow declaration.
declaration = ForwardTyped(lambda: MdiWindow)
def set_title(self, title):
raise NotImplementedError
def set_icon(self, icon):
raise NotImplementedError
class MdiWindow(Widget):
""" A widget which can be used as a window in an MdiArea.
An MdiWindow is a widget which can be used as an independent window
in an MdiArea. It can have at most a single child widget which is
an instance of Widget.
"""
#: The titlebar text.
title = d_(Str())
#: The title bar icon.
icon = d_(Typed(Icon))
def mdi_widget(self):
""" Get the mdi widget defined for the window.
The last Widget child is the mdi widget.
"""
for child in reversed(self.children):
if isinstance(child, Widget):
return child
|