[pywin32-checkins] pywin32/com/win32comext/shell/demos/servers shell_view.py, 1.8, 1.9
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2007-10-30 09:56:39
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/servers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17815/com/win32comext/shell/demos/servers Modified Files: shell_view.py Log Message: Add a WM_SIZE handler to resize all the windows and implement a couple of missing methods. Index: shell_view.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/demos/servers/shell_view.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shell_view.py 19 Feb 2007 20:29:18 -0000 1.8 --- shell_view.py 30 Oct 2007 09:56:42 -0000 1.9 *************** *** 382,385 **** --- 382,386 ---- self._CreateMainWindow(prev, settings, browser, rect) self._CreateChildWindow(prev) + return self.hwnd def _CreateMainWindow(self, prev, settings, browser, rect): *************** *** 387,391 **** # gets the control notifications etc sent from the child. style = win32con.WS_CHILD | win32con.WS_VISIBLE # ! wclass_name = "EnfoldDesktop_DefView" # Register the Window class. wc = win32gui.WNDCLASS() --- 388,392 ---- # gets the control notifications etc sent from the child. style = win32con.WS_CHILD | win32con.WS_VISIBLE # ! wclass_name = "ShellViewDemo_DefView" # Register the Window class. wc = win32gui.WNDCLASS() *************** *** 405,410 **** win32con.WM_NOTIFY: self.OnNotify, win32con.WM_CONTEXTMENU: self.OnContextMenu, } ! self.hwnd = win32gui.CreateWindow( wclass_name, "", style, \ rect[0], rect[1], rect[2]-rect[0], rect[3]-rect[1], --- 406,412 ---- win32con.WM_NOTIFY: self.OnNotify, win32con.WM_CONTEXTMENU: self.OnContextMenu, + win32con.WM_SIZE: self.OnSize, } ! self.hwnd = win32gui.CreateWindow( wclass_name, "", style, \ rect[0], rect[1], rect[2]-rect[0], rect[3]-rect[1], *************** *** 416,420 **** def _CreateChildWindow(self, prev): # Creates the list view window. - print "_CreateChildWindow" assert self.hwnd_child is None, "already have a window" assert self.cur_foldersettings is not None, "no settings" --- 418,421 ---- *************** *** 682,685 **** --- 683,695 ---- cm.InvokeCommand(ci) + def OnSize(self, hwnd, msg, wparam, lparam): + # hrm - this doesn't seem to be called on XP, but is on Vista + # (and is *necessary* on Vista, as it seems to create windows with + # a zero client-rect, then moves it) + #print "OnSize", self.hwnd_child, win32api.LOWORD(lparam), win32api.HIWORD(lparam) + if self.hwnd_child is not None: + x = win32api.LOWORD(lparam) + y = win32api.HIWORD(lparam) + win32gui.MoveWindow(self.hwnd_child, 0, 0, x, y, False) # This uses scintilla to display a filename, and optionally jump to a line *************** *** 697,700 **** --- 707,714 ---- def _SendSci(self, msg, wparam=0, lparam=0): return win32gui.SendMessage(self.hwnd, msg, wparam, lparam) + + def GetWindow(self): + return self.hwnd + # IShellView def CreateViewWindow(self, prev, settings, browser, rect): *************** *** 721,724 **** --- 735,744 ---- rect[0], rect[1], rect[2]-rect[0], rect[3]-rect[1], self.hwnd_parent, 1000, 0, None) + + message_map = { + win32con.WM_SIZE: self.OnSize, + } + win32gui.SetWindowLong(self.hwnd, win32con.GWL_WNDPROC, message_map) + file_data = file(self.filename, "U").read() *************** *** 770,773 **** --- 790,801 ---- return winerror.S_FALSE + def UIActivate(self, activate_state): + print "Scintilla OnActivate" + + def OnSize(self, hwnd, msg, wparam, lparam): + x = win32api.LOWORD(lparam) + y = win32api.HIWORD(lparam) + win32gui.MoveWindow(self.hwnd, 0, 0, x, y, False) + def DllRegisterServer(): import _winreg |