1# ------------------------------------------------------------------------------
2#
3#  Copyright (c) 2008, Enthought, Inc.
4#  All rights reserved.
5#
6#  This software is provided without warranty under the terms of the BSD
7#  license included in LICENSE.txt and may be redistributed only
8#  under the conditions described in the aforementioned license.  The license
9#  is also available online at http://www.enthought.com/licenses/BSD.txt
10#
11#  Thanks for using Enthought open source!
12#
13#  Author: David C. Morrill
14#
15# ------------------------------------------------------------------------------
16
17""" Defines the title editor factory for all traits toolkit backends.
18"""
19
20
21
22from traits.api import Bool
23from ..editor_factory import EditorFactory
24from ..toolkit import toolkit_object
25
26
27class ToolkitEditorFactory(EditorFactory):
28    """ Editor factory for Title editors.
29    """
30
31    allow_selection = Bool(False)
32
33    def _get_simple_editor_class(self):
34        """ Returns the editor class to use for "simple" style views.
35        The default implementation tries to import the SimpleEditor class in the
36        editor file in the backend package, and if such a class is not to found
37        it returns the SimpleEditor class defined in editor_factory module in
38        the backend package.
39
40        """
41        SimpleEditor = toolkit_object("title_editor:SimpleEditor")
42        return SimpleEditor
43
44
45# -------------------------------------------------------------------------
46#  Create the editor factory object:
47# -------------------------------------------------------------------------
48TitleEditor = ToolkitEditorFactory
49