Mercurial > fife-parpg
comparison engine/extensions/pychan/widgets/scrollarea.py @ 255:51cc05d862f2
Merged editor_rewrite branch to trunk.
This contains changes that may break compatibility against existing clients.
For a list of changes that may affect your client, see: http://wiki.fifengine.de/Changes_to_pychan_and_FIFE_in_editor_rewrite_branch
author | cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 08 Jun 2009 16:00:02 +0000 |
parents | a2d5e2721489 |
children | 48c99636453e |
comparison
equal
deleted
inserted
replaced
254:10b5f7f36dd4 | 255:51cc05d862f2 |
---|---|
15 - horizontal_scrollbar: Boolean: Set this to False to hide the Horizontal scrollbar | 15 - horizontal_scrollbar: Boolean: Set this to False to hide the Horizontal scrollbar |
16 | 16 |
17 """ | 17 """ |
18 | 18 |
19 ATTRIBUTES = Widget.ATTRIBUTES + [ BoolAttr("vertical_scrollbar"),BoolAttr("horizontal_scrollbar") ] | 19 ATTRIBUTES = Widget.ATTRIBUTES + [ BoolAttr("vertical_scrollbar"),BoolAttr("horizontal_scrollbar") ] |
20 DEFAULT_HEXPAND = 1 | |
21 DEFAULT_VEXPAND = 1 | |
20 | 22 |
21 def __init__(self,**kwargs): | 23 def __init__(self,**kwargs): |
22 self.real_widget = fife.ScrollArea() | 24 self.real_widget = fife.ScrollArea() |
23 self._content = None | 25 self._content = None |
24 super(ScrollArea,self).__init__(**kwargs) | 26 super(ScrollArea,self).__init__(**kwargs) |
40 self.real_widget.setContent(content.real_widget) | 42 self.real_widget.setContent(content.real_widget) |
41 self._content = content | 43 self._content = content |
42 def _getContent(self): return self._content | 44 def _getContent(self): return self._content |
43 content = property(_getContent,_setContent) | 45 content = property(_getContent,_setContent) |
44 | 46 |
45 def deepApply(self,visitorFunc): | 47 def deepApply(self,visitorFunc, leaves_first = True): |
46 if self._content: self._content.deepApply(visitorFunc) | 48 if leaves_first: |
49 if self._content: self._content.deepApply(visitorFunc, leaves_first = leaves_first) | |
47 visitorFunc(self) | 50 visitorFunc(self) |
51 if not leaves_first: | |
52 if self._content: self._content.deepApply(visitorFunc, leaves_first = leaves_first) | |
48 | 53 |
49 def resizeToContent(self,recurse=True): | 54 def resizeToContent(self,recurse=True): |
50 if self._content is None: return | 55 if self._content is None: return |
51 if recurse: | 56 if recurse: |
52 self.content.resizeToContent(recurse=True) | 57 self.content.resizeToContent(recurse=recurse) |
53 self.content.width = max(self.content.width,self.width-5) | 58 self.size = self.min_size |
54 self.content.height = max(self.content.height,self.height-5) | |
55 | 59 |
56 def _visibilityToScrollPolicy(self,visibility): | 60 def _visibilityToScrollPolicy(self,visibility): |
57 if visibility: | 61 if visibility: |
58 return fife.ScrollArea.SHOW_AUTO | 62 return fife.ScrollArea.SHOW_AUTO |
59 return fife.ScrollArea.SHOW_NEVER | 63 return fife.ScrollArea.SHOW_NEVER |
72 def _getHorizontalScrollbar(self): | 76 def _getHorizontalScrollbar(self): |
73 return self._scrollPolicyToVisibility( self.real_widget.getHorizontalScrollPolicy() ) | 77 return self._scrollPolicyToVisibility( self.real_widget.getHorizontalScrollPolicy() ) |
74 | 78 |
75 def _getVerticalScrollbar(self): | 79 def _getVerticalScrollbar(self): |
76 return self._scrollPolicyToVisibility( self.real_widget.getVerticalScrollPolicy() ) | 80 return self._scrollPolicyToVisibility( self.real_widget.getVerticalScrollPolicy() ) |
81 | |
82 def sizeChanged(self): | |
83 if self.content: | |
84 self.content.width = max(self.content.width,self.width-5) | |
85 self.content.height = max(self.content.height,self.height-5) | |
77 | 86 |
78 vertical_scrollbar = property(_getVerticalScrollbar,_setVerticalScrollbar) | 87 vertical_scrollbar = property(_getVerticalScrollbar,_setVerticalScrollbar) |
79 horizontal_scrollbar = property(_getHorizontalScrollbar,_setHorizontalScrollbar) | 88 horizontal_scrollbar = property(_getHorizontalScrollbar,_setHorizontalScrollbar) |