home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 1998 November / maximum-cd-1998-11.iso / Truespace 4 / Data / PROGRAM / Scripts / window.py < prev   
Encoding:
Python Source  |  1998-01-17  |  1.3 KB  |  40 lines

  1. # The MFCish window classes.
  2. import object
  3. import win32ui
  4. import win32con
  5.  
  6. class Wnd(object.CmdTarget):
  7.     def __init__(self, initobj=None):
  8.         object.CmdTarget.__init__(self, initobj)
  9.         if self._obj_: self._obj_.HookMessage(self.OnDestroy, win32con.WM_DESTROY)
  10.     def OnDestroy(self, msg):
  11.         pass
  12.  
  13. # Note - to process all messages for your window, add the following method
  14. # to a derived class.  This code provides default message handling (ie, is
  15. # identical, except presumably in speed, as if the method did not exist at
  16. # all, so presumably will be modified to test for specific messages to be 
  17. # useful!
  18. #    def WindowProc(self, msg, wParam, lParam):
  19. #        rc, lResult = self._obj_.OnWndMsg(msg, wParam, lParam)
  20. #        if not rc: lResult = self._obj_.DefWindowProc(msg, wParam, lParam)
  21. #        return lResult
  22.  
  23. class FrameWnd(Wnd):
  24.     def __init__(self, wnd):
  25.         Wnd.__init__(self, wnd)
  26.  
  27. class MDIChildWnd(FrameWnd):
  28.     def __init__(self, template, doc):
  29.         wnd=template._obj_.CreateNewFrame(doc)
  30.         FrameWnd.__init__(self, wnd)
  31.     def OnCreateClient(self, cp, context):
  32.         if context is not None and context.template is not None:
  33.             context.template.CreateView(self, context)
  34.  
  35. class MDIFrameWnd(FrameWnd):
  36.     def __init__(self):
  37.         wnd=win32ui.CreateMDIFrame()
  38.         FrameWnd.__init__(self, wnd)
  39.         self.HookMessage(self.OnDestroy, win32con.WM_DESTROY)
  40.