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 from pyjamas.ui.SimplePanel import SimplePanel 19 from pyjamas.ui import Event22 23 _props = [("always", "Always show scroll bars", 24 "AlwaysShowScrollBars", None), 25 ("position", "Vertical Scroll Position", 26 "ScrollPosition", None), 27 ("horizPos", "Horizontal Scroll Position", 28 "HorizontalScrollPosition", None), 29 ] 30102 103 Factory.registerClass('pyjamas.ui.ScrollPanel', 'ScrollPanel', ScrollPanel) 10432 self.scrollListeners = [] 33 34 if child is not None: 35 kwargs['Widget'] = child 36 if not kwargs.has_key('AlwaysShowScrollBars'): 37 kwargs['AlwaysShowScrollBars'] = False 38 39 SimplePanel.__init__(self, **kwargs) 40 self.sinkEvents(Event.ONSCROLL)41 42 @classmethod 45 46 # next three functions are part of the standard Builder API for panels 49 5254 return self.getWidget()5557 self.scrollListeners.append(listener)5860 scroll = self.getElement() 61 element = item.getElement() 62 self.ensureVisibleImpl(scroll, element)63 66 6971 type = DOM.eventGetType(event) 72 if type == "scroll": 73 for listener in self.scrollListeners: 74 listener.onScroll(self, self.getHorizontalScrollPosition(), 75 self.getScrollPosition())7678 self.scrollListeners.remove(listener)7981 if alwaysShow: 82 style = "scroll" 83 else: 84 style = "auto" 85 DOM.setStyleAttribute(self.getElement(), "overflow", style)86 89 92
Home | Trees | Indices | Help |
|
---|
http://epydoc.sourceforge.net |