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

  1. #ifndef _IFRCTLDS_
  2.   #define _IFRCTLDS_
  3. /**************************************************************/
  4. /* CLASS NAME:      IFrameControlDesc                         */
  5. /*                                                            */
  6. /* DESCRIPTION  : Frame control description class             */
  7. /*                                                            */
  8. /* NOTE:                                                      */
  9. /*                                                            */
  10. /* CHANGE ACTIVITY:                                           */
  11. /*   DATE:     INITIAL:        DESCRIPTION                    */
  12. /*   090592    Ph. Gregoire    Initial coding                 */
  13. /*   040692    Kevin Leong     Change IAppWindow - IStdWindow */
  14. /*   090892    Ph. Gregoire    Moved from pre-3.0 code        */
  15. /*   260892    Ph. Gregoire    Changed to support client      */
  16. /*                                                            */
  17. /**************************************************************/
  18. /* Copyright (c) IBM Corporation 1991                         */
  19. /**************************************************************/
  20.  
  21. // forward references
  22. class   IFrameControlDesc;   /* fcdesc */
  23.  
  24. #ifndef _IBASETYP_
  25.   #include <ibasetyp.hpp>
  26. #endif
  27. #ifndef _IPOINT_
  28.   #include <ipoint.hpp>
  29. #endif
  30. #ifndef _IRECT_
  31.   #include <irect.hpp>
  32. #endif
  33. #ifndef _IWINDOW_
  34.   #include <iwindow.hpp>
  35. #endif
  36. #ifndef _IFRAME_
  37.   #include <iframe.hpp>
  38. #endif
  39.  
  40. #include <IFrCtlAt.hpp> // frame control attributes
  41.  
  42. /**************************************************************/
  43. /* IFrameControlDesc class                                    */
  44. /*                                                            */
  45. /* The IFrameWindow keeps a list of these descriptors         */
  46. /**************************************************************/
  47. class IFrameControlDesc
  48. {
  49.   friend class IFrameWindow;
  50.  
  51.   public:
  52.     // Constructor
  53.     IFrameControlDesc(
  54.       IWindow*          pwndControl,   // Control IWindow
  55.       IFrCtlAttr        fcatPlace,     // Control placement flags
  56.                                        // If the 'adjust' flag is set, the
  57.                                        // dimension of the control will be
  58.                                        // re-adjusted after all controls have
  59.                                        // been positionned and shrunk.
  60.                                        // Setting the flag this may leave holes
  61.                                        // in the frame.
  62.                                        // The 'behind' flag controls
  63.                                        // whether the control is to be placed
  64.                                        // behind the relative window or on
  65.                                        // top.
  66.       const IWindow*    pwndRelative,  // Window relative to which to place control
  67.                                        // if NULL, it is relative to a std FID_
  68.       IEDefFrameCtl     fctRelative,   // If above is NULL, relative frame
  69.                                        // control id (typically, FID_CLIENT)
  70.       unsigned long     ulDimension,   // Dimension of the control, for the
  71.                                        // one not fixed by relative (i.e.,
  72.                                        // for RIGHT or LEFT this is the width,
  73.                                        // for TOP or BOTTOM it is the height
  74.       const IPair&     pairDimMult);   // Multiplier for dimension, will be
  75.                                        // multiplied to the relative window's
  76.                                        // dimension and added to ulDimension.
  77.                                        // For example, to get three quarters,
  78.                                        // specify IPair(3,4). Must be <1,
  79.                                        // i.e., integer part < frac part
  80.  
  81.     // Destructor
  82.     virtual ~IFrameControlDesc() {;};
  83.  
  84.     // Remark: copy constructor has been left over, since there
  85.     // can be only one descriptor per control
  86.  
  87.     // Methods to query/set instance vars
  88.     Boolean        setRelative(const IWindow* pwndRelative);
  89.     const IWindow* relativeWindow() const;
  90.     Boolean        setRelative(IEDefFrameCtl fctRelative);
  91.     IEDefFrameCtl  relativeFrameId() const;
  92.     Boolean        setDimension(unsigned long ulDim);
  93.     unsigned long  dimension() const;
  94.     Boolean        setDimMultiplier(const IPair& pairDimMult);
  95.     IPair          dimMultiplier() const;
  96.     IWindow*       controlWindow() const;
  97.  
  98.   protected:
  99.     // no protected methods, this class is not intended to be subclassed
  100.  
  101.  
  102.   private:
  103.     /* methods */
  104.     // Methods to handle positionning of controls, to be called from
  105.     // The IFrameWindow during WM_FORMATFRAME on IAppFrame
  106.     // Returns TRUE if the control position has been set up in swpControl
  107.     // first pass computation
  108.     Boolean positionControl(
  109.             void*             pswp,        // SWP array gotten from WM_FORMATFRAME
  110.             unsigned long     ulSwpSize,   // size of array (control count so far)
  111.             void*             pswpControl, // return values for control pos here
  112.             const IRectangle& rectClient); // client space rectangle
  113.  
  114.     // Second pass adjustment
  115.     Boolean adjustControl(
  116.             void*         pswp,           // SWP array gotten from WM_FORMATFRAME
  117.             unsigned long ulSwpSize);     // size of array
  118.  
  119.     // return the gap size (for lines or sep bar)
  120.     long gapDimension() const;
  121.  
  122.     // Paint frame control
  123.     void paintSepLine(const IPresSpaceHandle& pshFrame) const;
  124.  
  125.     // Returns true if on split bar
  126.     Boolean isOnSplitBar(const IPoint& pt, Boolean& bHorz) const;
  127.  
  128.     // fills-in a trackinfo structure
  129.     Boolean setTrackInfo(const IPoint& ptMouse, void* pTrackInfo, long lSize) const;
  130.     void setEdgeTo(const IRectangle& rect);
  131.  
  132.     // get the control's index within SWP array
  133.     long controlIndex(void*         pswp,
  134.                       unsigned long ulSwpSize);
  135.     // get the relative window's index within SWP array
  136.     long relativeIndex(void*         pswp,
  137.                        unsigned long ulSwpSize);
  138.     // scan SWP array for hwnd
  139.     long controlIndex(void*                pswp,
  140.                       unsigned long        ulSwpSize,
  141.                       const IWindowHandle& wndh);
  142.  
  143.     // helper in-line functions
  144.     Boolean isLow()    const { return( (fcatClPlcmt & IFrCtlAttr::placeUp)==0 ); }
  145.     Boolean isUp()     const { return( (fcatClPlcmt & IFrCtlAttr::placeUp)!=0 ); }
  146.     Boolean isHorz()   const { return( (fcatClPlcmt & IFrCtlAttr::placeVert)==0 ); }
  147.     Boolean isVert()   const { return( (fcatClPlcmt & IFrCtlAttr::placeVert)!=0 ); }
  148.     Boolean isLeft()   const { return( isHorz() & isLow() ); }
  149.     Boolean isRight()  const { return( isHorz() & isUp()  ); }
  150.     Boolean isBottom() const { return( isVert() & isLow() ); }
  151.     Boolean isTop()    const { return( isVert() & isUp()  ); }
  152.     Boolean isCenter() const { return( (fcatClPlcmt & IFrCtlAttr::centerArea)!=0 ); }
  153.     Boolean isBehind() const { return( (fcatClPlcmt & IFrCtlAttr::behind)!=0 ); }
  154.     Boolean isAdjust() const { return( (fcatClPlcmt & IFrCtlAttr::adjust)!=0 ); }
  155.     Boolean isThinL()  const { return( (fcatClPlcmt & IFrCtlAttr::thinSepLine)!=0 ); }
  156.     Boolean isThickL() const { return( (fcatClPlcmt & IFrCtlAttr::thickSepLine)!=0 ); }
  157.     Boolean isSplitB() const { return( (fcatClPlcmt & IFrCtlAttr::splitBar)!=0 ); }
  158.  
  159.     /* instance vars */
  160.           IWindow*           pwndClControl;  // Control IWindow
  161.           IFrCtlAttr         fcatClPlcmt;    // Control placement flags
  162.     const IWindow*           pwndClRel;      // Relative IWindow
  163.           IEDefFrameCtl      fctClRel;       // Relative std frame ctl id
  164.           unsigned long      ulClDim;        // Dimension of the control
  165.           IPair              pairClDimMult;  // Multiplicand for dimension
  166.  
  167. };/* end class IFrameControlDesc */
  168. #endif /* ndef _IFRCTLDS_ */
  169.