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

  1. #ifndef __VFBLOAD_H__
  2. #define __VFBLOAD_H__
  3.  
  4. #include "VfUtil.h"
  5. #include "VCtl.h"
  6.  
  7.  
  8. #define VFB_IDENTIFIER        _T("VForm Builder")
  9. #define VFB_VERSION_0x1        _T("0.1")
  10. #define VFB_VERSION_1x0        _T("1.0")
  11. #define CURRENT_VFB_VERSION    _T("1.0")
  12.  
  13. #define VFBMODE_FORM    0
  14. #define VFBMODE_REPORT    1
  15. #define VFBMODE_GRID    2
  16.  
  17. class VForm;
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20. // VfbCtl - base class for all Vfb Controls
  21.  
  22. class VfbCtl : public CObject
  23. {
  24. protected:
  25.     DECLARE_SERIAL(VfbCtl);
  26.     VfbCtl() {};
  27.  
  28. public:
  29.     virtual void    Serialize(CArchive& ar);
  30.     virtual int        IsA()                        { return VCTL_BASE; }
  31.  
  32. // Attributes
  33.     CRect            m_position;        // Actual position of control within section
  34.  
  35.     CString            m_name;            // Name of control
  36.     CString            m_refId;        // Reference name - use to link data source
  37.     long            m_nId;            // ID
  38.     CString            m_text;            // Text of control
  39.     CString            m_helpText;        // Help text for the control
  40.     VColor            m_vclrFore;        // Foreground Color
  41.     VColor            m_vclrBack;        // Background Color
  42.     VColor            m_vclrBorder;    // Border Color
  43.     CString            m_gridCaption;    // Grid Caption
  44.     int                m_nGridWidth;    // Grid Width
  45.     BOOL            m_bVisible;        // TRUE if Visible
  46.     BOOL            m_bTabstop;        // TRUE if control recieves focus
  47.     BOOL            m_bLocked;        // TRUE if control is locked
  48.     BOOL            m_bUseInGrid;    // TRUE if control is used in Grid Mode
  49.     int                m_nLeftMargin;    // Width of the left margin for the control
  50.     int                m_nEffect;        // The effect this control uses
  51.     int                m_nEffectDepth;    // The depth of the effect
  52.     BOOL            m_bBorder;        // TRUE if control has a border
  53.     BOOL            m_bNoInactiveBorder;    // TRUE for no border when inactive
  54.     BOOL            m_bTransparent;    // TRUE for a transparent control
  55.     CString            m_font;            // Font Name
  56.     int                m_nFontSize;    // Font Size in points
  57.     BOOL            m_bFontBold;    // TRUE if font is BOLD
  58.     BOOL            m_bFontItalic;    // TRUE if font is italic
  59.     BOOL            m_bFontUnderline;    // TRUE if font is underlined
  60.     UINT            m_nJustify;        // Text justification
  61. };
  62.  
  63. // special 'list' class for this application (requires afxtempl.h)
  64. typedef CTypedPtrList<CObList, VfbCtl*> VfbCtlList;
  65.  
  66. ////////////////////////////////////////////////////////////////////////
  67. // specialized draw objects
  68.  
  69.  
  70. // -------------------------------------------------------------------------
  71. // VfbStatic
  72. // -------------------------------------------------------------------------
  73. class VfbStatic : public VfbCtl
  74. {
  75. protected:
  76.     DECLARE_SERIAL(VfbStatic);
  77.     VfbStatic() {};
  78.  
  79. // Implementation
  80. public:
  81.     virtual int        IsA()                            { return VCTL_STATIC; }
  82.     virtual void    Serialize(CArchive& ar);
  83. };
  84.  
  85. // -------------------------------------------------------------------------
  86. // VfbEdit
  87. // -------------------------------------------------------------------------
  88. class VfbEdit : public VfbCtl
  89. {
  90. protected:
  91.     DECLARE_SERIAL(VfbEdit);
  92.     VfbEdit() {};
  93.  
  94. public:
  95.     int            m_nEditType;
  96.     BOOL        m_bMultiLine;
  97.     CString        m_mask;
  98.     int            m_nDigits;
  99.     int            m_nDecimals;
  100.     BOOL        m_bDollarSign;
  101.     BOOL        m_bAddCommas;
  102.     BOOL        m_bAllowNeg;
  103.     int            m_nLimitText;
  104.     BOOL        m_bReadOnly;
  105.     BOOL        m_bPassword;
  106.     BOOL        m_bNumeric;
  107.     TCHAR        m_cCase;
  108.     BOOL        m_bSysBackWhenActive;
  109.  
  110. // Implementation
  111. public:
  112.     virtual int        IsA()                            { return VCTL_EDIT; }
  113.     virtual void    Serialize(CArchive& ar);
  114. };
  115.  
  116.  
  117.  
  118. // -------------------------------------------------------------------------
  119. // VfbButton
  120. // -------------------------------------------------------------------------
  121. class VfbButton : public VfbCtl
  122. {
  123. protected:
  124.     DECLARE_SERIAL(VfbButton);
  125.     VfbButton() {};
  126.  
  127. // Implementation
  128. public:
  129.     virtual int        IsA()                            { return VCTL_BUTTON; }
  130.     virtual void    Serialize(CArchive& ar);
  131. };
  132.  
  133. // -------------------------------------------------------------------------
  134. // VfbCheckBox
  135. // -------------------------------------------------------------------------
  136. class VfbCheckBox : public VfbCtl
  137. {
  138. protected:
  139.     DECLARE_SERIAL(VfbCheckBox);
  140.     VfbCheckBox() {};
  141.  
  142. // Implementation
  143. public:
  144.     virtual int        IsA()                            { return VCTL_CHECKBOX; }
  145.     virtual void    Serialize(CArchive& ar);
  146. };
  147.  
  148. // -------------------------------------------------------------------------
  149. // VfbRadio
  150. // -------------------------------------------------------------------------
  151. class VfbRadio : public VfbCtl
  152. {
  153. protected:
  154.     DECLARE_SERIAL(VfbRadio);
  155.     VfbRadio() {};
  156.  
  157. public:
  158.     BOOL        m_bVertical;
  159. // Implementation
  160. public:
  161.     virtual int        IsA()                            { return VCTL_RADIOLIST; }
  162.     virtual void    Serialize(CArchive& ar);
  163. };
  164.  
  165.  
  166. // -------------------------------------------------------------------------
  167. // VfbDropDown
  168. // -------------------------------------------------------------------------
  169. class VfbDropDown : public VfbCtl
  170. {
  171. protected:
  172.     DECLARE_SERIAL(VfbDropDown);
  173.     VfbDropDown() {};
  174.  
  175. // Implementation
  176. public:
  177.     virtual int        IsA()                            { return VCTL_DROPDOWN; }
  178.     virtual void    Serialize(CArchive& ar);
  179. };
  180.  
  181. // -------------------------------------------------------------------------
  182. // VfbPicture
  183. // -------------------------------------------------------------------------
  184. class VfbPicture : public VfbCtl
  185. {
  186. public:
  187.     CString            m_bmpFile;                    // Bitmap file name
  188.     int                m_nImageWidth;                // Width of each image in bmp
  189.                                                 // - use 0 (dflt) for 1 image
  190.     DECLARE_SERIAL(VfbPicture);
  191.     VfbPicture() {};
  192.  
  193. // Implementation
  194. public:
  195.     virtual int        IsA()                            { return VCTL_PICTURE; }
  196.     virtual void    Serialize(CArchive& ar);
  197. };
  198.  
  199. // -------------------------------------------------------------------------
  200. // VfbPictButton
  201. // -------------------------------------------------------------------------
  202. class VfbPictButton : public VfbCtl
  203. {
  204. public:
  205.     CString            m_bmpFile;                    // Bitmap file name
  206.     int                m_nImageWidth;                // Width of each image in bmp
  207.                                                 // - use 0 (dflt) for 1 image    
  208.     DECLARE_SERIAL(VfbPictButton);
  209.     VfbPictButton() {};
  210.  
  211. // Implementation
  212. public:
  213.     virtual int        IsA()                            { return VCTL_PICTBUTTON; }
  214.     virtual void    Serialize(CArchive& ar);
  215. };
  216.  
  217. // -------------------------------------------------------------------------
  218. // VfbPictCycle
  219. // -------------------------------------------------------------------------
  220. class VfbPictCycle : public VfbCtl
  221. {
  222. public:
  223.     CString            m_bmpFile;                    // Bitmap file name
  224.     int                m_nImageWidth;                // Width of each image in bmp
  225.                                                 // - use 0 (dflt) for 1 image    
  226.     DECLARE_SERIAL(VfbPictCycle);
  227.     VfbPictCycle() {};
  228.  
  229. // Implementation
  230. public:
  231.     virtual int        IsA()                            { return VCTL_PICTCYCLE; }
  232.     virtual void    Serialize(CArchive& ar);
  233. };
  234.  
  235. // -------------------------------------------------------------------------
  236. // VfbRectangle
  237. // -------------------------------------------------------------------------
  238. class VfbRectangle : public VfbCtl
  239. {
  240. protected:
  241.     DECLARE_SERIAL(VfbRectangle);
  242.     VfbRectangle() {};
  243.  
  244. // Implementation
  245. public:
  246.     virtual int        IsA()                            { return VCTL_RECTANGLE; }
  247.     virtual void    Serialize(CArchive& ar);
  248. };
  249.  
  250. // -------------------------------------------------------------------------
  251. // VfbLine
  252. // -------------------------------------------------------------------------
  253. class VfbLine : public VfbCtl
  254. {
  255. protected:
  256.     DECLARE_SERIAL(VfbLine);
  257.     VfbLine() {};
  258.  
  259. public:
  260.     BOOL    m_bVertical;
  261.  
  262. // Implementation
  263. public:
  264.     virtual int        IsA()                            { return VCTL_LINE; }
  265.     virtual void    Serialize(CArchive& ar);
  266. };
  267.  
  268. // -------------------------------------------------------------------------
  269. // VfbEllipse
  270. // -------------------------------------------------------------------------
  271. class VfbEllipse : public VfbCtl
  272. {
  273. protected:
  274.     DECLARE_SERIAL(VfbEllipse);
  275.     VfbEllipse() {};
  276.  
  277. // Implementation
  278. public:
  279.     virtual int        IsA()                            { return VCTL_ELLIPSE; }
  280.     virtual void    Serialize(CArchive& ar);
  281. };
  282.  
  283.  
  284. // -------------------------------------------------------------------------
  285. // CVfbSection
  286. // -------------------------------------------------------------------------
  287. class CVfbSection
  288. {
  289. protected:
  290.     VfbCtlList    m_ctls;                    // List of controls in this section
  291.     CString        m_section;                // Section name
  292.     int            m_nHdrHeight;            // Height of section header
  293.     int            m_nHeight;                // Height of the section
  294.     int            m_nBackStyle;            // Background style of section
  295.     VColor        m_vclrBack;                // Background Color of section
  296.     CString        m_bmpFile;                // Bitmap File Name
  297.  
  298. public:
  299.     CVfbSection() {};
  300.     ~CVfbSection();
  301.  
  302.     virtual void    Serialize(CArchive& ar);
  303.     VfbCtlList*    CtlList()                { return &m_ctls; }
  304.     CString        Section()                    { return m_section; }
  305.     void        Section(LPCTSTR szSection)    { m_section = szSection; }
  306.  
  307.     int            HdrHeight()                    { return m_nHdrHeight; }
  308.     int            Height()                    { return m_nHeight; }
  309.     int            BackStyle()                    { return m_nBackStyle; }
  310.     VColor&        BackVColor()                { return m_vclrBack; }
  311.     CString        BmpFile()                    { return m_bmpFile; }
  312.  
  313.     int            GetCtlCount()            { return m_ctls.GetCount(); }
  314. };
  315.  
  316.  
  317. // -------------------------------------------------------------------------
  318. // CVfBldrDoc
  319. // -------------------------------------------------------------------------
  320. class CVfBldrDoc : public CDocument
  321. {
  322. public:
  323.     CVfBldrDoc() {};
  324.     virtual void Serialize(CArchive& ar);
  325.  
  326. // protected:
  327. public:
  328.     VfbCtlList        m_ctls;            // All controls
  329.  
  330.     CString            m_version;
  331.     
  332.     // ----- Options -----
  333.     int                m_nGridX;        // Grid X units
  334.     int                m_nGridY;        // Grid Y units
  335.     BOOL            m_bShowGrid;    // Show the Grid    
  336.     BOOL            m_bSnapToGrid;    // Snap to the grid
  337.     VColor            m_vclrGrid;        // Design grid color
  338.     CString            m_workingDir;    // Working directory
  339.     CString            m_dataReference;// Database, file, etc. reference
  340.     CString            m_dataSource;    // Table, SQL, file, etc.
  341.  
  342.     // ----- Form / Grid Attributes -----
  343.     int                m_nMode;            // Form, Grid, Report
  344.     int                m_nWidth;            // width of form
  345.     BOOL            m_bReadOnly;        // Read Only
  346.     BOOL            m_bAllowAdd;        // Allow auto add of rows
  347.     BOOL            m_bSnapResize;        // Snap resizing of rows
  348.     BOOL            m_bResizeRows;        // Resizable rows
  349.     BOOL            m_bLiveAdjust;        // Selector Tabs
  350.     BOOL            m_bSelectors;        // Selector Tabs
  351.     BOOL            m_bScrollTips;        // Scrolling tool tips
  352.     BOOL            m_bDropSource;        // Drag Drop Source
  353.     BOOL            m_bDropTarget;        // Drag Drop Target
  354.  
  355.     CString            m_gridSettings;        // Column order/widths
  356.     int                m_nGridStyle;        // Grid style
  357.     int                m_nGridRowHeight;    // Grid Row Height
  358.     BOOL            m_bResizeCols;        // Resizable Columns
  359.     BOOL            m_bMoveableCols;    // Moveable Columns
  360.     int                m_nFrozenCols;        // Frozen Columns
  361.     BOOL            m_bGridHdrContextMenu;    // TRUE if using menu
  362.     VColor            m_vclrGridLine;        // Grid Line Color
  363.     VColor            m_vclrGridBack;        // Grid Back Color
  364.     VColor            m_vclrGridText;        // Grid Text Color
  365.     VColor            m_vclrHidden;        // Hidden Color
  366.     CString            m_font;                // Font
  367.     int                m_nFontSize;        // Font Size
  368.     BOOL            m_bFontBold;        // Bold Font
  369.     BOOL            m_bFontItalic;        // Italic Font
  370.     BOOL            m_bFontUnderline;    // Underline Font
  371.  
  372.     CVfbSection        m_sectHdr;
  373.     CVfbSection        m_sectDtl;
  374.     CVfbSection        m_sectFtr;
  375.  
  376. // Attributes
  377. public:
  378.     VfbCtlList*    GetCtls()                { return &m_ctls; }
  379.  
  380.     // -------- Getting Properties --------
  381.     int                Width()                { return m_nWidth; }
  382.     int                GridX()                { return m_nGridX; }
  383.     int                GridY()                { return m_nGridY; }
  384.     BOOL            ShowGrid()            { return m_bShowGrid; }
  385.     BOOL            SnapToGrid()        { return m_bSnapToGrid; }
  386.     COLORREF        GridColor()            { return m_vclrGrid.GetRGB(); }
  387.     CString            GridSettings()        { return m_gridSettings; }
  388.     int                GridStyle()            { return m_nGridStyle; }
  389.  
  390.     BOOL            DropSource()        { return m_bDropSource; }
  391.  
  392.     CVfbSection*    HdrSection()        { return &m_sectHdr; }
  393.     CVfbSection*    DtlSection()        { return &m_sectDtl; }
  394.     CVfbSection*    FtrSection()        { return &m_sectFtr; }
  395.  
  396. protected:
  397.     friend class VForm;
  398. };
  399.  
  400. #endif // __VFBLOAD_H__
  401.