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

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1991, 1993 by Borland International
  3. //   include\owl\framewin.h
  4. //   Declaration of class TFrameWindow.
  5. //----------------------------------------------------------------------------
  6. #if !defined(__OWL_FRAMEWIN_H)
  7. #define __OWL_FRAMEWIN_H
  8.  
  9. #if !defined(__OWL_WINDOW_H)
  10.   #include <owl\window.h>
  11. #endif
  12.  
  13. const int IDW_MDICLIENT     = 32001;
  14. const int IDW_FIRSTMDICHILD = 32002;
  15.  
  16. //
  17. //  class TMenuDescr
  18. //  ----- ----------
  19. //
  20. //  Menu information used to allow merging of two menus
  21. //
  22. struct _OWLCLASS TMenuDescr {
  23.     enum TGroup {
  24.       FileGroup,
  25.       EditGroup,
  26.       ContainerGroup,
  27.       ObjectGroup,
  28.       WindowGroup,
  29.       HelpGroup,
  30.       NumGroups
  31.     };
  32.     TMenuDescr();
  33.     TMenuDescr(TResId id, int fg, int eg, int cg, int og, int wg, int hg,
  34.                TModule* module = ::Module);
  35.  
  36.     TResId   Id;
  37.     TModule* Module;       // pointer to constructor caller's module
  38.     int      GroupCount[NumGroups];
  39.     
  40.     friend ipstream& operator >>(ipstream& is, TMenuDescr& m);
  41.     friend opstream& operator <<(opstream& os, const TMenuDescr& m);
  42. };
  43.  
  44. //
  45. //  class TFrameWindow
  46. //  ----- ------------
  47. //
  48. //  adds the notion of a client window, keyboard navigation, and special
  49. //  processing for commands (see member function EvCommand)
  50. //
  51. class _OWLCLASS TFrameWindow : virtual public TWindow {
  52.   public:
  53.     BOOL         KeyboardHandling;
  54.  
  55.     TFrameWindow(TWindow*        parent,
  56.                  const char far* title = 0,
  57.                  TWindow*        clientWnd = 0,
  58.                  BOOL            shrinkToClient = FALSE,
  59.                  TModule*        module = 0);
  60.  
  61.     TFrameWindow(HWND hWnd, TModule* module = 0);
  62.    ~TFrameWindow();
  63.  
  64.     //
  65.     // Menubar manipulating functions
  66.     //
  67.     virtual BOOL      AssignMenu(TResId menuResId);
  68.     virtual BOOL      SetMenu(HMENU newMenu);
  69.     void              SetMenuDescr(const TMenuDescr& menuDescr);
  70.     const TMenuDescr* GetMenuDescr() const {return MenuDescr;}
  71.     BOOL              MergeMenu(const TMenuDescr& childMenuDescr);
  72.     BOOL              RestoreMenu();
  73.  
  74.     BOOL              SetIcon(TModule* iconModule, TResId iconResId);
  75.  
  76.     virtual TWindow*  GetClientWindow();
  77.     virtual TWindow*  SetClientWindow(TWindow* clientWnd);
  78.  
  79.     //
  80.     // sets flag indicating that the receiver has requested "keyboard
  81.     // handling" (translation of keyboard input into control selections)
  82.     //
  83.     void              EnableKBHandler() {KeyboardHandling = TRUE;}
  84.  
  85.     //
  86.     // override virtual functions defined by TWindow
  87.     //
  88.     BOOL              PreProcessMsg(MSG& msg);
  89.     BOOL              IdleAction(long idleCount);
  90.     BOOL              HoldFocusHWnd(HWND hWndLose, HWND hWndGain);
  91.     BOOL              SetDocTitle(LPCSTR docname, int index);
  92.  
  93.   protected:
  94.     HWND         HWndRestoreFocus;
  95.     TWindow*     ClientWnd;
  96.     int          DocTitleIndex;
  97.     TModule*     MergeModule;
  98.  
  99.     //
  100.     // Constructor & subsequent initializer for use with virtual derivations
  101.     // Immediate derivitives must call Init() before constructions are done.
  102.     //
  103.     TFrameWindow();
  104.     void              Init(TWindow* clientWnd, BOOL shrinkToClient);
  105.     
  106.     //
  107.     // extra processing for commands: starts with the focus window and gives
  108.     // it and its parent windows an opportunity to handle the command
  109.     //
  110.     LRESULT           EvCommand(UINT id, HWND hWndCtl, UINT notifyCode);
  111.     void              EvCommandEnable(TCommandEnabler& ce);
  112.  
  113.     //
  114.     // message response functions
  115.     //
  116.     void              EvInitMenuPopup(HMENU hPopupMenu,
  117.                                       UINT  index,
  118.                                       BOOL  sysMenu);
  119.     void              EvPaint();
  120.     BOOL              EvEraseBkgnd(HDC);
  121.     HANDLE            EvQueryDragIcon();
  122.     void              EvSetFocus(HWND hWndLostFocus);
  123.     void              EvSize(UINT sizeType, TSize& size);
  124.     void              EvParentNotify(UINT event,
  125.                                      UINT childHandleOrX,
  126.                                      UINT childIDOrY);
  127.  
  128.     //
  129.     // override virtual function defined by TWindow
  130.     //
  131.     void              SetupWindow();
  132.  
  133.   private:
  134.     TMenuDescr*  MenuDescr;
  135.     TModule*     IconModule;
  136.     TResId       IconResId;
  137.     TPoint       MinimizedPos;
  138.  
  139.     void              Init(TWindow* clientWnd);
  140.     BOOL              ResizeClientWindow(BOOL redraw = TRUE);
  141.     TWindow*          FirstChildWithTab();
  142.  
  143.     //
  144.     // hidden to prevent accidental copying or assignment
  145.     //
  146.     TFrameWindow(const TFrameWindow&);
  147.     TFrameWindow& operator =(const TFrameWindow&);
  148.  
  149.   DECLARE_RESPONSE_TABLE(TFrameWindow);
  150.   DECLARE_STREAMABLE(_OWLCLASS, TFrameWindow, 1);
  151. };
  152.  
  153. #endif  // __OWL_FRAMEWIN_H
  154.