home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / ibmcli / iframe.hp_ / IFRAME.HPP
Encoding:
C/C++ Source or Header  |  1992-10-26  |  7.5 KB  |  196 lines

  1. #ifndef _IFRAME_
  2.   #define _IFRAME_
  3. /**************************************************************/
  4. /* CLASS NAME:      IFrameWindow                              */
  5. /*                                                            */
  6. /* DESCRIPTION  : This is the frame window class.             */
  7. /*                                                            */
  8. /* HUNGARIAN:  frwnd                                          */
  9. /*                                                            */
  10. /* CHANGE ACTIVITY:                                           */
  11. /*   DATE:     INITIAL:        DESCRIPTION                    */
  12. /*                                                            */
  13. /*   080892    Kevin Leong     Initial design/code            */
  14. /*   170992    Ph Gregoire     Added frame control processing */
  15. /*   061092    Ph Gregoire     Moved to BBXX sets             */
  16. /*                                                            */
  17. /**************************************************************/
  18. /* Copyright (c) IBM Corporation 1991                         */
  19. /**************************************************************/
  20. class IFrameWindow;
  21. class IResourceMgr;
  22. class IFrameControlDesc;
  23. class IExposeEvent;
  24.  
  25. #ifdef _USEBB_
  26.   #ifndef _ISET_H
  27.     #include <iset.h>
  28.   #endif
  29. #else
  30.   #ifndef _ISET_
  31.     #include <iset.hpp>
  32.   #endif
  33.   declare(IGSet1,IFrameControlDesc);
  34. #endif
  35.  
  36. #ifndef _IAPPWIN_
  37.   #include <iappwin.hpp>
  38. #endif
  39. #ifndef _IRECT_
  40.   #include<irect.hpp>
  41. #endif
  42. #ifndef _IFRCTLAT_
  43.   #include <IFrCtlAt.hpp>
  44. #endif
  45. #ifndef _IFRCTLDS_
  46.   #include <iFrCtlDs.hpp>
  47. #endif
  48.  
  49. class IFrameWindow : public IApplicationWindow
  50. {
  51.   typedef IApplicationWindow Inherited;
  52.   public:
  53.  
  54.      INESTEDBITFLAGCLASSDEF1(Style, IFrameWindow, IWindow);
  55.      static const Style
  56.        animate,
  57.        maximized,
  58.        minimized;
  59.  
  60.      INESTEDBITFLAGCLASSDEF0(Flag, IFrameWindow);
  61.      static const Flag
  62.        noFlag,
  63.        defaultFlag,
  64.        border,
  65.        maxButton,
  66.        minButton,
  67.        hideButton,
  68.        mouseAlign,
  69.        noByteAlign,
  70.        noMoveWithOwner,
  71.        screenAlign,
  72.        shellPosition,
  73.        sizeBorder,
  74.        systemMenu,
  75.        systemModal,
  76.        titleBar,
  77.        windowList;
  78.  
  79. //     static const ISize
  80. //        borderSize(),
  81. //        sizeBorderSize();
  82.  
  83.      IFrameWindow(unsigned long windowId,
  84.                   const IWindow* parent = desktopWindow(),
  85.                   const IWindow* owner = 0,
  86.                   const IRectangle& initial = IRectangle(),
  87.                   Style s = animate | IWindow::clipChildren,
  88.                   Flag f = defaultFlag);
  89.  
  90.      virtual ~IFrameWindow();
  91.  
  92.      // set a control as client
  93.      Boolean setClient(IWindow* pwndControl)
  94.        { return(addControl(pwndControl,
  95.                            IFrCtlAttr::centerArea,
  96.                            0,None,0));
  97.        };
  98.  
  99.      // add a window as a frame control
  100.      Boolean addControl(
  101.                  IWindow* pwndControl,  // Control IWindow
  102.                IFrCtlAttr fcatPlace,    // Control placement flags
  103.                                         // If the 'adjust' flag is set, the
  104.                                         // dimension of the control will be
  105.                                         // re-adjusted after all controls have
  106.                                         // been positionned and shrunk.
  107.                                         // Setting the flag this may leave holes
  108.                                         // in the frame.
  109.                                         // The 'behind' flag controls whether
  110.                                         // the control is to be placed behind
  111.                                         // the relative window or on top.
  112.            const IWindow* pwndRelative, // Window relative to which to place
  113.                                         // control. If NULL, it is relative
  114.                                         // to a std FID_
  115.             IEDefFrameCtl fctRelative,  // If above is NULL, relative frame
  116.                                         // control id
  117.             unsigned long ulDimension,  // Dimension of the control, for the
  118.                                         // one not fixed by relative (i.e.,
  119.                                         // for RIGHT or LEFT this is the width,
  120.                                         // for TOP or BOTTOM it is the height
  121.              const IPair& pairDimMult=  // Multiplier for dimension, will be
  122.                            IPair(0,1),  // multiplied to the relative window's
  123.                                         // dimension and added to ulDimension.
  124.                                         // For example, to get three quarters,
  125.                                         // specify IPair(3,4). Must be <1,
  126.                                         // i.e., integer part < frac part
  127.                                         // Defaults to no shrinking
  128.                   Boolean bNoUpdate=    // If true, do not update frame
  129.                            false);
  130.  
  131.      // add a window as frame control relative to another IWindow
  132.      Boolean addControl(IWindow* pwndControl,
  133.                         IFrCtlAttr fcatPlace,
  134.                         const IWindow* pwndRelative,
  135.                         unsigned long ulDimension,
  136.                         const IPair& pairDimMult=IPair(0,1),
  137.                         Boolean bNoUpdate= false)
  138.        { return(addControl(pwndControl,fcatPlace,pwndRelative,
  139.                            None,ulDimension,pairDimMult,bNoUpdate));
  140.        };
  141.  
  142.      // add a window as frame control relative a std frame control
  143.      Boolean addControl(IWindow* pwndControl,
  144.                         IFrCtlAttr fcatPlace,
  145.                         IEDefFrameCtl fctRelative,
  146.                         unsigned long ulDimension,
  147.                         const IPair& pairDimMult=IPair(0,1),
  148.                         Boolean bNoUpdate= false)
  149.        { return(addControl(pwndControl,fcatPlace,0,fctRelative,
  150.                            ulDimension,pairDimMult,bNoUpdate));
  151.        };
  152.  
  153.      Boolean removeControl(
  154.         const IWindow*   pwndControl,
  155.               Boolean    bNoUpdate=false);
  156.  
  157.  
  158.   protected:
  159.  
  160.     virtual Boolean handleWindowEvent(IEvent& evt);
  161.  
  162.   private:
  163.   #ifdef _USEBB_
  164.     typedef ISet<IFrameControlDesc*> IFrCtlDescSet;
  165.   #else
  166.     typedef IGSet1(IFrameControlDesc) IFrCtlDescSet;
  167.   #endif
  168.  
  169.     IFrameWindow(const IFrameWindow&);
  170.     IFrameWindow &operator=(const IFrameWindow&);
  171.  
  172.     // method to find a given control descriptor in the list
  173.     IFrameControlDesc*     findControl(const IWindow *pwndCtl,
  174.                                        IFrCtlDescSet::Cursor& cursFrCtlDs);
  175.  
  176.     // method to paint the frame controls' separator lines if any
  177.     void               paintSeparatorLines(const IPresSpaceHandle& pshFrame);
  178.     IFrameControlDesc* isOnSplitBar(const IPoint& pt, Boolean& bHorz);
  179.  
  180.     void    updateFrame();
  181.     // method used to reply to WM_QUERYFRAMECTLCOUNT
  182.     long       countControls();
  183.  
  184.     // method to process format frame messages
  185.     // returns the count of additional frame controls actually added
  186.     long formatControls(void* pSwp, const IRectangle& rect,
  187.                         unsigned long ulDefCnt);
  188.  
  189.     // Collection of control descriptors // !PHG!: would require an IKeySet
  190.     IFrCtlDescSet   setClFrCtlDs;
  191.     Boolean         bClSplitBar;         // true if there is a splitbar
  192. };
  193.  
  194. INESTEDBITFLAGCLASSFUNCS(Style, IFrameWindow);
  195. #endif  /* _IFRAME_ */
  196.