/****************************************************************************
**
**  Name:  YYHGRID.h
**
**  Description:
**     Definition  for the class CYYHGrid.
**
**  Status:  PRELIMINARY
**
**  $Log:   D:/EPSLDV1/SRC/LOG/YYHGRID.H__  $
** 
**    Rev 1.6   20 Jun 1996 09:28:10   ZJRD
** EasyPack/SLD Version 1.20a
** 
**    Rev 1.4   10 Jun 1996 10:22:48   ZJRD
** EasyPack/SLD Version 1.20
** 
**    Rev 1.2   29 May 1996 09:33:44   ZJRD
** No change.
** 
**    Rev 1.1   16 May 1996 09:02:20   ZJRD
** No change.
** 
**    Rev 1.0   10 May 1996 09:17:10   ZJRD
** Initial revision.
** 
**  $Header:   D:/EPSLDV1/SRC/LOG/YYHGRID.H__   1.6   20 Jun 1996 09:28:10   ZJRD  $
**
**  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);
// 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;

    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)////////////////////////////////////////////
