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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
# Thanks for using Enthought open source!
#
# Author: Enthought, Inc.
# Description: <Enthought pyface package component>
#------------------------------------------------------------------------------
""" The interface of a top-level application window. """
# Enthought library imports.
from enthought.traits.api import Instance
# Local imports.
from action.api import MenuBarManager, StatusBarManager, ToolBarManager
from image_resource import ImageResource
from i_window import IWindow
class IApplicationWindow(IWindow):
""" The interface for a top-level application window.
The application window has support for a menu bar, tool bar and a status
bar (all of which are optional).
Usage: Create a sub-class of this class and override the protected
'_create_contents' method.
"""
#### 'IApplicationWindow' interface #######################################
# The window icon. The default is toolkit specific.
icon = Instance(ImageResource)
# The menu bar manager (None iff there is no menu bar).
menu_bar_manager = Instance(MenuBarManager)
# The status bar manager (None iff there is no status bar).
status_bar_manager = Instance(StatusBarManager)
# The tool bar manager (None iff there is no tool bar).
tool_bar_manager = Instance(ToolBarManager)
###########################################################################
# Protected 'IApplicationWindow' interface.
###########################################################################
def _create_contents(self, parent):
""" Create and return the window's contents.
parent is the parent control.
"""
def _create_menu_bar(self, parent):
""" Creates the menu bar (if required).
parent is the parent control.
"""
def _create_status_bar(self, parent):
""" Creates the status bar (if required).
parent is the parent control.
"""
def _create_tool_bar(self, parent):
""" Creates the tool bar (if required).
parent is the parent control.
"""
def _create_trim_widgets(self, parent):
""" Creates the 'trim' widgets (the widgets around the window).
parent is the parent control.
"""
def _set_window_icon(self):
""" Sets the window icon (if required). """
class MApplicationWindow(object):
""" The mixin class that contains common code for toolkit specific
implementations of the IApplicationWindow interface.
Implements: _create_trim_widgets()
"""
###########################################################################
# Protected 'IApplicationWindow' interface.
###########################################################################
def _create_trim_widgets(self, parent):
""" Creates the 'trim' widgets (the widgets around the window). """
# All of these are optional.
self._set_window_icon()
self._create_menu_bar(parent)
self._create_tool_bar(parent)
self._create_status_bar(parent)
return
#### EOF ######################################################################
|