Home | Trees | Indices | Help |
|
---|
|
1 # Copyright (C) 2010 Jim Washington 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 from pyjamas import Factory 16 from pyjamas import DOM 17 from pyjamas.ui.Widget import Widget 18 from pyjamas.ui.MouseListener import MouseHandler 19 from pyjamas.ui.DragHandler import DragHandler 20 from pyjamas.dnd import makeDraggable, DNDHelper 21 import pyjd 2224 """ 25 Mix-in class for a draggable widget. 26 Override DragHandler on*** methods to enable drag behavior. 27 28 At runtime, we change the implementation based on html5 29 dra-and-drop capabilities of the engine. 30 """ 31 pass32 3335 """ 36 mixin providing drag handlers for contained draggables 37 events bubble up to here. event.target will be the actual draggable 38 39 This class is the same as DragWidget, but does not make itself draggable. 40 41 At runtime, we change the implementation based on html5 42 drag-and-drop capabilities of the engine. 43 """ 44 pass45 46 50 5158 5954 if (not hasattr(self, 'attached')) or kw: 55 Widget.__init__(self, **kw) 56 DragHandler.__init__(self) 57 self.addDragListener(self)68 69 74 75 80 8162 if (not hasattr(self, 'attached')) or kw: 63 Widget.__init__(self, **kw) 64 MouseHandler.__init__(self) 65 self.addMouseListener(DNDHelper.dndHelper) 66 DragHandler.__init__(self) 67 self.addDragListener(self)83 global DragWidget, DragContainer 84 if is_native is None: 85 html5_dnd = hasattr(DOM.createElement('span'), 'draggable') 86 else: 87 html5_dnd = is_native 88 if html5_dnd: 89 DragContainer = Html5DragContainer 90 DragWidget = Html5DragWidget 91 else: 92 DragContainer = MouseDragContainer 93 DragWidget = MouseDragWidget94 95 if pyjd.is_desktop: 96 init(pyjd.native_dnd) 97 else: 98 init(None) 99 100 Factory.registerClass('pyjamas.ui.DragWidget', 'DragWidget', DragWidget) 101 Factory.registerClass('pyjamas.ui.DragWidget', 'DragContainer', DragContainer) 102
Home | Trees | Indices | Help |
|
---|
http://epydoc.sourceforge.net |