diff browser_side/panels.py @ 186:72bb1d845b6a

browser side: global resize on UniBox resize
author Goffi <goffi@goffi.org>
date Sun, 03 Mar 2013 04:27:39 +0100
parents 40adfd4ee4d7
children d0503f8f15ef
line wrap: on
line diff
--- a/browser_side/panels.py	Sun Mar 03 03:13:00 2013 +0100
+++ b/browser_side/panels.py	Sun Mar 03 04:27:39 2013 +0100
@@ -38,6 +38,7 @@
 from pyjamas.ui.DropWidget import DropWidget
 from pyjamas.ui.ClickListener import ClickHandler
 from pyjamas.ui.KeyboardListener import KEY_ENTER
+from pyjamas.ui.MouseListener import MouseHandler
 from pyjamas.ui import HasAlignment
 from pyjamas.Timer import Timer
 from pyjamas import Window
@@ -368,17 +369,21 @@
         self.unibox.setWidth('100%')
         self.add(self.unibox)
 
-class UniBox(TextArea): #AutoCompleteTextBox):
+class UniBox(TextArea, MouseHandler): #AutoCompleteTextBox):
     """This text box is used as a main typing point, for message, microblog, etc"""
 
     def __init__(self, host):
         TextArea.__init__(self)
         #AutoCompleteTextBox.__init__(self)
+        self.__size = (0,0) 
         self._popup = None
         self._timer = Timer(notify=self._timeCb)
         self.host = host
         self.setStyleName('uniBox')
         self.addKeyboardListener(self)
+        MouseHandler.__init__(self)
+        self.addMouseListener(self)
+        
 
     def addKey(self, key):
         return
@@ -489,6 +494,12 @@
             self._timeCb(None) #we remove the popup
             sender.cancelKey()
 
+    def onMouseUp(self, sender, x, y):
+        size = (self.getOffsetWidth(), self.getOffsetHeight())
+        if size != self.__size:
+            self.__size = size
+            self.host.resize() 
+
     """def complete(self):
         
         #self.visible=False #XXX: self.visible is not unset in pyjamas when ENTER is pressed and a completion is done