mGNCS API Reference  v1.5.0
A new control set and a new framework for MiniGUI apps
mabstractlist.h
Go to the documentation of this file.
1 //
3 // IMPORTANT NOTICE
4 //
5 // The following open source license statement does not apply to any
6 // entity in the Exception List published by FMSoft.
7 //
8 // For more information, please visit:
9 //
10 // https://www.fmsoft.cn/exception-list
11 //
13 
54 #ifndef _MGUI_NCSCTRL_ASTLST_H
55 #define _MGUI_NCSCTRL_ASTLST_H
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif /* __cplusplus */
60 
66 typedef struct _mAbstractList mAbstractList;
67 typedef struct _mAbstractListClass mAbstractListClass;
68 typedef struct _mAbstractListRenderer mAbstractListRenderer;
69 
78 
83 #define NCSS_ASTLST_AUTOSORT (0x0001<<NCSS_SWGT_SHIFT)
84 
89 #define NCSS_ASTLST_SHIFT (NCSS_SWGT_SHIFT+1)
90 
91 static inline int _ncs_defcmp_node(mNode *node1, mNode *node2)
92 {
93  const char* str1 = _c(node1)->getText(node1);
94  const char* str2 = _c(node2)->getText(node2);
95 
96  return strcasecmp(str1, str2);
97 }
98 
99 #define mAbstractListHeader(clsName)\
100  mScrollWidgetHeader(clsName) \
101  NCS_CB_CMPNODE nodeCmp; \
102  mNode *root; \
103  int textIndent; \
104  int imageIndent; \
105  Uint16 flags;
106 
123 struct _mAbstractList
124 {
125  mAbstractListHeader(mAbstractList)
126 };
127 
128 #define mAbstractListClassHeader(clsName, superCls) \
129  mScrollWidgetClassHeader(clsName, superCls) \
130  int (*addNode)(clsName*, mNode *node); \
131  int (*insertNode)(clsName*, mNode *node, mNode *prev,mNode *next, int index);\
132  int (*removeNode)(clsName*, mNode *node); \
133  mNode* (*getNode)(clsName*, int index); \
134  int (*indexOf)(clsName*, mNode *node); \
135  BOOL (*isFrozen)(clsName*); \
136  BOOL (*showNode)(clsName*, mNode *node); \
137  void (*refreshNode)(clsName*, mNode *node, const RECT *rcInv); \
138  mNode* (*findNode)(clsName*, DWORD info, int type, BOOL recursion, int startIndex); \
139  \
140  BOOL (*setCurSel)(clsName*, int index); \
141  mNode* (*getCurSel)(clsName*); \
142  BOOL (*selectNode)(clsName*, mNode *node, BOOL select); \
143  \
144  int (*getRect)(clsName*, mNode *node, RECT *rcNode, BOOL bConv); \
145  void (*freeze)(clsName*, BOOL locked); \
146  void (*sortNodes)(clsName*, NCS_CB_CMPNODE func, mNode *parentNode);\
147  void (*notifyEvent)(clsName*, int eventId, DWORD eventInfo);
148 
225 struct _mAbstractListClass
226 {
227  mAbstractListClassHeader(mAbstractList, mScrollWidget)
228 };
229 
230 #define mAbstractListRendererHeader(clsName, parentClass) \
231  mScrollWidgetRendererHeader(clsName, parentClass)
232 
238 struct _mAbstractListRenderer {
239  mAbstractListRendererHeader(mAbstractList, mScrollWidget)
240 };
241 
247 {
252 };
253 
259 {
264 
269 
274 
279 
284 
289 
290  NCSP_ASTLST_TEXTINDENT,
291 
292  NCSP_ASTLST_IMAGEINDENT,
297 };
298 
305 MGNCS_EXPORT extern mAbstractListClass g_stmAbstractListCls;
306 
308 #ifdef __cplusplus
309 }
310 #endif /* __cplusplus */
311 
312 #endif /* _MGUI_NCSCTRL_ASTLST_H */
313 
NCSP_ASTLST_CMPNODEFUNC
@ NCSP_ASTLST_CMPNODEFUNC
Definition: mabstractlist.h:283
NCSP_ASTLST_MAX
@ NCSP_ASTLST_MAX
Definition: mabstractlist.h:296
NCSP_ASTLST_AUTOSORT
@ NCSP_ASTLST_AUTOSORT
Definition: mabstractlist.h:273
NCSN_ASTLST_MAX
@ NCSN_ASTLST_MAX
Definition: mabstractlist.h:251
mAbstractListClass
The virtual function table of mAbstractList, which derived from mScrollWidgetClass.
NCSP_ASTLST_ROOTNODE
@ NCSP_ASTLST_ROOTNODE
Definition: mabstractlist.h:288
mAbstractList_getControl
mAbstractList * mAbstractList_getControl(mNode *node)
Get the associated control handle of the specified node.
mScrollWidget
The structure of mScrollWidget control, which derived from mWidget. It is the abstract superclass of ...
NCSN_SWGT_MAX
@ NCSN_SWGT_MAX
Definition: mscroll_widget.h:339
mNode
The structure of mNode. It is the basic class of all nodes occur within specific controls....
mAbstractListNotify
mAbstractListNotify
The notification id of mAbstractList.
Definition: mabstractlist.h:246
NCSP_ASTLST_DEFNODEHEIGHT
@ NCSP_ASTLST_DEFNODEHEIGHT
Definition: mabstractlist.h:263
NCSP_ASTLST_TRANSPARENT
@ NCSP_ASTLST_TRANSPARENT
Definition: mabstractlist.h:278
mAbstractListProperty
mAbstractListProperty
The properties id of mAbstractList.
Definition: mabstractlist.h:258
mAbstractList
The structure of mAbstractList, which derived from mScrollWidget. It is the abstract superclass of al...
NCSP_ASTLST_FONTSIZE
@ NCSP_ASTLST_FONTSIZE
Definition: mabstractlist.h:268
g_stmAbstractListCls
MGNCS_EXPORT mAbstractListClass g_stmAbstractListCls
The instance of mAbstractListClass.
mAbstractListRenderer
The structure of mAbstractList renderer, which inheried from mScrollWidgetRenderer.
NCSP_SWGT_MAX
@ NCSP_SWGT_MAX
Definition: mscroll_widget.h:322
_c
#define _c(ths)
the marco get the class of a object
Definition: mobject.h:72