mGNCS API Reference  v1.2.0
A new control set and a new framework for MiniGUI apps
mitemview.h
Go to the documentation of this file.
1 
42 #ifndef _MGUI_CTRL_ITEMVIEW_H
43 #define _MGUI_CTRL_ITEMVIEW_H
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif /* __cplusplus */
48 
59 #define NCSCTRL_ITEMVIEW NCSCLASSNAME("itemview")
60 
61 typedef struct _mItemView mItemView;
62 typedef struct _mItemViewClass mItemViewClass;
63 typedef struct _mItemViewRenderer mItemViewRenderer;
64 
69 typedef int (*NCS_CB_INITITEM)(mItemView *self, HITEM hItem);
70 
75 typedef void (*NCS_CB_DSTRITEM)(mItemView *self, HITEM hItem);
76 
81 typedef void (*NCS_CB_DRAWITEM)(mItemView *self, HITEM hItem, HDC hdc, RECT *rcDraw);
82 
87 typedef struct _NCS_CB_ITEMOPS
88 {
92  NCS_CB_INITITEM initItem;
96  NCS_CB_DSTRITEM destroyItem;
100  NCS_CB_DRAWITEM drawItem;
102 
107 #define NCSS_ITEMV_AUTOSORT (0x0002<<NCSS_SWGT_SHIFT)
108 
113 #define NCSS_ITEMV_LOOP (0x0004<<NCSS_SWGT_SHIFT)
114 
119 #define NCSS_ITEMV_SINGLE (0x0000<<NCSS_SWGT_SHIFT)
120 
125 #define NCSS_ITEMV_MULTIPLE (0x0008<<NCSS_SWGT_SHIFT)
126 
131 #define NCSS_ITEMV_SHIFT (NCSS_SWGT_SHIFT+4)
132 
133 #define pItemList (self->itemList)
134 
135 #define mItemViewHeader(className) \
136  mScrollWidgetHeader(className) \
137  NCS_CB_ITEMOPS itemOps; \
138  mItemManager *itemList; \
139  int defItemHeight;
140 
156 struct _mItemView
157 {
158  mItemViewHeader(mItemView)
159 };
160 
161 #define mItemViewClassHeader(clsName, parentClass) \
162  mScrollWidgetClassHeader(clsName, parentClass) \
163  int (*onRButtonDown)(clsName*, int x, int y, DWORD keyFlags); \
164  int (*onRButtonUp)(clsName*, int x, int y, DWORD keyFlags); \
165  int (*onLButtonDBClk)(clsName*, int x, int y, DWORD keyFlags); \
166  NCS_CB_DRAWITEM (*setItemDraw)(clsName*, NCS_CB_DRAWITEM func); \
167  NCS_CB_INITITEM (*setItemInit)(clsName*, NCS_CB_INITITEM func); \
168  NCS_CB_DSTRITEM (*setItemDestroy)(clsName*, \
169  NCS_CB_DSTRITEM func); \
170  \
171  NCS_CB_CMPITEM (*setItemCmpFunc)(clsName*, NCS_CB_CMPITEM func); \
172  HWND (*createItem)(clsName*, HITEM prev, HITEM next, int index, \
173  int height, const char* text, DWORD addData, int *pos, BOOL adjust); \
174  int (*insertItem)(clsName*, HITEM hItem, HITEM prev, HITEM next, \
175  int index, int *pos); \
176  int (*removeItem)(clsName*, HITEM hItem); \
177  int (*inItem)(clsName*, int mouseX, int mouseY, HITEM *pRet, POINT *pt);\
178  NCS_CB_CMPSTR (*setStrCmpFunc)(clsName*, NCS_CB_CMPSTR func); \
179  NCS_CB_CMPSTR (*getStrCmpFunc)(clsName*); \
180  void (*setAutoSortItem)(clsName*, BOOL sort); \
181  int (*getTotalHeight)(clsName*); \
182  int (*adjustItemsHeight)(clsName*, int diff); \
183  void (*freeze)(clsName*, BOOL lock); \
184  BOOL (*isFrozen)(clsName*); \
185  list_t* (*getQueue)(clsName*); \
186  HITEM (*getListEntry)(clsName*, list_t* entry); \
187  HITEM (*getFirstItem)(clsName*); \
188  int (*isEmpty)(clsName*); \
189  void (*sortItems)(clsName*, NCS_CB_CMPITEM func); \
190  BOOL (*removeAll)(clsName*); \
191  int (*indexOf)(clsName*, HITEM hItem); \
192  int (*setItemHeight)(clsName*, HITEM hItem, int height); \
193  int (*getItemHeight)(clsName*, HITEM hItem); \
194  HITEM (*getNext)(clsName*, HITEM hItem); \
195  HITEM (*getPrev)(clsName*, HITEM hItem); \
196  HITEM (*getItem)(clsName*, int index); \
197  BOOL (*isSelected)(clsName*, HITEM hItem); \
198  BOOL (*isEnabled)(clsName*, HITEM hItem); \
199  BOOL (*enable)(clsName*, HITEM hItem, BOOL enable); \
200  void (*selectAll)(clsName*); \
201  void (*deselectAll)(clsName*); \
202  int (*hilight)(clsName*, HITEM hItem); \
203  HITEM (*getHilight)(clsName*); \
204  BOOL (*isHilight)(clsName*, HITEM hItem); \
205  int (*getItemCount)(clsName*); \
206  DWORD (*getAddData)(clsName*, HITEM hItem); \
207  void (*setAddData)(clsName*, HITEM hItem, DWORD addData); \
208  void (*setImage)(clsName*, HITEM hItem, DWORD image); \
209  DWORD (*getImage)(clsName*, HITEM hItem); \
210  void (*setFlags)(clsName*, HITEM hItem, DWORD flags); \
211  DWORD (*getFlags)(clsName*, HITEM hItem); \
212  BOOL (*setText)(clsName*, HITEM hItem, const char* text); \
213  const char* (*getText)(clsName*, HITEM hItem); \
214  int (*getTextLen)(clsName*, HITEM hItem); \
215  int (*getSelectionCount)(clsName*); \
216  BOOL (*getSelection)(clsName*, HITEM *pRet, int count); \
217  \
218  BOOL (*select)(clsName*, HITEM hItem); \
219  BOOL (*deselect)(clsName*, HITEM hItem); \
220  BOOL (*setTextByIdx)(clsName*, int index, const char* text); \
221  const char* (*getTextByIdx)(clsName*, int index); \
222  \
223  int (*getFirstVisItem)(clsName*); \
224  void (*resetContent)(clsName*); \
225  int (*getRect)(clsName*, HITEM hItem, RECT *rcItem, BOOL bConv); \
226  int (*getCurSel)(clsName*); \
227  int (*setCurSel)(clsName*, int newSel); \
228  void (*refreshItem)(clsName*, HITEM hItem, const RECT *rcInv); \
229  BOOL (*showItemByIdx)(clsName*, int index); \
230  BOOL (*showItem)(clsName*, HITEM hItem);
231 
519 struct _mItemViewClass
520 {
521  mItemViewClassHeader(mItemView, mScrollWidget)
522 };
523 
524 #define mItemViewRendererHeader(clsName, parentClass) \
525  mScrollWidgetRendererHeader(clsName, parentClass)
526 
532 struct _mItemViewRenderer {
533  mItemViewRendererHeader(mItemView, mScrollWidget)
534 };
535 
542 MGNCS_EXPORT extern mItemViewClass g_stmItemViewCls;
543 
549 {
554 
563 };
564 
574 
579 
584 
589 
594 
599 
604 };
605 
607 #ifdef __cplusplus
608 }
609 #endif /* __cplusplus */
610 
611 #endif /* _MGUI_CTRL_ITEMVIEW_H */
send by a widget is cliced by left button
Definition: mwidget.h:457
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:63
void(* NCS_CB_DRAWITEM)(mItemView *self, HITEM hItem, HDC hdc, RECT *rcDraw)
The callback of drawing item.
Definition: mitemview.h:81
The structure of NCS_CB_ITEMOPS. The Item operations interface.
mItemViewProp
The properties id of mItemView.
Definition: mitemview.h:548
mItemViewNotify
The notification code id of mItemView.
Definition: mitemview.h:569
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:75
int(* NCS_CB_INITITEM)(mItemView *self, HITEM hItem)
The callback of initializing item.
Definition: mitemview.h:69