00001
00026 #ifndef _MGUI_NCSCTRL_ASTLST_H
00027 #define _MGUI_NCSCTRL_ASTLST_H
00028
00029
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033
00039 typedef struct _mAbstractList mAbstractList;
00040 typedef struct _mAbstractListClass mAbstractListClass;
00041 typedef struct _mAbstractListRenderer mAbstractListRenderer;
00042
00050 mAbstractList* mAbstractList_getControl(mNode *node);
00051
00056 #define NCSS_ASTLST_AUTOSORT (0x0001<<NCSS_SWGT_SHIFT)
00057
00062 #define NCSS_ASTLST_SHIFT (NCSS_SWGT_SHIFT+1)
00063
00064 static inline int _ncs_defcmp_node(mNode *node1, mNode *node2)
00065 {
00066 const char* str1 = _c(node1)->getText(node1);
00067 const char* str2 = _c(node2)->getText(node2);
00068
00069 return strcasecmp(str1, str2);
00070 }
00071
00072 #define mAbstractListHeader(clsName)\
00073 mScrollWidgetHeader(clsName) \
00074 NCS_CB_CMPNODE nodeCmp; \
00075 mNode *root; \
00076 int textIndent; \
00077 int imageIndent; \
00078 Uint16 flags;
00079
00096 struct _mAbstractList
00097 {
00098 mAbstractListHeader(mAbstractList)
00099 };
00100
00101 #define mAbstractListClassHeader(clsName, superCls) \
00102 mScrollWidgetClassHeader(clsName, superCls) \
00103 int (*addNode)(clsName*, mNode *node); \
00104 int (*insertNode)(clsName*, mNode *node, mNode *prev,mNode *next, int index);\
00105 int (*removeNode)(clsName*, mNode *node); \
00106 mNode* (*getNode)(clsName*, int index); \
00107 int (*indexOf)(clsName*, mNode *node); \
00108 BOOL (*isFrozen)(clsName*); \
00109 BOOL (*showNode)(clsName*, mNode *node); \
00110 void (*refreshNode)(clsName*, mNode *node, const RECT *rcInv); \
00111 mNode* (*findNode)(clsName*, DWORD info, int type, BOOL recursion, int startIndex); \
00112 \
00113 BOOL (*setCurSel)(clsName*, int index); \
00114 mNode* (*getCurSel)(clsName*); \
00115 BOOL (*selectNode)(clsName*, mNode *node, BOOL select); \
00116 \
00117 int (*getRect)(clsName*, mNode *node, RECT *rcNode, BOOL bConv); \
00118 void (*freeze)(clsName*, BOOL locked); \
00119 void (*sortNodes)(clsName*, NCS_CB_CMPNODE func, mNode *parentNode);\
00120 void (*notifyEvent)(clsName*, int eventId, DWORD eventInfo);
00121
00198 struct _mAbstractListClass
00199 {
00200 mAbstractListClassHeader(mAbstractList, mScrollWidget)
00201 };
00202
00203 #define mAbstractListRendererHeader(clsName, parentClass) \
00204 mScrollWidgetRendererHeader(clsName, parentClass)
00205
00211 struct _mAbstractListRenderer {
00212 mAbstractListRendererHeader(mAbstractList, mScrollWidget)
00213 };
00214
00219 enum mAbstractListNotify
00220 {
00224 NCSN_ASTLST_MAX = NCSN_SWGT_MAX + 1,
00225 };
00226
00231 enum mAbstractListProperty
00232 {
00236 NCSP_ASTLST_DEFNODEHEIGHT = NCSP_SWGT_MAX + 1,
00237
00241 NCSP_ASTLST_FONTSIZE,
00242
00246 NCSP_ASTLST_AUTOSORT,
00247
00251 NCSP_ASTLST_TRANSPARENT,
00252
00256 NCSP_ASTLST_CMPNODEFUNC,
00257
00261 NCSP_ASTLST_ROOTNODE,
00262
00263 NCSP_ASTLST_TEXTINDENT,
00264
00265 NCSP_ASTLST_IMAGEINDENT,
00269 NCSP_ASTLST_MAX,
00270 };
00271
00278 MGNCS_EXPORT extern mAbstractListClass g_stmAbstractListCls;
00279
00281 #ifdef __cplusplus
00282 }
00283 #endif
00284
00285 #endif
00286