Home | Trees | Indices | Help |
|
---|
|
1 # Copyright 2006 James Tauber and contributors 2 # Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net> 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 from pyjamas import DOM 16 from pyjamas import Factory 17 18 19 from Composite import Composite 20 from pyjamas.ui import Event 21 from pyjamas.ui import Focus 22 from SimplePanel import SimplePanel 23 from pyjamas.ui import KeyboardListener 242665 66 # TODO: sort out how to create or grab an element for 67 # Factory.createWidgetOnElement to work 68 #Factory.registerClass('pyjamas.ui.ClickDelegatePanel', ClickDelegatePanel) 6928 29 Composite.__init__(self) 30 31 self.clickDelegate = cDelegate 32 self.keyDelegate = kDelegate 33 34 self.focusablePanel = SimplePanel(Focus.createFocusable()) 35 self.focusablePanel.setWidget(child) 36 wrapperWidget = p.createTabTextWrapper() 37 if wrapperWidget is None: 38 self.initWidget(self.focusablePanel) 39 else : 40 wrapperWidget.setWidget(self.focusablePanel) 41 self.initWidget(wrapperWidget) 42 43 if hasattr(child, "addKeyboardListener"): 44 child.addKeyboardListener(kDelegate) 45 46 self.sinkEvents(Event.ONCLICK | Event.ONKEYDOWN)47 48 # receive Label's onClick and pass it through, pretending it came from us50 self.clickDelegate.onClick(sender)51 5456 type = DOM.eventGetType(event) 57 if type == "click": 58 self.onClick(self) 59 60 elif type == "keydown": 61 modifiers = KeyboardListener.getKeyboardModifiers(event) 62 if hasattr(self.keyDelegate, "onKeyDown"): 63 self.keyDelegate.onKeyDown(self, DOM.eventGetKeyCode(event), 64 modifiers)
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jun 16 12:42:35 2010 | http://epydoc.sourceforge.net |