home *** CD-ROM | disk | FTP | other *** search
- // -------------------------------------------------------------------------
- // Copyright @ 1997 TCK Software, Incorporated
- // All Rights Reserved
- // -------------------------------------------------------------------------
- #ifndef __VROWMORPH_H__
- #define __VROWMORPH_H__
-
- #include "VRow.h"
-
- // #include "afxtempl.h" // Already in VRow.h
-
- // -------------------------------------------------------------------------
- // NOTES: Two possible ways to do a morphing row
- //
- // 1) Contain an array of actual rows in the Morphing row
- // - reset the control pointer array as needed
- // - delegate background drawing to active contained row
- // - this requires using multiple virtual functions
- // - also must ensure m_nRowId and m_pForm are set for contained rows
- //
- // 2) Morph row contains various "profiles", when one of these is set
- // the control pointer array is set to that profile.
- // - less problems this way, but developer must put all profiles in
- // this one class.
- //
- // Also - at this time, for simplicity, we have decided to maintain a singular
- // row size for VForm. If our customers inform us of a strong desire for
- // varying row sizes at the same time, that is something we could add.
- //
- // How to use:
- // 1) Derive a class from VRowMorph
- // 2) Include groups of controls in the class (one group for each row type)
- // 3) In the constructor, creat a profile for each group of controls
- // - then add the controls to their respective profiles
- // 4) Finally, set the current profile
- // 5) In VForm::OnGetRow(), you must set which profile the row use
- // 6) Similarly, OnAddRow(), OnSaveRow(), etc. must all use the
- // appropriate group/profile and the fields that go with it.
- //
- // By using VRowMorph, you can easily create a Tree control using VForm
- // - you must combine the multiple row types with ResetNumRows() to
- // expand and collapse rows
- // - the tricky part is keeping track of the underlying data, and which
- // row number corresponds to each data item. This will vary depending
- // on which rows are expanded or collapsed.
- // - BUT... since VForm can be used completely virtually, you can
- // achieve greater performance than on any control that you must load
- // all the data.
- //
- // -------------------------------------------------------------------------
-
- class VRowMorph;
-
- // -------------------------------------------------------------------------
- // VMorphProfile Class - Helper for morphing VRow
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VMorphProfile
- {
- friend class VRowMorph; // Let VRowMorph class use us
- protected:
- VCtlPtrArray m_ctl; // Control Array
- int m_nCtls; // Number of controls
- public:
- VMorphProfile(); // Constructor
-
- VMorphProfile& operator =(VMorphProfile &x);
- void AddCtl(VCtl *xCtl); // Adds a control to this profile
- };
-
-
- // typedef CArray<VRow *, VRow *> VRowPtrArray;
- typedef CArray<VMorphProfile, VMorphProfile&> VProfileArray;
-
- // -------------------------------------------------------------------------
- // VRowMorph Class - Morphing VRow class - row displayed depends on data
- // - derived from the normal VRow class
- // -------------------------------------------------------------------------
- class AFX_EXT_CLASS VRowMorph : public VRow
- {
- public:
- VRowMorph();
-
- void SetProfileIdx(int nIdx);
- int GetProfileIdx() { return m_nProfileIdx; }
- void NewProfile(int nIdx); // Adds/Clears a profile
- VMorphProfile* GetProfile(int nIdx=-1);
-
- virtual int RowType() { return m_nProfileIdx; }
-
- protected:
- int m_nProfileIdx; // Which Profile are we?
- VProfileArray m_profileArr; // Array of profiles
- };
-
- #endif