mGNCS API Reference  v1.2.0
A new control set and a new framework for MiniGUI apps
mitem_manager.h
Go to the documentation of this file.
1 
42 #ifndef _MGUI_CTRL_ITEMMANAGER_H
43 #define _MGUI_CTRL_ITEMMANAGER_H
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif /* __cplusplus */
48 
53 typedef struct _mItemManager mItemManager;
54 typedef struct _mItemManagerClass mItemManagerClass;
55 typedef struct _mItemManagerRenderer mItemManagerRenderer;
56 
62 typedef int (*NCS_CB_CMPITEM) (mItemManager *manager, HITEM hItem1, HITEM hItem2);
63 
74 typedef int (*NCS_CB_CMPSTR) (const char* s1, const char* s2, size_t n);
75 
80 #define NCSF_ITMMNG_AUTOSORT (0x01<<NCSF_ITEM_SHIFT)
81 
86 #define NCSF_ITMMNG_FROZEN (0x02<<NCSF_ITEM_SHIFT)
87 
92 #define NCSF_ITMMNG_SHIFT (NCSF_ITEM_SHIFT+2)
93 
94 
95 #define mItemManagerHeader(className) \
96  mItemHeader(className) \
97  NCS_CB_CMPITEM itemCmp; \
98  mWidget *obj; \
99  int count; \
100  int totalHeight; \
101  HITEM pItemHilighted; \
102  list_t queue; \
103  list_t selQueue; \
104  NCS_CB_CMPSTR strCmp;
105 
135 struct _mItemManager
136 {
137  mItemManagerHeader(mItemManager)
138 };
139 
140 #define mItemManagerClassHeader(clsName, superCls) \
141  mItemClassHeader(clsName, superCls) \
142  NCS_CB_CMPITEM (*setItemCmpFunc)(clsName*, NCS_CB_CMPITEM func); \
143  int (*moveItem)(clsName*, mItem *curItem, int count, mItem* prevItem); \
144  int (*insertItem)(clsName*, HITEM hItem, HITEM prev, HITEM next, int index, int *pos); \
145  HITEM (*createItem)(clsName*, HITEM prev, HITEM next, int index, int *pos); \
146  int (*inItem)(clsName*, int mouseX, int mouseY, HITEM *pRet, POINT *pt); \
147  NCS_CB_CMPSTR (*setStrCmpFunc)(clsName*, NCS_CB_CMPSTR func); \
148  NCS_CB_CMPSTR (*getStrCmpFunc)(clsName*); \
149  int (*getItemYPos)(clsName*, HITEM hItem); \
150  void (*setAutoSortItem) (clsName*, BOOL sort); \
151  int (*getTotalHeight)(clsName*); \
152  int (*adjustItemsHeight)(clsName*, int diff); \
153  BOOL (*freeze)(clsName*, BOOL lock); \
154  BOOL (*isFrozen)(clsName*); \
155  HITEM (*getFirstItem)(clsName*); \
156  list_t* (*getQueue)(clsName*); \
157  HITEM (*getListEntry)(list_t* entry); \
158  int (*isEmpty)(clsName*); \
159  int (*removeItem)(clsName*, HITEM hItem); \
160  int (*sortItems)(clsName*, NCS_CB_CMPITEM pfn); \
161  BOOL (*removeAll)(clsName*); \
162  int (*indexOf)(clsName*, HITEM hItem); \
163  int (*setHeight)(clsName*, HITEM hItem, int height); \
164  int (*getHeight)(clsName*, HITEM hItem); \
165  HITEM (*getItem)(clsName*, int index); \
166  HITEM (*getNext)(clsName*, HITEM hItem); \
167  HITEM (*getPrev)(clsName*, HITEM hItem); \
168  BOOL (*isSelected)(clsName*, HITEM hItem); \
169  BOOL (*isEnabled)(clsName*, HITEM hItem); \
170  BOOL (*enable)(clsName*, HITEM hItem, BOOL enable); \
171  void (*selectAll)(clsName*); \
172  void (*deselectAll)(clsName*); \
173  BOOL (*select)(clsName*, HITEM hItem, BOOL sel); \
174  HITEM (*hilight)(clsName*, HITEM hItem); \
175  HITEM (*getHilight)(clsName*); \
176  BOOL (*isHilight)(clsName*, HITEM hItem); \
177  int (*getItemCount)(clsName*); \
178  void (*setAddData)(clsName*, HITEM hItem, DWORD addData); \
179  void (*setImage)(clsName*, HITEM hItem, DWORD image); \
180  DWORD (*getAddData)(clsName*, HITEM hItem); \
181  DWORD (*getImage)(clsName*, HITEM hItem); \
182  void (*setFlags)(clsName*, HITEM hItem, DWORD flags); \
183  DWORD (*getFlags)(clsName*, HITEM hItem); \
184  BOOL (*setText)(clsName*, HITEM hItem, const char* text); \
185  const char* (*getText)(clsName*, HITEM hItem); \
186  int (*getTextLen)(clsName*, HITEM hItem); \
187  BOOL (*getSelection)(clsName*, HITEM *pRet, int count); \
188  int (*getSelectionCount)(clsName*);
189 
403 struct _mItemManagerClass
404 {
405  mItemManagerClassHeader(mItemManager, mItem)
406 };
407 
414 MGNCS_EXPORT extern mItemManagerClass g_stmItemManagerCls;
415 
421 {
426 
431 
436 
441 };
444 #ifdef __cplusplus
445 }
446 #endif /* __cplusplus */
447 
448 #endif /* _MGUI_CTRL_ITEMMANAGER_H */
MGNCS_EXPORT mItemManagerClass g_stmItemManagerCls
The instance of mItemManagerClass.
GHANDLE HITEM
The handle of item widget.
Definition: mitem.h:63
int(* NCS_CB_CMPSTR)(const char *s1, const char *s2, size_t n)
The Callback of general string compare function.
Definition: mitem_manager.h:74
mItemManagerProp
The properties id of mItemManager.
The structure of mItem. It is the abstract superclass of all items occur within specific controls...
The virtual function table of mItemManager, which derived from mItemClass.
int(* NCS_CB_CMPITEM)(mItemManager *manager, HITEM hItem1, HITEM hItem2)
The callback of item compare function.
Definition: mitem_manager.h:62
The structure of mItemManager control, which derived from mItem. It is the abstract superclass of all...