
/***************************************************************************
**
**    $Header:   D:/ECB2S/SRC/LOG/YYHGRID.H__   1.2.1.4   17 Apr 1997 16:10:04   ZJRD  $
**
**    $Log:   D:/ECB2S/SRC/LOG/YYHGRID.H__  $
** 
**    Rev 1.2.1.4   17 Apr 1997 16:10:04   ZJRD
** No change.
** 
**    Rev 1.2.1.3   16 Apr 1997 10:46:20   ZJRD
** No change.
** 
**    Rev 1.2.1.2   10 Apr 1997 15:49:52   ZJRD
** No change.
** 
**    Rev 1.2.1.1   03 Apr 1997 15:28:54   ZJRD
** 2.09E
** 
**    Rev 1.13   13 Dec 1996 11:21:38   ZJRD
** No change.
** 
**    Rev 1.12   22 Nov 1996 11:02:38   ZJRD
** No change.
** 
**    Rev 1.11   11 Nov 1996 12:49:52   ZJRD
** No change.
** 
**    Rev 1.10   06 Nov 1996 13:01:52   ZJRD
** No change.
** 
**    Rev 1.9   02 Nov 1996 09:46:28   ZJRD
** PIC/SLD Version 0.94
** 
**    Rev 1.8   30 Oct 1996 12:48:42   ZJRD
** PIC/SLD Version 0.93
** 
**    Rev 1.7   28 Oct 1996 09:41:38   ZJRD
** PIC/SLD Version 0.92
** 
**    Rev 1.6   21 Oct 1996 09:16:00   ZJRD
** No change.
** 
**    Rev 1.5   09 Oct 1996 13:45:34   ZJRD
** No change.
** 
**    Rev 1.4   23 Sep 1996 10:32:20   ZJRD
** No change.
** 
**    Rev 1.3   06 Sep 1996 13:46:12   ZJRD
** No change.
** 
**    Rev 1.2   02 Sep 1996 11:27:18   ZJRD
** No change.
** 
**    Rev 1.1   15 Aug 1996 10:05:42   ZJRD
** No change.
** 
**    Rev 1.0   13 Aug 1996 09:18:14   ZJRD
** Initial revision.
** 
****************************************************************************/

/****************************************************************************
**
**  Name:  YYHGRID.h
**
**  Description:
**     Definition  for the class CYYHGrid.
**
**  Status:  PRELIMINARY
**
**  Copyright (C) 1995 Microtek International.  All rights reserved.
**
*****************************************************************************/

#define SM_UPDATELOCAL WM_USER +1  
/////////////////////////////////////////////////////////////////////////////
// CYYHGrid frame

class CYYHGrid : public CWnd
{
    DECLARE_DYNCREATE(CYYHGrid)
public:
    CYYHGrid();  
       virtual ~CYYHGrid();         
    BOOL Create(CWnd* pParentWnd,DWORD dwStyle,CRect rect,UINT nID);
    void SetCellText(int nCol,int nRow,char *pstr);  
    void InvalidateCell(int nCol,int nRow); 
    BOOL ResetContent(int level);

    void ResizeCell(int cx, int cy); // added by Jamoon
	void ActiveColValidate();	// added by Jamoon

// Attributes
public:
    
    

    int m_nColWidth[10];
// Operations
public:
    CObList m_ObList;
	CPoint m_ptActiveCell;
    int m_nDefColWidth;
    int m_nDefRowHeight;
    int m_nActiveRow;    
// Implementation
private:
 	BOOL m_bHasPreFocus;
 	BOOL m_bEnable;
    int m_nCols;
    int m_nRows;  
    int m_nTextCenterMode;  
    CEdit *m_pEdit;
    BOOL m_bCurSet;
protected:   

    
//    CRect m_rectFocus; 
//    CRect m_rectPreFocus;
	CPoint m_StartPoint;
    CPoint m_PrePoint;  
    int m_nDragCell;                   
    CRect m_rectClient;
    HCURSOR m_hOldCur;
    int m_nFont;
    CSize m_szFont;
    CPoint m_ptFirst; 
    int m_nFirstViewableCol;
    CSize m_szScroll;

	int NextActiveCol(int nAxtiveX,int nDir);	// added by Jamoon
	void LimitCellLen(int  m_nDragCell); // added by Jamoon
    CRect RowToRect(int nRow); 
    CRect CellToRect(int nCol,int nRow);
    void HighLightRow(CDC*pDC,int nRow); 
    void HighLightCell(CDC*pDC,CPoint pt);
    void GetCellString(int nCol,int nRow,CString& str);
    void Resize(int cx, int cy); 
    void SetGrid(CDC *pDC);
    void DrawGrid(CDC* pDC,int nCols,int nRows,int *nColWidth);  
    int  HitTest(CPoint point); 
    int PointToRow(CPoint point);  
    CPoint PointToCell(CPoint point);   
    int GetGridWidth();
    void Style3D(CDC* pDC,CRect rect);     
    BOOL DeleteContent(); 
    int GetFirstViewableRow();
    int GetLastViewableRow();
    int GetLastViewableCol();
//    virtual BOOL PreCreateWindow(CREATESTRUCT & cs);
    // Generated message map functions
    //{{AFX_MSG(CYYHGrid)
    afx_msg LONG OnSmPaint(UINT,LONG);
    afx_msg void OnPaint();
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    afx_msg void OnSize(UINT nType, int cx, int cy);
    afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
    afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnSetFocus(CWnd* pOldWnd);
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	//}}AFX_MSG
	
    DECLARE_MESSAGE_MAP()
};

////////////////////////////(EOF)////////////////////////////////////////////
