Package muntjac :: Package terminal :: Module scrollable
[hide private]
[frames] | no frames]

Source Code for Module muntjac.terminal.scrollable

  1  # Copyright (C) 2012 Vaadin Ltd.  
  2  # Copyright (C) 2012 Richard Lincoln 
  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   
 16  """Defines an interface implemented by all visual objects that can be 
 17  scrolled.""" 
 18   
 19   
20 -class IScrollable(object):
21 """This interface is implemented by all visual objects that can be 22 scrolled programmatically from the server-side, or for which it is 23 possible to know the scroll position on the server-side.. The unit 24 of scrolling is pixel. 25 26 @author: Vaadin Ltd. 27 @author: Richard Lincoln 28 @version: 1.1.2 29 """ 30
31 - def getScrollLeft(self):
32 """Gets scroll left offset. 33 34 Scrolling offset is the number of pixels this scrollable has been 35 scrolled right. 36 37 @return: Horizontal scrolling position in pixels. 38 """ 39 raise NotImplementedError
40 41
42 - def setScrollLeft(self, pixelsScrolled):
43 """Sets scroll left offset. 44 45 Scrolling offset is the number of pixels this scrollable has been 46 scrolled right. 47 48 The method only has effect if programmatic scrolling is enabled for 49 the scrollable. Some implementations may require enabling programmatic 50 before this method can be used. See L{setScrollable} for more 51 information. 52 53 @param pixelsScrolled: 54 the xOffset. 55 """ 56 raise NotImplementedError
57 58
59 - def getScrollTop(self):
60 """Gets scroll top offset. 61 62 Scrolling offset is the number of pixels this scrollable has been 63 scrolled down. 64 65 @return: Vertical scrolling position in pixels. 66 """ 67 raise NotImplementedError
68 69
70 - def setScrollTop(self, pixelsScrolled):
71 """Sets scroll top offset. 72 73 Scrolling offset is the number of pixels this scrollable has been 74 scrolled down. 75 76 The method only has effect if programmatic scrolling is enabled for 77 the scrollable. Some implementations may require enabling programmatic 78 before this method can be used. See L{setScrollable} for more 79 information. 80 81 The scrolling position is limited by the current height of the content 82 area. If the position is below the height, it is scrolled to the 83 bottom. However, if the same response also adds height to the content 84 area, scrolling to bottom only scrolls to the bottom of the previous 85 content area. 86 87 @param pixelsScrolled: 88 the yOffset. 89 """ 90 raise NotImplementedError
91 92
93 - def isScrollable(self):
94 """Is programmatic scrolling enabled. 95 96 Whether programmatic scrolling with L{setScrollLeft} and 97 L{setScrollTop} is enabled. 98 99 @return: C{True} if the scrolling is enabled, otherwise C{False}. 100 """ 101 raise NotImplementedError
102 103
104 - def setScrollable(self, isScrollingEnabled):
105 """Enables or disables programmatic scrolling. 106 107 Enables setting the scroll position with L{setScrollLeft} and 108 L{setScrollTop}. Implementations of the interface may have 109 programmatic scrolling disabled by default, in which case you 110 need to enable it to use the mentioned methods. 111 112 Notice that this does <i>not</i> control whether scroll bars are 113 shown for a scrollable component. That normally happens automatically 114 when the content grows too big for the component, relying on the 115 "overflow: auto" property in CSS. 116 117 @param isScrollingEnabled: 118 true if the scrolling is allowed. 119 """ 120 raise NotImplementedError
121