home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / OWLINC.PAK / MDI.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  4KB  |  136 lines

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