// UpdateCtrlFromFile.h: interface for the CUpdateCtrlFromFile class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_UPDATECTRLFROMFILE_H__F41E954D_5981_4BCC_8F40_FC737BC99A0C__INCLUDED_)
#define AFX_UPDATECTRLFROMFILE_H__F41E954D_5981_4BCC_8F40_FC737BC99A0C__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Utility.h"
#include "UpdateEditCtrl.h"
#include "UpdateTextCtrl.h"

#ifdef  BUILD_GUIDLL
#define     DLLCLASS    __declspec(dllexport)
#else
#define     DLLCLASS    __declspec(dllimport)
#endif

struct StDataArray
{
    int iTextId;           // text control id
    int iEditId;           // edit control id

    CString csFileName;    // ini file name
    CString csSectionName; // section name of ini file
    CString csDataName;    // data name as well as keyname of ini file
};

class DLLCLASS CUpdateCtrlFromFile : public CIniFile
{
public:
//  default constructor
    CUpdateCtrlFromFile(int iNoOfData, HWND hDlg = NULL, LPCTSTR lpFileName = NULL,
                        LPCTSTR lpSectionName = NULL);

//  default destructor
    virtual ~CUpdateCtrlFromFile();

//  set the window hander of dialog box
    void SetHWND(HWND hDlg);

//  refresh data on edit box
    void RefreshData();

//  update text ctrl
    void UpdateTextCtrl();

//  insert data array
    void InsertDataArray(int iTextId, int iEditId, LPCTSTR lpDataName,
                         LPCTSTR lpFileName = NULL, LPCTSTR lpSectionName = NULL);

private:
//  max number of data array
    int m_iNoOfDataArray;

//  max array size
    int m_iArrayIndex;

//  data array structure
    StDataArray *m_stDataArray;

//  update edit box control
    CUpdateEditCtrl m_UpdateEditCtrl;

//  update text control
    CUpdateTextCtrl m_UpdateTextCtrl;
};

#endif // !defined(AFX_UPDATECTRLFROMFILE_H__F41E954D_5981_4BCC_8F40_FC737BC99A0C__INCLUDED_)
