home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 19.ddi / OWLINC.PAK / MDI.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  3.9 KB  |  134 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1991, 1993 by Borland International
  3. //   include\owl\mdi.h
  4. //   Definition of TMDIClient and TMDIFrame classes
  5. //----------------------------------------------------------------------------
  6. #if !defined(__OWL_MDI_H)
  7. #define __OWL_MDI_H
  8.  
  9. #if !defined(__OWL_FRAMEWIN_H)
  10.   #include <owl\framewin.h>
  11. #endif
  12. #if !defined(__OWL_MDICHILD_H)
  13.   #include <owl\mdichild.h>
  14. #endif
  15. #include <owl\mdi.rh>
  16.  
  17. class _OWLCLASS TMDIFrame;
  18.  
  19. //
  20. //  class TMDIClient
  21. //  ----- ----------
  22. //
  23. class _OWLCLASS TMDIClient : public virtual TWindow {
  24.   public:
  25.     LPCLIENTCREATESTRUCT  ClientAttr;
  26.  
  27.     TMDIClient(TModule*   module = 0);
  28.    ~TMDIClient();
  29.  
  30.     virtual BOOL        CloseChildren();
  31.  
  32.     TMDIChild*          GetActiveMDIChild();
  33.  
  34.     //
  35.     // member functions to arrange the MDI children
  36.     //
  37.     virtual void        ArrangeIcons();
  38.     virtual void        CascadeChildren();
  39.     virtual void        TileChildren(int tile = MDITILE_VERTICAL);
  40.  
  41.     //
  42.     // override member functions defined by TWindow
  43.     //
  44.     BOOL                PreProcessMsg(MSG& msg);
  45.     BOOL                Create();
  46.  
  47.     virtual TWindow*    CreateChild();
  48.  
  49.     //
  50.     // constructs a new MDI child window object. by default, constructs an
  51.     // instance of TWindow as an MDI child window object
  52.     //
  53.     // will almost always be overriden by derived classes to construct an
  54.     // instance of a user-defined TWindow derived class as an MDI child window
  55.     // object
  56.     //
  57.     virtual TMDIChild*  InitChild();
  58.  
  59.   protected:
  60.     char far*           GetClassName();
  61.  
  62.     //
  63.     // menu command handlers & enabler
  64.     //
  65.     void                CmCreateChild() {CreateChild();}  // CM_CREATECHILD
  66.     void                CmTileChildren() {TileChildren();}  // CM_TILECHILDREN
  67.     void                CmTileChildrenHoriz() {TileChildren(MDITILE_HORIZONTAL);}  // CM_TILECHILDREN
  68.     void                CmCascadeChildren() {CascadeChildren();}  // CM_CASCADECHILDREN
  69.     void                CmArrangeIcons() {ArrangeIcons();}  // CM_ARRANGEICONS
  70.     void                CmCloseChildren() {CloseChildren();}  // CM_CLOSECHILDREN
  71.     void                CmChildActionEnable(TCommandEnabler& commandEnabler);
  72.  
  73.     LRESULT             EvMDICreate(MDICREATESTRUCT far& createStruct);
  74.     void                EvMDIDestroy(HWND hWnd);
  75.  
  76.   private:
  77.     friend class TMDIFrame;
  78.     TMDIClient(HWND hWnd, TModule*   module = 0);
  79.  
  80.     //
  81.     // hidden to prevent accidental copying or assignment
  82.     //
  83.     TMDIClient(const TMDIClient&);
  84.     TMDIClient& operator =(const TMDIClient&);
  85.  
  86.   DECLARE_RESPONSE_TABLE(TMDIClient);
  87.   DECLARE_STREAMABLE(_OWLCLASS, TMDIClient, 1);
  88. };
  89.  
  90. //
  91. //  class TMDIFrame
  92. //  ----- ---------
  93. //
  94. class _OWLCLASS TMDIFrame : virtual public TFrameWindow {
  95.   public:
  96.     TMDIFrame(const char far* title,
  97.               TResId          menuResId,
  98.               TMDIClient&     clientWnd = *new TMDIClient,
  99.               TModule*        module = 0);
  100.  
  101.  
  102.     TMDIFrame(HWND hWindow, HWND clientHWnd, TModule*   module = 0);
  103.  
  104.     //
  105.     // override virtual functions defined by TFrameWindow or TWindow
  106.     //
  107.     BOOL         SetMenu(HMENU);
  108.     TMDIClient*  GetClientWindow();
  109.     void         PerformCreate(int menuOrId);
  110.  
  111.     //
  112.     // find & return the child menu of an MDI frame's (or anyone's) menu bar.
  113.     //
  114.     static HMENU FindChildMenu(HMENU);
  115.  
  116.   protected:
  117.     //
  118.     // call ::DefFrameProc() instead of ::DefWindowProc()
  119.     //
  120.     LRESULT      DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  121.  
  122.   private:
  123.     //
  124.     // hidden to prevent accidental copying or assignment
  125.     //
  126.     TMDIFrame(const TMDIFrame&);
  127.     TMDIFrame& operator=(const TMDIFrame&);
  128.  
  129.   DECLARE_RESPONSE_TABLE(TMDIFrame);
  130.   DECLARE_STREAMABLE(_OWLCLASS, TMDIFrame, 1);
  131. };
  132.  
  133. #endif  // __OWL_MDI_H
  134.