52 #ifndef _MGNCS_TABLEVIEWPIECE_H
53 #define _MGNCS_TABLEVIEWPIECE_H
59 typedef struct _mTableViewPiece mTableViewPiece;
60 typedef struct _mTableViewPieceClass mTableViewPieceClass;
62 typedef struct _mIndexPath{
68 typedef enum _TableViewAnimType {
69 NCS_TABLEVIEW_ANIMATIONNONE = 0,
70 NCS_TABLEVIEW_ANIMATIONFADE,
71 NCS_TABLEVIEW_ANIMATIONZOOM,
72 NCS_TABLEVIEW_ANIMATIONLEFT,
75 enum mTableViewSeparatorStyle{
76 NCS_TABLEVIEW_SEPARATORSTYLE_NONE = 0,
77 NCS_TABLEVIEW_SEPARATORSTYLE_SINGLINE,
78 NCS_TABLEVIEW_SEPARATORSTYLE_MAX,
81 enum mTableViewPieceState{
82 NCS_TABLEVIEW_NORMAL = 0,
86 enum mTableViewPieceEvent {
87 NCSN_TABLEVIEW_CONTENTCLICKED= USER_PIECE_EVENT_BEGIN + 0x400,
91 NCS_TABLEVIEW_GROUP_STYLE = 0,
92 NCS_TABLEVIEW_INDEX_STYLE,
93 NCS_TABLEVIEW_INDEXLOCATE_STYLE,
96 enum mTableViewItemPieceType {
97 NCS_TABLEVIEW_NORMALROWTYPE = 0,
98 NCS_TABLEVIEW_SEPARATORTYPE,
99 NCS_TABLEVIEW_SECTIONTYPE,
100 NCS_TABLEVIEW_TITLETYPE,
103 #define MSG_TABLEVIEWPIECE_STATE_CHANGED (MSG_USER + 100)
104 #define MSG_TABLEVIEWPIECE_DELITEM (MSG_USER + 101)
106 #define NCS_TABLEVIEW_GROUPGAP 30
107 #define NCS_TABLEVIEW_INDEXLOCATE_W 30
108 #define NCS_TABLEVIEW_INDEXLOCATE_Y 0
110 #define NCS_TABLEVIEW_SEPARATOR_DEFAULTCOLOR 0xffced3d6
112 #define mTableViewPieceHeader(clss) \
113 mScrollViewPieceHeader(clss) \
114 mTableViewItemPiece* focusPiece; \
118 mIndexLocatePiece* indexLocate; \
119 mPanelPiece* tablePanel; \
120 DWORD separatorColor;\
124 struct _mTableViewPiece
126 mTableViewPieceHeader(mTableViewPiece)
129 #define mTableViewPieceClassHeader(clss, superCls) \
130 mScrollViewPieceClassHeader(clss, superCls) \
131 void (*changeMode)(clss*); \
132 void (*getDefaultRowRect)(clss* self, RECT* rect); \
133 mPanelPiece* (*createSeparatorLine)(clss* self, BOOL border); \
134 mPanelPiece* (*createDefaultRow)(clss* self, mTableViewItemPiece* item_piece);\
135 void (*reloadData)(clss* self);\
136 mPanelPiece* (*createIndexSectionHead)(clss* self, int section); \
137 mPanelPiece* (*createIndexSectionContent)(clss* self, int section);\
138 mPanelPiece* (*createGroupSectionContent)(clss* self, int section);\
139 mTableViewItemPiece* (*indexPathToItem)(clss* self, const mIndexPath* indexpath);\
140 void (*itemToIndexPath)(clss* self, const mTableViewItemPiece* item, mIndexPath* indexpath);\
141 void (*insertRowAtIndexPath)(clss* self, const mIndexPath* indexpath, TableViewAnimType animtype);\
142 void (*deleteRowAtIndexPath)(clss* self, const mIndexPath* indexpath, TableViewAnimType animtype);\
143 void (*rectForHeaderInSection)(clss* self, int section, RECT* rect); \
144 void (*rectForRowAtIndexPath)(clss* self, const mIndexPath* indexpath, RECT* rect);\
145 void (*rectForSection)(clss* self, int section, RECT* rect);\
146 void (*setSeparatorStyle)(clss* self, enum mTableViewSeparatorStyle);\
147 void (*setSeparatorColor)(clss* self, DWORD color);\
149 BOOL (*willSelectRowAtIndexPath)(clss* self, const mIndexPath* indexpath);\
150 void (*onCommitInsertRowAtIndexPath)(clss* self, const mIndexPath* indexpath); \
151 void (*onCommitDeleteRowAtIndexPath)(clss* self, const mIndexPath* indexpath); \
152 mTableViewItemPiece* (*createItemForRow)(clss* self, const mIndexPath* indexpath);\
153 int (*numberOfSections)(clss* self); \
154 int (*numberOfRowsInSection)(clss* self, int section);\
155 const char* (*titleForSection)(clss* self, int section); \
156 const char* (*indexForSection)(clss* self, int section);\
157 void (*rowDidSelectAtIndexPath)(clss* self, const mIndexPath* indexpath);
160 struct _mTableViewPieceClass
162 mTableViewPieceClassHeader(mTableViewPiece, mScrollViewPiece)
165 MGNCS_EXPORT
extern mTableViewPieceClass g_stmTableViewPieceCls;