mGNCS API Reference  v1.2.5
A new control set and a new framework for MiniGUI apps
mitemview.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_CTRL_ITEMVIEW_H
55 #define _MGUI_CTRL_ITEMVIEW_H
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif /* __cplusplus */
60 
71 #define NCSCTRL_ITEMVIEW NCSCLASSNAME("itemview")
72 
73 typedef struct _mItemView mItemView;
74 typedef struct _mItemViewClass mItemViewClass;
75 typedef struct _mItemViewRenderer mItemViewRenderer;
76 
81 typedef int (*NCS_CB_INITITEM)(mItemView *self, HITEM hItem);
82 
87 typedef void (*NCS_CB_DSTRITEM)(mItemView *self, HITEM hItem);
88 
93 typedef void (*NCS_CB_DRAWITEM)(mItemView *self, HITEM hItem, HDC hdc, RECT *rcDraw);
94 
99 typedef struct _NCS_CB_ITEMOPS
100 {
104  NCS_CB_INITITEM initItem;
108  NCS_CB_DSTRITEM destroyItem;
112  NCS_CB_DRAWITEM drawItem;
114 
119 #define NCSS_ITEMV_AUTOSORT (0x0002<<NCSS_SWGT_SHIFT)
120 
125 #define NCSS_ITEMV_LOOP (0x0004<<NCSS_SWGT_SHIFT)
126 
131 #define NCSS_ITEMV_SINGLE (0x0000<<NCSS_SWGT_SHIFT)
132 
137 #define NCSS_ITEMV_MULTIPLE (0x0008<<NCSS_SWGT_SHIFT)
138 
143 #define NCSS_ITEMV_SHIFT (NCSS_SWGT_SHIFT+4)
144 
145 #define pItemList (self->itemList)
146 
147 #define mItemViewHeader(className) \
148  mScrollWidgetHeader(className) \
149  NCS_CB_ITEMOPS itemOps; \
150  mItemManager *itemList; \
151  int defItemHeight;
152 
168 struct _mItemView
169 {
170  mItemViewHeader(mItemView)
171 };
172 
173 #define mItemViewClassHeader(clsName, parentClass) \
174  mScrollWidgetClassHeader(clsName, parentClass) \
175  int (*onRButtonDown)(clsName*, int x, int y, DWORD keyFlags); \
176  int (*onRButtonUp)(clsName*, int x, int y, DWORD keyFlags); \
177  int (*onLButtonDBClk)(clsName*, int x, int y, DWORD keyFlags); \
178  NCS_CB_DRAWITEM (*setItemDraw)(clsName*, NCS_CB_DRAWITEM func); \
179  NCS_CB_INITITEM (*setItemInit)(clsName*, NCS_CB_INITITEM func); \
180  NCS_CB_DSTRITEM (*setItemDestroy)(clsName*, \
181  NCS_CB_DSTRITEM func); \
182  \
183  NCS_CB_CMPITEM (*setItemCmpFunc)(clsName*, NCS_CB_CMPITEM func); \
184  HWND (*createItem)(clsName*, HITEM prev, HITEM next, int index, \
185  int height, const char* text, DWORD addData, int *pos, BOOL adjust); \
186  int (*insertItem)(clsName*, HITEM hItem, HITEM prev, HITEM next, \
187  int index, int *pos); \
188  int (*removeItem)(clsName*, HITEM hItem); \
189  int (*inItem)(clsName*, int mouseX, int mouseY, HITEM *pRet, POINT *pt);\
190  NCS_CB_CMPSTR (*setStrCmpFunc)(clsName*, NCS_CB_CMPSTR func); \
191  NCS_CB_CMPSTR (*getStrCmpFunc)(clsName*); \
192  void (*setAutoSortItem)(clsName*, BOOL sort); \
193  int (*getTotalHeight)(clsName*); \
194  int (*adjustItemsHeight)(clsName*, int diff); \
195  void (*freeze)(clsName*, BOOL lock); \
196  BOOL (*isFrozen)(clsName*); \
197  list_t* (*getQueue)(clsName*); \
198  HITEM (*getListEntry)(clsName*, list_t* entry); \
199  HITEM (*getFirstItem)(clsName*); \
200  int (*isEmpty)(clsName*); \
201  void (*sortItems)(clsName*, NCS_CB_CMPITEM func); \
202  BOOL (*removeAll)(clsName*); \
203  int (*indexOf)(clsName*, HITEM hItem); \
204  int (*setItemHeight)(clsName*, HITEM hItem, int height); \
205  int (*getItemHeight)(clsName*, HITEM hItem); \
206  HITEM (*getNext)(clsName*, HITEM hItem); \
207  HITEM (*getPrev)(clsName*, HITEM hItem); \
208  HITEM (*getItem)(clsName*, int index); \
209  BOOL (*isSelected)(clsName*, HITEM hItem); \
210  BOOL (*isEnabled)(clsName*, HITEM hItem); \
211  BOOL (*enable)(clsName*, HITEM hItem, BOOL enable); \
212  void (*selectAll)(clsName*); \
213  void (*deselectAll)(clsName*); \
214  int (*hilight)(clsName*, HITEM hItem); \
215  HITEM (*getHilight)(clsName*); \
216  BOOL (*isHilight)(clsName*, HITEM hItem); \
217  int (*getItemCount)(clsName*); \
218  DWORD (*getAddData)(clsName*, HITEM hItem); \
219  void (*setAddData)(clsName*, HITEM hItem, DWORD addData); \
220  void (*setImage)(clsName*, HITEM hItem, DWORD image); \
221  DWORD (*getImage)(clsName*, HITEM hItem); \
222  void (*setFlags)(clsName*, HITEM hItem, DWORD flags); \
223  DWORD (*getFlags)(clsName*, HITEM hItem); \
224  BOOL (*setText)(clsName*, HITEM hItem, const char* text); \
225  const char* (*getText)(clsName*, HITEM hItem); \
226  int (*getTextLen)(clsName*, HITEM hItem); \
227  int (*getSelectionCount)(clsName*); \
228  BOOL (*getSelection)(clsName*, HITEM *pRet, int count); \
229  \
230  BOOL (*select)(clsName*, HITEM hItem); \
231  BOOL (*deselect)(clsName*, HITEM hItem); \
232  BOOL (*setTextByIdx)(clsName*, int index, const char* text); \
233  const char* (*getTextByIdx)(clsName*, int index); \
234  \
235  int (*getFirstVisItem)(clsName*); \
236  void (*resetContent)(clsName*); \
237  int (*getRect)(clsName*, HITEM hItem, RECT *rcItem, BOOL bConv); \
238  int (*getCurSel)(clsName*); \
239  int (*setCurSel)(clsName*, int newSel); \
240  void (*refreshItem)(clsName*, HITEM hItem, const RECT *rcInv); \
241  BOOL (*showItemByIdx)(clsName*, int index); \
242  BOOL (*showItem)(clsName*, HITEM hItem);
243 
531 struct _mItemViewClass
532 {
533  mItemViewClassHeader(mItemView, mScrollWidget)
534 };
535 
536 #define mItemViewRendererHeader(clsName, parentClass) \
537  mScrollWidgetRendererHeader(clsName, parentClass)
538 
544 struct _mItemViewRenderer {
545  mItemViewRendererHeader(mItemView, mScrollWidget)
546 };
547 
554 MGNCS_EXPORT extern mItemViewClass g_stmItemViewCls;
555 
561 {
566 
575 };
576 
586 
591 
596 
601 
606 
611 
616 };
617 
619 #ifdef __cplusplus
620 }
621 #endif /* __cplusplus */
622 
623 #endif /* _MGUI_CTRL_ITEMVIEW_H */
send by a widget is cliced by left button
Definition: mwidget.h:469
The structure of mItemView renderer, which inheried from mScrollWidgetRenderer.
The virtual function table of mItemView, which derived from mScrollWidgetClass.
The structure of mScrollWidget control, which derived from mWidget. It is the abstract superclass of ...
GHANDLE HITEM
The handle of item widget.
Definition: mitem.h:75
void(* NCS_CB_DRAWITEM)(mItemView *self, HITEM hItem, HDC hdc, RECT *rcDraw)
The callback of drawing item.
Definition: mitemview.h:93
The structure of NCS_CB_ITEMOPS. The Item operations interface.
mItemViewProp
The properties id of mItemView.
Definition: mitemview.h:560
mItemViewNotify
The notification code id of mItemView.
Definition: mitemview.h:581
The structure of mItemView control, which derived from mScrollWidget. It is the abstract superclass o...
MGNCS_EXPORT mItemViewClass g_stmItemViewCls
The instance of mItemViewClass.
void(* NCS_CB_DSTRITEM)(mItemView *self, HITEM hItem)
The callback of destroying item.
Definition: mitemview.h:87
int(* NCS_CB_INITITEM)(mItemView *self, HITEM hItem)
The callback of initializing item.
Definition: mitemview.h:81