mGNCS API Reference  v1.2.0
A new control set and a new framework for MiniGUI apps
mabstractlist.h
Go to the documentation of this file.
1 
42 #ifndef _MGUI_NCSCTRL_ASTLST_H
43 #define _MGUI_NCSCTRL_ASTLST_H
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif /* __cplusplus */
48 
54 typedef struct _mAbstractList mAbstractList;
55 typedef struct _mAbstractListClass mAbstractListClass;
56 typedef struct _mAbstractListRenderer mAbstractListRenderer;
57 
66 
71 #define NCSS_ASTLST_AUTOSORT (0x0001<<NCSS_SWGT_SHIFT)
72 
77 #define NCSS_ASTLST_SHIFT (NCSS_SWGT_SHIFT+1)
78 
79 static inline int _ncs_defcmp_node(mNode *node1, mNode *node2)
80 {
81  const char* str1 = _c(node1)->getText(node1);
82  const char* str2 = _c(node2)->getText(node2);
83 
84  return strcasecmp(str1, str2);
85 }
86 
87 #define mAbstractListHeader(clsName)\
88  mScrollWidgetHeader(clsName) \
89  NCS_CB_CMPNODE nodeCmp; \
90  mNode *root; \
91  int textIndent; \
92  int imageIndent; \
93  Uint16 flags;
94 
111 struct _mAbstractList
112 {
113  mAbstractListHeader(mAbstractList)
114 };
115 
116 #define mAbstractListClassHeader(clsName, superCls) \
117  mScrollWidgetClassHeader(clsName, superCls) \
118  int (*addNode)(clsName*, mNode *node); \
119  int (*insertNode)(clsName*, mNode *node, mNode *prev,mNode *next, int index);\
120  int (*removeNode)(clsName*, mNode *node); \
121  mNode* (*getNode)(clsName*, int index); \
122  int (*indexOf)(clsName*, mNode *node); \
123  BOOL (*isFrozen)(clsName*); \
124  BOOL (*showNode)(clsName*, mNode *node); \
125  void (*refreshNode)(clsName*, mNode *node, const RECT *rcInv); \
126  mNode* (*findNode)(clsName*, DWORD info, int type, BOOL recursion, int startIndex); \
127  \
128  BOOL (*setCurSel)(clsName*, int index); \
129  mNode* (*getCurSel)(clsName*); \
130  BOOL (*selectNode)(clsName*, mNode *node, BOOL select); \
131  \
132  int (*getRect)(clsName*, mNode *node, RECT *rcNode, BOOL bConv); \
133  void (*freeze)(clsName*, BOOL locked); \
134  void (*sortNodes)(clsName*, NCS_CB_CMPNODE func, mNode *parentNode);\
135  void (*notifyEvent)(clsName*, int eventId, DWORD eventInfo);
136 
213 struct _mAbstractListClass
214 {
215  mAbstractListClassHeader(mAbstractList, mScrollWidget)
216 };
217 
218 #define mAbstractListRendererHeader(clsName, parentClass) \
219  mScrollWidgetRendererHeader(clsName, parentClass)
220 
226 struct _mAbstractListRenderer {
227  mAbstractListRendererHeader(mAbstractList, mScrollWidget)
228 };
229 
235 {
240 };
241 
247 {
252 
257 
262 
267 
272 
277 
278  NCSP_ASTLST_TEXTINDENT,
279 
280  NCSP_ASTLST_IMAGEINDENT,
285 };
286 
293 MGNCS_EXPORT extern mAbstractListClass g_stmAbstractListCls;
294 
296 #ifdef __cplusplus
297 }
298 #endif /* __cplusplus */
299 
300 #endif /* _MGUI_NCSCTRL_ASTLST_H */
301 
The virtual function table of mAbstractList, which derived from mScrollWidgetClass.
mAbstractList * mAbstractList_getControl(mNode *node)
Get the associated control handle of the specified node.
The structure of mScrollWidget control, which derived from mWidget. It is the abstract superclass of ...
#define _c(ths)
the marco get the class of a object
Definition: mobject.h:60
mAbstractListNotify
The notification id of mAbstractList.
The structure of mNode. It is the basic class of all nodes occur within specific controls. For example, a list can contain it.
mAbstractListProperty
The properties id of mAbstractList.
The structure of mAbstractList renderer, which inheried from mScrollWidgetRenderer.
The structure of mAbstractList, which derived from mScrollWidget. It is the abstract superclass of al...
MGNCS_EXPORT mAbstractListClass g_stmAbstractListCls
The instance of mAbstractListClass.