www.pudn.com > xtable2.zip > XCell.h


#pragma once 
 
//alignment define 
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 XCell 
{ 
    friend class XTable; 
 
public: 
	XCell(XTable* parent = NULL); 
	~XCell(void); 
	 
	XCell& operator = (XCell& cell); 
 
	int ToXML (CMarkup& markup); 
	int FromXML (CMarkup& markup); 
 
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; 
	XTable* 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);  
 
};