CVS: anygui/lib/anygui/backends mswgui.py,1.38,1.39

Robin Becker <[email protected]> Sat, 02 Nov 2002 16:13:28 -0800
Newsgroups gmane.comp.python.anygui.cvs
Message-ID <[email protected]>
Update of /cvsroot/anygui/anygui/lib/anygui/backends
In directory usw-pr-cvs1:/tmp/cvs-serv23960

Modified Files:
	mswgui.py 
Log Message:
Changes needed to satisfy test_shake

Index: mswgui.py
===================================================================
RCS file: /cvsroot/anygui/anygui/lib/anygui/backends/mswgui.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** mswgui.py	11 Sep 2002 10:28:23 -0000	1.38
--- mswgui.py	3 Nov 2002 00:13:26 -0000	1.39
***************
*** 24,28 ****
  
  ################################################################
! import win32gui, win32con
  
  # BUGS:
--- 24,28 ----
  
  ################################################################
! import win32gui, win32con, win32api
  
  # BUGS:
***************
*** 81,108 ****
  
      def getGeometry(self):
-         # Gag me with a cat.
-         # Child window positions are reported relative to the
-         # *toplevel* window, not relative to the parent.
-         # Refactor this. - jak
-         if isinstance(self,WindowWrapper):
-             l,t,r,b = win32gui.GetClientRect(self.widget)
-             w = r-l
-             h = b-t
-             return l,t,w,h
- 
          l,t,r,b = win32gui.GetWindowRect(self.widget)
          w = r-l
          h = b-t
  
!         if not isinstance(self.container.wrapper,WindowWrapper):
!             try:
!                 if isinstance(self.proxy.container.wrapper,FrameWrapper):
!                     px,py,pw,ph = self.proxy.container.geometry
!                     l-=px
!                     t-=py
!                 else:
!                     done=1
!             except AttributeError:
!                 pass
  
          return l,t,w,h
--- 81,95 ----
  
      def getGeometry(self):
          l,t,r,b = win32gui.GetWindowRect(self.widget)
          w = r-l
          h = b-t
  
!         try:
!             l,t = win32gui.ScreenToClient(self.proxy.container.wrapper.widget,(l,t))
!         except AttributeError:
!             pass
!         except:
!             import traceback
!             traceback.print_exc(1)
  
          return l,t,w,h
***************
*** 223,227 ****
  class ListBoxWrapper(ComponentWrapper):
      _wndclass = "LISTBOX"
!     _win_style = win32con.WS_CHILD | win32con.WS_VSCROLL | win32con.WS_BORDER | win32con.LBS_NOTIFY
      _win_style_ex = win32con.WS_EX_CLIENTEDGE
  
--- 210,214 ----
  class ListBoxWrapper(ComponentWrapper):
      _wndclass = "LISTBOX"
!     _win_style = win32con.WS_CHILD | win32con.WS_VSCROLL | win32con.WS_BORDER | win32con.LBS_NOTIFY| win32con.LBS_NOINTEGRALHEIGHT
      _win_style_ex = win32con.WS_EX_CLIENTEDGE
  
***************
*** 469,472 ****
--- 456,461 ----
      _win_style = win32con.WS_OVERLAPPEDWINDOW | win32con.WS_CLIPCHILDREN
      _win_style_ex = 0
+     _extraWidth = 2*win32api.GetSystemMetrics(win32con.SM_CXFRAME)
+     _extraHeight = win32api.GetSystemMetrics(win32con.SM_CYCAPTION) + 2*win32api.GetSystemMetrics(win32con.SM_CYFRAME)
  
      def __init__(self,*args,**kws):
***************
*** 474,489 ****
          self.widget_map = {}
  
      def setGeometry(self,x,y,width,height):
          if not self.widget: return
          # take account for title bar and borders
-         import win32api
          win32gui.SetWindowPos(self.widget,
                                0,
                                x, y,
!                               width \
!                               + 2*win32api.GetSystemMetrics(win32con.SM_CXFRAME),
!                               height \
!                               + win32api.GetSystemMetrics(win32con.SM_CYCAPTION) \
!                               + 2*win32api.GetSystemMetrics(win32con.SM_CYFRAME),
                                win32con.SWP_NOACTIVATE | win32con.SWP_NOZORDER)
  
--- 463,480 ----
          self.widget_map = {}
  
+     def getGeometry(self):
+         l,t,r,b = win32gui.GetWindowRect(self.widget)
+         w = r-l-self._extraWidth
+         h = b-t-self._extraHeight
+         return l,t,w,h
+ 
      def setGeometry(self,x,y,width,height):
          if not self.widget: return
          # take account for title bar and borders
          win32gui.SetWindowPos(self.widget,
                                0,
                                x, y,
!                               width + self._extraWidth,
!                               height + self._extraHeight,
                                win32con.SWP_NOACTIVATE | win32con.SWP_NOZORDER)
  



-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm 
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en