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


// XCell.h: interface for the CXCell class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_XCELL_H__33CEDC14_FC81_4438_8370_CF00056C86E0__INCLUDED_) 
#define AFX_XCELL_H__33CEDC14_FC81_4438_8370_CF00056C86E0__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#include "XTable.h" 
 
static const int ALIGN_LEFT = DT_LEFT; //0 
static const int ALIGN_CENTER = DT_CENTER; // 
static const int ALIGN_RIGHT = DT_RIGHT; // 
 
static const int ALIGN_TOP = DT_TOP; //0 
static const int ALIGN_MIDDLE = DT_VCENTER; // 
static const int ALIGN_BOTTOM = DT_BOTTOM; // 
 
static const int ALIGN_MASK = ALIGN_LEFT | ALIGN_CENTER | ALIGN_RIGHT 
							| ALIGN_TOP | ALIGN_MIDDLE | ALIGN_BOTTOM; 
 
class XTable; 
 
class CXCell   
{ 
	friend class CXTable; 
public: 
	CXCell(CXTable* parent = NULL); 
	virtual ~CXCell(); 
public: 
	int rowSpan; 
	int colSpan; 
 
	CString text; 
	COLORREF textColor; 
	CFont* textFont; 
	int textFontSize; 
	CString textFontFace; 
 
 
	CString label; 
	COLORREF labelColor; 
	CFont* labelFont; 
	int labelFontSize; 
	CString labelFontFace; 
 
 
	int format; 
	int leftMargin; 
	int rightMargin; 
 
	int backMode; 
	COLORREF backColor; 
 
	COLORREF borderColor; 
	int borderStyle; 
 
	bool overlap; 
	CXTable* table; 
public: 
	int SetSpan(int rows, int cols); 
 
	int SetText(CString str); 
	CString GetText(); 
	int SetTextColor(COLORREF color); 
	COLORREF GetTextColor(); 
	int SetTextFont(CFont* font); 
	CFont* GetTextFont(); 
	int SetTextFontSize(int size); 
	int GetTextFontSize(); 
 
	int SetLabel(CString str); 
	CString GetLabel(); 
	int SetLabelColor(COLORREF color); 
	COLORREF GetLabelColor(); 
	int SetLabelFont(CFont* font); 
	CFont* GetLabelFont(); 
	int SetLabelFontSize(int size); 
	int GetLabelFontSize(); 
 
	int SetFormat(int format); 
	int GetFormat(); 
 
	int SetLeftMargin(int pixels); 
	int GetLeftMargin(); 
 
	int SetRightMargin(int pixels); 
	int GetRightMargin(); 
 
	int SetBackMode(int mode); 
	int GetBackMode(); 
 
	int SetBackColor(COLORREF color); 
	COLORREF GetBackColor(); 
 
	int SetBorderSyle(int syle); 
	int GetBorderSyle(); 
 
	int SetOverlap (bool enable); 
	bool GetOverlap (); 
 
	int SetAlignment (int align); 
	int GetAlignment (); 
	int SetSingleLine (bool enable); 
	bool GetSingleLine (); 
 
	int SetWordbreak (bool enable); 
	bool GetWordbreak (); 
 
	int SetEllipsis (bool enable); 
	bool GetEllipsis (); 
	 
	int CalcTextRect (CDC* pDC, RECT* rect); 
 
public: 
	int Draw(CDC* pDC, RECT rect); 
	int DrawText(CDC* pDC, RECT rect); 
	int DrawLabel(CDC* pDC, RECT rect); 
	int DrawBorder(CDC* pDC, RECT rect); 
	int DrawBackground (CDC* pDC, RECT rect); 
	int DrawHitBorder (CDC* pDC, RECT rect, COLORREF color);  
}; 
 
#endif // !defined(AFX_XCELL_H__33CEDC14_FC81_4438_8370_CF00056C86E0__INCLUDED_)