diff 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
line wrap: on
line diff
--- a/engine/extensions/pychan/widgets/scrollarea.py	Wed Jun 03 19:29:52 2009 +0000
+++ b/engine/extensions/pychan/widgets/scrollarea.py	Mon Jun 08 16:00:02 2009 +0000
@@ -17,6 +17,8 @@
 	"""
 
 	ATTRIBUTES = Widget.ATTRIBUTES + [ BoolAttr("vertical_scrollbar"),BoolAttr("horizontal_scrollbar") ]
+	DEFAULT_HEXPAND = 1
+	DEFAULT_VEXPAND = 1
 
 	def __init__(self,**kwargs):
 		self.real_widget = fife.ScrollArea()
@@ -42,16 +44,18 @@
 	def _getContent(self): return self._content
 	content = property(_getContent,_setContent)
 
-	def deepApply(self,visitorFunc):
-		if self._content: self._content.deepApply(visitorFunc)
+	def deepApply(self,visitorFunc, leaves_first = True):
+		if leaves_first:
+			if self._content: self._content.deepApply(visitorFunc, leaves_first = leaves_first)
 		visitorFunc(self)
+		if not leaves_first:
+			if self._content: self._content.deepApply(visitorFunc, leaves_first = leaves_first)
 
 	def resizeToContent(self,recurse=True):
 		if self._content is None: return
 		if recurse:
-			self.content.resizeToContent(recurse=True)
-		self.content.width = max(self.content.width,self.width-5)
-		self.content.height = max(self.content.height,self.height-5)
+			self.content.resizeToContent(recurse=recurse)
+		self.size = self.min_size
 
 	def _visibilityToScrollPolicy(self,visibility):
 		if visibility:
@@ -74,6 +78,11 @@
 
 	def _getVerticalScrollbar(self):
 		return self._scrollPolicyToVisibility( self.real_widget.getVerticalScrollPolicy() )
+		
+	def sizeChanged(self):
+		if self.content:
+			self.content.width = max(self.content.width,self.width-5)
+			self.content.height = max(self.content.height,self.height-5)
 
 	vertical_scrollbar = property(_getVerticalScrollbar,_setVerticalScrollbar)
 	horizontal_scrollbar = property(_getHorizontalScrollbar,_setHorizontalScrollbar)