www.pudn.com > TableTest.rar > XTable.h


#if !defined(AFX_XTABLE_H__FA4E9FFF_993D_4C35_BC0E_31C2C337BFCA__INCLUDED_) 
#define AFX_XTABLE_H__FA4E9FFF_993D_4C35_BC0E_31C2C337BFCA__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
// XTable.h : header file 
// 
 
///////////////////////////////////////////////////////////////////////////// 
// CXTable window 
#include "XCell.h" 
 
const int MAX_ROWS = 256; 
const int MAX_COLS = 128; 
 
class CXTable : public CWnd 
{ 
// Construction 
	friend class CXCell; 
 
public: 
	CXTable(int rows = 0, int cols = 0); 
	virtual ~CXTable(); 
 
// Attributes 
public: 
	RECT m_rect; 
	CXCell* cells; 
	CXCell defaultCell; 
	int* rowHeight; 
	int* colWidth; 
 
	int rows; 
	int cols; 
 
	int focusRow; 
	int focusCol; 
	 
	int defaultHeight; 
	int defaultWidth; 
public: 
	int SetRows(int rows); 
	int GetRows(); 
	int SetCols(int cols); 
	int GetCols(); 
 
	int SetRowHeight(int row, int height); 
	int GetRowHeight(int row); 
 
	int SetColWidth(int col, int width); 
	int GetColWidth(int col); 
 
	int GetRowsHeight(int startRow, int endRow); 
	int GetColsWidth(int startCol, int endCol); 
 
	int AppendRow() {return SetRows(GetRows() + 1);} 
	int AppendCol() {return SetCols(GetCols() + 1);} 
	int deleteRow() {return SetRows(GetRows() - 1);} 
	int deleteCol() {return SetCols(GetCols() - 1);} 
 
	int JoinCells (int startRow, int startCol, int endRow, int endCol); 
	int UnjoinCells (int row, int col); 
 
	int SetCells(int row, int col, CXCell& cell); 
	CXCell* GetCells(int row, int col); 
 
 
	int SetText(int row, int col, CString str); 
	CString GetText(int row, int col); 
 
	int SetTextColor(int row, int col, COLORREF color); 
	COLORREF GetTextColor(int row, int col); 
 
	int SetTextFont(int row, int col, CFont& font); 
	CFont* GetTextFont(int row, int col); 
 
	int SetTextFontSize(int row, int col, int size); 
	int GetTextFontSize(int row, int col); 
 
	int SetBackColor(int row, int col, COLORREF color); 
	COLORREF GetBackColor(int row, int col); 
 
	int SetBackMode(int row, int col, int mode); 
	int GetBackMode(int row, int col); 
 
	int SetOverlap (int row, int col, bool enable); 
	bool GetOverlap (int row, int col); 
 
	int SetAlignment (int row, int col, int align); 
	int GetAlignment (int row, int col); 
 
	int SetWordbreak (int row, int col, bool enable); 
	bool GetWordbreak (int row, int col); 
public: 
 
	int Draw(CDC* pDC); 
	RECT GetRect(int row, int col); 
	bool HitTest (CPoint point, int& row, int& col); 
 
	int Test (); 
	int Test2 (); 
// Operations 
public: 
 
	virtual void OnDraw(CDC* pDC); 
	static BOOL RegisterWindowClass(); 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CXTable) 
	public: 
	virtual BOOL Create(const RECT& rect, CWnd* parent, UINT nID, DWORD dwStyle ); 
	//}}AFX_VIRTUAL 
 
// Implementation 
 
	// Generated message map functions 
protected: 
	//{{AFX_MSG(CXTable) 
	afx_msg void OnPaint(); 
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point); 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_XTABLE_H__FA4E9FFF_993D_4C35_BC0E_31C2C337BFCA__INCLUDED_)