home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IFRCTLDS_
- #define _IFRCTLDS_
- /**************************************************************/
- /* CLASS NAME: IFrameControlDesc */
- /* */
- /* DESCRIPTION : Frame control description class */
- /* */
- /* NOTE: */
- /* */
- /* CHANGE ACTIVITY: */
- /* DATE: INITIAL: DESCRIPTION */
- /* 090592 Ph. Gregoire Initial coding */
- /* 040692 Kevin Leong Change IAppWindow - IStdWindow */
- /* 090892 Ph. Gregoire Moved from pre-3.0 code */
- /* 260892 Ph. Gregoire Changed to support client */
- /* */
- /**************************************************************/
- /* Copyright (c) IBM Corporation 1991 */
- /**************************************************************/
-
- // forward references
- class IFrameControlDesc; /* fcdesc */
-
- #ifndef _IBASETYP_
- #include <ibasetyp.hpp>
- #endif
- #ifndef _IPOINT_
- #include <ipoint.hpp>
- #endif
- #ifndef _IRECT_
- #include <irect.hpp>
- #endif
- #ifndef _IWINDOW_
- #include <iwindow.hpp>
- #endif
- #ifndef _IFRAME_
- #include <iframe.hpp>
- #endif
-
- #include <IFrCtlAt.hpp> // frame control attributes
-
- /**************************************************************/
- /* IFrameControlDesc class */
- /* */
- /* The IFrameWindow keeps a list of these descriptors */
- /**************************************************************/
- class IFrameControlDesc
- {
- friend class IFrameWindow;
-
- public:
- // Constructor
- IFrameControlDesc(
- IWindow* pwndControl, // Control IWindow
- IFrCtlAttr fcatPlace, // Control placement flags
- // If the 'adjust' flag is set, the
- // dimension of the control will be
- // re-adjusted after all controls have
- // been positionned and shrunk.
- // Setting the flag this may leave holes
- // in the frame.
- // The 'behind' flag controls
- // whether the control is to be placed
- // behind the relative window or on
- // top.
- const IWindow* pwndRelative, // Window relative to which to place control
- // if NULL, it is relative to a std FID_
- IEDefFrameCtl fctRelative, // If above is NULL, relative frame
- // control id (typically, FID_CLIENT)
- unsigned long ulDimension, // Dimension of the control, for the
- // one not fixed by relative (i.e.,
- // for RIGHT or LEFT this is the width,
- // for TOP or BOTTOM it is the height
- const IPair& pairDimMult); // Multiplier for dimension, will be
- // multiplied to the relative window's
- // dimension and added to ulDimension.
- // For example, to get three quarters,
- // specify IPair(3,4). Must be <1,
- // i.e., integer part < frac part
-
- // Destructor
- virtual ~IFrameControlDesc() {;};
-
- // Remark: copy constructor has been left over, since there
- // can be only one descriptor per control
-
- // Methods to query/set instance vars
- Boolean setRelative(const IWindow* pwndRelative);
- const IWindow* relativeWindow() const;
- Boolean setRelative(IEDefFrameCtl fctRelative);
- IEDefFrameCtl relativeFrameId() const;
- Boolean setDimension(unsigned long ulDim);
- unsigned long dimension() const;
- Boolean setDimMultiplier(const IPair& pairDimMult);
- IPair dimMultiplier() const;
- IWindow* controlWindow() const;
-
- protected:
- // no protected methods, this class is not intended to be subclassed
-
-
- private:
- /* methods */
- // Methods to handle positionning of controls, to be called from
- // The IFrameWindow during WM_FORMATFRAME on IAppFrame
- // Returns TRUE if the control position has been set up in swpControl
- // first pass computation
- Boolean positionControl(
- void* pswp, // SWP array gotten from WM_FORMATFRAME
- unsigned long ulSwpSize, // size of array (control count so far)
- void* pswpControl, // return values for control pos here
- const IRectangle& rectClient); // client space rectangle
-
- // Second pass adjustment
- Boolean adjustControl(
- void* pswp, // SWP array gotten from WM_FORMATFRAME
- unsigned long ulSwpSize); // size of array
-
- // return the gap size (for lines or sep bar)
- long gapDimension() const;
-
- // Paint frame control
- void paintSepLine(const IPresSpaceHandle& pshFrame) const;
-
- // Returns true if on split bar
- Boolean isOnSplitBar(const IPoint& pt, Boolean& bHorz) const;
-
- // fills-in a trackinfo structure
- Boolean setTrackInfo(const IPoint& ptMouse, void* pTrackInfo, long lSize) const;
- void setEdgeTo(const IRectangle& rect);
-
- // get the control's index within SWP array
- long controlIndex(void* pswp,
- unsigned long ulSwpSize);
- // get the relative window's index within SWP array
- long relativeIndex(void* pswp,
- unsigned long ulSwpSize);
- // scan SWP array for hwnd
- long controlIndex(void* pswp,
- unsigned long ulSwpSize,
- const IWindowHandle& wndh);
-
- // helper in-line functions
- Boolean isLow() const { return( (fcatClPlcmt & IFrCtlAttr::placeUp)==0 ); }
- Boolean isUp() const { return( (fcatClPlcmt & IFrCtlAttr::placeUp)!=0 ); }
- Boolean isHorz() const { return( (fcatClPlcmt & IFrCtlAttr::placeVert)==0 ); }
- Boolean isVert() const { return( (fcatClPlcmt & IFrCtlAttr::placeVert)!=0 ); }
- Boolean isLeft() const { return( isHorz() & isLow() ); }
- Boolean isRight() const { return( isHorz() & isUp() ); }
- Boolean isBottom() const { return( isVert() & isLow() ); }
- Boolean isTop() const { return( isVert() & isUp() ); }
- Boolean isCenter() const { return( (fcatClPlcmt & IFrCtlAttr::centerArea)!=0 ); }
- Boolean isBehind() const { return( (fcatClPlcmt & IFrCtlAttr::behind)!=0 ); }
- Boolean isAdjust() const { return( (fcatClPlcmt & IFrCtlAttr::adjust)!=0 ); }
- Boolean isThinL() const { return( (fcatClPlcmt & IFrCtlAttr::thinSepLine)!=0 ); }
- Boolean isThickL() const { return( (fcatClPlcmt & IFrCtlAttr::thickSepLine)!=0 ); }
- Boolean isSplitB() const { return( (fcatClPlcmt & IFrCtlAttr::splitBar)!=0 ); }
-
- /* instance vars */
- IWindow* pwndClControl; // Control IWindow
- IFrCtlAttr fcatClPlcmt; // Control placement flags
- const IWindow* pwndClRel; // Relative IWindow
- IEDefFrameCtl fctClRel; // Relative std frame ctl id
- unsigned long ulClDim; // Dimension of the control
- IPair pairClDimMult; // Multiplicand for dimension
-
- };/* end class IFrameControlDesc */
- #endif /* ndef _IFRCTLDS_ */