XCell.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #pragma once
  2. #include "Markup.h"
  3. //alignment define
  4. static const int ALIGN_LEFT = DT_LEFT; //0
  5. static const int ALIGN_CENTER = DT_CENTER; //
  6. static const int ALIGN_RIGHT = DT_RIGHT; //
  7. static const int ALIGN_TOP = DT_TOP; //0
  8. static const int ALIGN_MIDDLE = DT_VCENTER; //
  9. static const int ALIGN_BOTTOM = DT_BOTTOM; //
  10. static const int ALIGN_MASK = ALIGN_LEFT | ALIGN_CENTER | ALIGN_RIGHT
  11. | ALIGN_TOP | ALIGN_MIDDLE | ALIGN_BOTTOM;
  12. class XTable;
  13. class XCell
  14. {
  15. friend class XTable;
  16. public:
  17. XCell(XTable* parent = NULL);
  18. ~XCell(void);
  19. XCell& operator = (XCell& cell);
  20. int ToXML (CMarkup& markup);
  21. int FromXML (CMarkup& markup);
  22. public:
  23. int rowSpan;
  24. int colSpan;
  25. CString text;
  26. COLORREF textColor;
  27. CFont* textFont;
  28. int textFontSize;
  29. CString textFontFace;
  30. CString label;
  31. COLORREF labelColor;
  32. CFont* labelFont;
  33. int labelFontSize;
  34. CString labelFontFace;
  35. int format;
  36. int leftMargin;
  37. int rightMargin;
  38. int backMode;
  39. COLORREF backColor;
  40. COLORREF borderColor;
  41. int borderStyle;
  42. bool overlap;
  43. XTable* table;
  44. public:
  45. int SetSpan(int rows, int cols);
  46. int SetText(CString str);
  47. CString GetText();
  48. int SetTextColor(COLORREF color);
  49. COLORREF GetTextColor();
  50. int SetTextFont(CFont* font);
  51. CFont* GetTextFont();
  52. int SetTextFontSize(int size);
  53. int GetTextFontSize();
  54. int SetLabel(CString str);
  55. CString GetLabel();
  56. int SetLabelColor(COLORREF color);
  57. COLORREF GetLabelColor();
  58. int SetLabelFont(CFont* font);
  59. CFont* GetLabelFont();
  60. int SetLabelFontSize(int size);
  61. int GetLabelFontSize();
  62. int SetFormat(int format);
  63. int GetFormat();
  64. int SetLeftMargin(int pixels);
  65. int GetLeftMargin();
  66. int SetRightMargin(int pixels);
  67. int GetRightMargin();
  68. int SetBackMode(int mode);
  69. int GetBackMode();
  70. int SetBackColor(COLORREF color);
  71. COLORREF GetBackColor();
  72. int SetBorderSyle(int syle);
  73. int GetBorderSyle();
  74. int SetOverlap (bool enable);
  75. bool GetOverlap ();
  76. int SetAlignment (int align);
  77. int GetAlignment ();
  78. int SetSingleLine (bool enable);
  79. bool GetSingleLine ();
  80. int SetWordbreak (bool enable);
  81. bool GetWordbreak ();
  82. int SetEllipsis (bool enable);
  83. bool GetEllipsis ();
  84. int CalcTextRect (CDC* pDC, RECT* rect);
  85. public:
  86. int Draw(CDC* pDC, RECT rect);
  87. int DrawText(CDC* pDC, RECT rect);
  88. int DrawLabel(CDC* pDC, RECT rect);
  89. int DrawBorder(CDC* pDC, RECT rect);
  90. int DrawBackground (CDC* pDC, RECT rect);
  91. int DrawHitBorder (CDC* pDC, RECT rect, COLORREF color);
  92. };