home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / VFORM.ZIP / Samples / VfbEx / DynamicVF.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-10  |  3.4 KB  |  126 lines

  1. // -------------------------------------------------------------------------
  2. // DynamicVF.h
  3. // -------------------------------------------------------------------------
  4. #ifndef __DYNAMICVF_H__
  5. #define __DYNAMICVF_H__
  6.  
  7. #include "vForm.h"
  8. #include "vCtl2.h"
  9. #include <afxTempl.h>                // For the dynamic CArray
  10.  
  11.  
  12. // ------ Control Identifiers -----
  13.  
  14. // ----- Forward Declarations -----
  15. class DynamicVf;
  16. class CVfBldrDoc;
  17. class CVfbSection;
  18. class VfbCtl;
  19.  
  20.  
  21. // -------------------------------------------------------------------------
  22. // TestData Class - test data
  23. // - This is our Test Data - we will be using a CArray of these objects.
  24. // -------------------------------------------------------------------------
  25. class TestData
  26. {
  27. public:
  28.     TestData();
  29.  
  30. public:
  31.     CStringArray    m_fld;        // Array of strings
  32.     TestData& operator =(TestData &that);
  33. };
  34.  
  35. typedef CArray<TestData, TestData&>    TestDataArray;
  36.  
  37.  
  38. // -------------------------------------------------------------------------
  39. // Class DynamicVfHdr
  40. // -------------------------------------------------------------------------
  41. class DynamicVfHdr : public VHeader
  42. {
  43. public:
  44.     DynamicVfHdr() {};
  45. };
  46.  
  47.  
  48. // -------------------------------------------------------------------------
  49. // Class DynamicVfDtl
  50. // -------------------------------------------------------------------------
  51. class DynamicVfDtl : public VRow
  52. {
  53. public:
  54.     DynamicVfDtl();
  55. };
  56.  
  57.  
  58. // -------------------------------------------------------------------------
  59. // Class DynamicVfFtr
  60. // -------------------------------------------------------------------------
  61. class DynamicVfFtr : public VHeader
  62. {
  63. public:
  64.     DynamicVfFtr() {};
  65. };
  66.  
  67.  
  68. // -------------------------------------------------------------------------
  69. // Class DynamicVf
  70. // -------------------------------------------------------------------------
  71. class DynamicVf : public VForm
  72. {
  73. protected:
  74.     TestDataArray    m_data;            // Our test data
  75.     int                m_nFldCnt;        // number of data fields
  76.     BOOL            m_bDropSource;    // TRUE if we are a drop source
  77.  
  78. public:
  79.     DynamicVf();
  80.     virtual ~DynamicVf() {};
  81.  
  82.     void    ResetFieldCount();
  83.     int        CalcFieldCount(VRow *pRow);
  84.     BOOL    LoadVfbFile(LPCSTR szVfbFile);    // overridden
  85.     CPalette* GetBackgroundPalette();
  86.  
  87.     BOOL    DropSource()            { return m_bDropSource; }
  88.     void    DropSource(BOOL bFlag)    { m_bDropSource = bFlag; }
  89.  
  90. // Operations
  91. public:
  92. // Overrides
  93.     // ClassWizard generated virtual function overrides
  94.     //{{AFX_VIRTUAL(DynamicVf)
  95.     // public:
  96.     protected:
  97.     //}}AFX_VIRTUAL
  98.  
  99. protected:
  100.     virtual VRow*    InitRow();
  101.  
  102.     // --- the following functions deal with the Data ---
  103.     virtual BOOL    OnGetRow(VRow* pRow);        // Gets row for screen
  104. //    virtual BOOL    OnGetRptRow(VRow* pRow);    // Gets row for report
  105.     virtual BOOL    OnSaveRow(VRow* pRow);        // Save row from screen
  106.     virtual BOOL    OnAddRow(VRow* pRow);        // Add a row
  107.     virtual void    OnStartAdd(VRow* pRow);        // Start of Add: Defaults
  108.     virtual BOOL    OnDelete();                    // Delete row(s)
  109. //    virtual void    OnClick(VRow* pRow, int nId);
  110.  
  111.     virtual BOOL    OnBeginDrag(long nRowId);    // Use as a Drag Source
  112.     virtual BOOL    OnDrop(long nRowId,
  113.                         COleDataObject* pDataObject, DROPEFFECT dropEffect);
  114.  
  115. // Generated message map functions
  116. protected:
  117.     //{{AFX_MSG(DynamicVf)
  118.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  119.     afx_msg void OnSize(UINT nType, int cx, int cy);
  120.     //}}AFX_MSG
  121.     DECLARE_MESSAGE_MAP()
  122.  
  123. };
  124.  
  125. #endif    // __DYNAMICVF_H__
  126.