00001
00026 #ifndef _MGUI_CTRL_ITEMMANAGER_H
00027 #define _MGUI_CTRL_ITEMMANAGER_H
00028
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032
00037 typedef struct _mItemManager mItemManager;
00038 typedef struct _mItemManagerClass mItemManagerClass;
00039 typedef struct _mItemManagerRenderer mItemManagerRenderer;
00040
00046 typedef int (*NCS_CB_CMPITEM) (mItemManager *manager, HITEM hItem1, HITEM hItem2);
00047
00058 typedef int (*NCS_CB_CMPSTR) (const char* s1, const char* s2, size_t n);
00059
00064 #define NCSF_ITMMNG_AUTOSORT (0x01<<NCSF_ITEM_SHIFT)
00065
00070 #define NCSF_ITMMNG_FROZEN (0x02<<NCSF_ITEM_SHIFT)
00071
00076 #define NCSF_ITMMNG_SHIFT (NCSF_ITEM_SHIFT+2)
00077
00078
00079 #define mItemManagerHeader(className) \
00080 mItemHeader(className) \
00081 NCS_CB_CMPITEM itemCmp; \
00082 mWidget *obj; \
00083 int count; \
00084 int totalHeight; \
00085 HITEM pItemHilighted; \
00086 list_t queue; \
00087 list_t selQueue; \
00088 NCS_CB_CMPSTR strCmp;
00089
00119 struct _mItemManager
00120 {
00121 mItemManagerHeader(mItemManager)
00122 };
00123
00124 #define mItemManagerClassHeader(clsName, superCls) \
00125 mItemClassHeader(clsName, superCls) \
00126 NCS_CB_CMPITEM (*setItemCmpFunc)(clsName*, NCS_CB_CMPITEM func); \
00127 int (*moveItem)(clsName*, mItem *curItem, int count, mItem* prevItem); \
00128 int (*insertItem)(clsName*, HITEM hItem, HITEM prev, HITEM next, int index, int *pos); \
00129 HITEM (*createItem)(clsName*, HITEM prev, HITEM next, int index, int *pos); \
00130 int (*inItem)(clsName*, int mouseX, int mouseY, HITEM *pRet, POINT *pt); \
00131 NCS_CB_CMPSTR (*setStrCmpFunc)(clsName*, NCS_CB_CMPSTR func); \
00132 NCS_CB_CMPSTR (*getStrCmpFunc)(clsName*); \
00133 int (*getItemYPos)(clsName*, HITEM hItem); \
00134 void (*setAutoSortItem) (clsName*, BOOL sort); \
00135 int (*getTotalHeight)(clsName*); \
00136 int (*adjustItemsHeight)(clsName*, int diff); \
00137 BOOL (*freeze)(clsName*, BOOL lock); \
00138 BOOL (*isFrozen)(clsName*); \
00139 HITEM (*getFirstItem)(clsName*); \
00140 list_t* (*getQueue)(clsName*); \
00141 HITEM (*getListEntry)(list_t* entry); \
00142 int (*isEmpty)(clsName*); \
00143 int (*removeItem)(clsName*, HITEM hItem); \
00144 int (*sortItems)(clsName*, NCS_CB_CMPITEM pfn); \
00145 BOOL (*removeAll)(clsName*); \
00146 int (*indexOf)(clsName*, HITEM hItem); \
00147 int (*setHeight)(clsName*, HITEM hItem, int height); \
00148 int (*getHeight)(clsName*, HITEM hItem); \
00149 HITEM (*getItem)(clsName*, int index); \
00150 HITEM (*getNext)(clsName*, HITEM hItem); \
00151 HITEM (*getPrev)(clsName*, HITEM hItem); \
00152 BOOL (*isSelected)(clsName*, HITEM hItem); \
00153 BOOL (*isEnabled)(clsName*, HITEM hItem); \
00154 BOOL (*enable)(clsName*, HITEM hItem, BOOL enable); \
00155 void (*selectAll)(clsName*); \
00156 void (*deselectAll)(clsName*); \
00157 BOOL (*select)(clsName*, HITEM hItem, BOOL sel); \
00158 HITEM (*hilight)(clsName*, HITEM hItem); \
00159 HITEM (*getHilight)(clsName*); \
00160 BOOL (*isHilight)(clsName*, HITEM hItem); \
00161 int (*getItemCount)(clsName*); \
00162 void (*setAddData)(clsName*, HITEM hItem, DWORD addData); \
00163 void (*setImage)(clsName*, HITEM hItem, DWORD image); \
00164 DWORD (*getAddData)(clsName*, HITEM hItem); \
00165 DWORD (*getImage)(clsName*, HITEM hItem); \
00166 void (*setFlags)(clsName*, HITEM hItem, DWORD flags); \
00167 DWORD (*getFlags)(clsName*, HITEM hItem); \
00168 BOOL (*setText)(clsName*, HITEM hItem, const char* text); \
00169 const char* (*getText)(clsName*, HITEM hItem); \
00170 int (*getTextLen)(clsName*, HITEM hItem); \
00171 BOOL (*getSelection)(clsName*, HITEM *pRet, int count); \
00172 int (*getSelectionCount)(clsName*);
00173
00387 struct _mItemManagerClass
00388 {
00389 mItemManagerClassHeader(mItemManager, mItem)
00390 };
00391
00398 MGNCS_EXPORT extern mItemManagerClass g_stmItemManagerCls;
00399
00404 enum mItemManagerProp
00405 {
00409 NCSP_ITMMNG_FLAGS = NCSP_ITEM_FLAGS,
00410
00414 NCSP_ITMMNG_ITEMCOUNT = NCSP_ITEM_MAX + 1,
00415
00419 NCSP_ITMMNG_TOTALHEIGHT,
00420
00424 NCSP_ITMMNG_MAX,
00425 };
00428 #ifdef __cplusplus
00429 }
00430 #endif
00431
00432 #endif