mlistview.h

Go to the documentation of this file.
00001 
00025 #ifdef _MGNCSCTRL_LISTVIEW
00026 
00027 #ifndef _MGUI_CTRL_LISTV_H
00028 #define _MGUI_CTRL_LISTV_H
00029 
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif  /* __cplusplus */
00034 
00040 typedef struct _mListView mListView;
00041 typedef struct _mListViewClass mListViewClass;
00042 typedef struct _mListViewRenderer mListViewRenderer;
00043 
00048 typedef enum
00049 {
00051     NCSID_LISTV_IR_PARENT,
00053     NCSID_LISTV_IR_FIRSTCHILD,
00055     NCSID_LISTV_IR_LASTCHILD,
00057     NCSID_LISTV_IR_NEXTSIBLING,
00059     NCSID_LISTV_IR_PREVSIBLING,
00060 }ncsListVIRType;
00061 
00066 #define NCSF_LSTHDR_LEFTALIGN       (0x00<<NCSF_LSTCLM_SHIFT)
00067 
00072 #define NCSF_LSTHDR_TOPALIGN        (0x00<<NCSF_LSTCLM_SHIFT)
00073 
00078 #define NCSF_LSTHDR_RIGHTALIGN      (0x01<<NCSF_LSTCLM_SHIFT)
00079 
00084 #define NCSF_LSTHDR_CENTERALIGN     (0x02<<NCSF_LSTCLM_SHIFT)
00085 
00090 #define NCSF_LSTHDR_BOTTOMALIGN     (0x04<<NCSF_LSTCLM_SHIFT)
00091 
00096 #define NCSF_LSTHDR_VCENTERALIGN    (0x08<<NCSF_LSTCLM_SHIFT)
00097 
00102 #define NCSF_LSTHDR_VALIGNMASK      (0x0C<<NCSF_LSTCLM_SHIFT)
00103 
00108 #define NCSF_LSTHDR_SHIFT           (NCSF_LSTCLM_SHIFT+4)
00109 
00114 typedef enum
00115 {
00117     NCSID_LISTV_FT_ADDDATA,
00119     NCSID_LISTV_FT_TEXT,
00120 }ncsListVFindType;
00121 
00125 typedef struct _NCS_LISTV_FINDINFO
00126 {
00128     ncsListVFindType type;
00129 
00131     HITEM   parent;
00132 
00134     int     startIdx;
00135 
00137     union {
00139         struct {
00140             /* The number of searching column. */
00141             int     size;
00142             /* The text of searching column */
00143             char    **text;
00144         }string;
00146         DWORD   addData;
00147     }data;
00148 }NCS_LISTV_FINDINFO;
00149 
00153 typedef struct _NCS_LISTV_CLMINFO
00154 {
00156     int     index;
00158     int     width;
00160     char    *text;
00162     DWORD   image;
00177     DWORD   flags;
00178     NCS_CB_LISTV_CMPCLM pfnCmp;
00179 
00180     /*
00181      * \sa ncsLstClmSortType
00182      */
00183     ncsLstClmSortType sort;
00184 } NCS_LISTV_CLMINFO;
00185 
00189 typedef struct _NCS_LISTV_ITEMDATA
00190 {
00192     int     row;
00194     int     col;
00196     char*   text;
00198     int     textColor;
00199 
00206     DWORD   flags;
00208     DWORD   image;
00209 }NCS_LISTV_ITEMDATA;
00210 
00214 typedef struct _NCS_LISTV_ITEMINFO
00215 {
00217     int     index;
00219     int     retPos;
00221     HITEM   parent;
00223     int     height;
00230     int     flags;
00232     HICON   foldIcon;
00234     HICON   unfoldIcon;
00236     int     dataSize;
00238     NCS_LISTV_ITEMDATA *data;
00240         DWORD   addData;
00241 }NCS_LISTV_ITEMINFO;
00242 
00244 typedef void (*NCS_CB_LISTV_DRAWHDRBK)(mListView *self, HITEM hHdr, HDC hdc, RECT *rcDraw);
00246 typedef void (*NCS_CB_LISTV_DRAWHDR)(mListView *self, HITEM hHdr, HDC hdc, RECT *rcDraw);
00247 
00248 typedef void (*NCS_CB_DRAWITEMBK)(mListView *self, HITEM hItem, HDC hdc, RECT *rcDraw);
00250 typedef struct _NCS_CB_LISTV_CSTMHDROPS
00251 {
00253     NCS_CB_LISTV_DRAWHDRBK pfnDrawHdrBk;
00255     NCS_CB_LISTV_DRAWHDR   pfnDrawHdrItem;
00256 } NCS_CB_LISTV_CSTMHDROPS;
00257 
00258 
00259 #define NCSSPEC_LISTV_HDR   MAX_USER_SPECIAL_KEY + 2000
00260 
00261 typedef struct _NCS_LISTV_CLMRD{
00262         const char* text;
00263         const char* image_file;
00264         DWORD       width;
00265         DWORD       flags;
00266 }NCS_LISTV_CLMRD;
00267 
00268 MGNCS_EXPORT extern const unsigned char gListVColumnRecordTypes[];
00269 
00274 #define NCSCTRL_LISTVIEW NCSCLASSNAME("listview")
00275 
00280 #define NCSS_LISTV_NOTIFY    NCSS_NOTIFY
00281 
00286 #define NCSS_LISTV_LOOP      NCSS_ITEMV_LOOP
00287 
00291 #define NCSS_LISTV_MULTIPLE     NCSS_ITEMV_MULTIPLE
00292 
00297 #define NCSS_LISTV_SINGLE     NCSS_ITEMV_SINGLE
00298 
00303 #define NCSS_LISTV_CHECKBOX  (0x0001<<NCSS_ITEMV_SHIFT)
00304 
00310 #define NCSS_LISTV_AUTOCHECK (0x0002<<NCSS_ITEMV_SHIFT)
00311 
00316 #define NCSS_LISTV_AUTOCHECKBOX \
00317     (NCSS_LISTV_CHECKBOX | NCSS_LISTV_AUTOCHECK)
00318 
00323 #define NCSS_LISTV_TREE      (0x0004<<NCSS_ITEMV_SHIFT)
00324 
00329 #define NCSS_LISTV_WITHICON  (0x0008<<NCSS_ITEMV_SHIFT)
00330 
00335 #define NCSS_LISTV_SORT      (0x0010<<NCSS_ITEMV_SHIFT)
00336 
00341 #define NCSS_LISTV_NOHDRDRAG (0x0020<<NCSS_ITEMV_SHIFT)
00342 
00347 #define NCSS_LISTV_SHIFT     (NCSS_ITEMV_SHIFT + 6)
00348 
00349 #define mListViewHeader(className)  \
00350     mItemViewHeader(className)      \
00351     NCS_CB_LISTV_DRAWHDRBK  drawHdrBk;  \
00352     NCS_CB_LISTV_DRAWHDR    drawHdrItem;\
00353     NCS_CB_DRAWITEMBK   drawItemBk; \
00354     NCS_CB_DRAWITEM     drawSubItem;\
00355     mItemManager *hdrList;          \
00356     mListItem *rootItem;            \
00357     ncsLstClmSortType sort;         \
00358     int curCol;                     \
00359     int gridLineWidth;              \
00360     int gridLineColor;              \
00361     NCS_CB_LISTV_CMPCLM pfnSort;    \
00362     int hdrH;                       \
00363     int hdrW;                       \
00364     int dragedHead;                 \
00365     int dragX;                      \
00366     mListColumn *clickedHead;       \
00367     DWORD status;
00368 
00403 struct _mListView
00404 {
00405         mListViewHeader(mListView)
00406 };
00407 
00408 #define mListViewClassHeader(clsName, parentClass)  \
00409     mItemViewClassHeader(clsName, parentClass)      \
00410     NCS_CB_DRAWITEMBK (*setItemBkDraw)(clsName*, NCS_CB_DRAWITEMBK func);\
00411     NCS_CB_DRAWITEM (*setSubItemDraw)(clsName*, NCS_CB_DRAWITEM func);  \
00412     HITEM (*getRelatedItem)(clsName*,HITEM hItem,ncsListVIRType type);  \
00413     void (*setBackground)(clsName*,int row,int col,int *color);         \
00414     void (*setForeground)(clsName*,int row,int col,int *color);         \
00415     int (*getBackground)(clsName*,int row,int col,int *color);          \
00416     int (*getForeground)(clsName*,int row,int col,int *color);          \
00417     void (*sort)(clsName*, NCS_CB_LISTV_CMPCLM func, int col, ncsLstClmSortType sort);\
00418     void (*setCustomDrawHeader)(clsName*, NCS_CB_LISTV_CSTMHDROPS *func);\
00419     BOOL (*setItemInfo)(clsName*, NCS_LISTV_ITEMDATA *info);            \
00420     BOOL (*getItemInfo)(clsName*, NCS_LISTV_ITEMDATA *info);            \
00421     const char* (*getItemText)(clsName*, int row, int col);             \
00422     int (*getItemTextLen)(clsName*, int row, int col);                  \
00423         BOOL (*setItemText)(clsName*, int row, int col, const char* str);   \
00424     void (*setSortDirection)(clsName*, ncsLstClmSortType direction);    \
00425     ncsLstClmSortType (*getSortDirection)(clsName*);                    \
00426     HITEM (*findItem)(clsName*, NCS_LISTV_FINDINFO *info);              \
00427     mListColumn* (*getColumn)(clsName*, int index);                     \
00428     int (*getColumnIndex)(clsName*, mListColumn *column);               \
00429     int (*getColumnWidth)(clsName*, int index);                         \
00430     void (*setColumnWidth)(clsName*, int index, int width);             \
00431     int (*getColumnCount)(clsName*);                                    \
00432     mListColumn* (*getSortColumn)(clsName*);                            \
00433     void (*setSortColumn)(clsName*, mListColumn* column);               \
00434     void (*showColumn)(clsName*, mListColumn *column);                  \
00435     BOOL (*delColumn)(clsName*, int index);                             \
00436     BOOL (*addColumn)(clsName*, NCS_LISTV_CLMINFO *info);               \
00437     HITEM (*addItem)(clsName*, NCS_LISTV_ITEMINFO *info);               \
00438     BOOL (*setHeadText)(clsName*, int col, const char* text);           \
00439     HITEM (*getChildItem)(clsName*, HITEM parent,int index);            \
00440     int (*getChildCount)(clsName*, HITEM hItem);                        \
00441     int (*foldItem)(clsName*, HITEM hItem, BOOL fold);
00442 
00443 
00583 struct _mListViewClass
00584 {
00585         mListViewClassHeader(mListView, mItemView)
00586 };
00587 
00588 #define mListViewRendererHeader(clsName, parentClass)               \
00589         mItemViewRendererHeader(clsName, parentClass)                   \
00590     void (*drawHeader) (clsName *self, HDC hdc, const RECT* pRect,  \
00591             DWORD color, int flag);                                 \
00592     void (*drawFold) (clsName *self, HDC hdc, const RECT* pRect,    \
00593             DWORD color, HICON icon, int status, int next);
00594 
00608 struct  _mListViewRenderer {
00609         mListViewRendererHeader(mListView, mItemView)
00610 };
00611 
00616 enum mListViewProp
00617 {
00619     NCSP_LISTV_DEFITEMHEIGHT = NCSP_ITEMV_DEFITEMHEIGHT,
00621     NCSP_LISTV_ROWCOUNT = NCSP_ITEMV_ITEMCOUNT,
00623     NCSP_LISTV_HDRHEIGHT = NCSP_ITEMV_MAX + 1,
00625     NCSP_LISTV_HDRWIDTH,
00627     NCSP_LISTV_HDRVISIBLE,
00629     NCSP_LISTV_SORTCOLUMN,
00631     NCSP_LISTV_GRIDLINEWIDTH,
00633     NCSP_LISTV_GRIDLINECOLOR,
00635     NCSP_LISTV_COLCOUNT,
00637         NCSP_LISTV_MAX,
00638 };
00639 
00644 enum mListViewNotify
00645 {
00647     NCSN_LISTV_CLICKED = NCSN_ITEMV_CLICKED,
00649     NCSN_LISTV_SELCHANGED = NCSN_ITEMV_SELCHANGED,
00651     NCSN_LISTV_ITEMRDOWN = NCSN_ITEMV_MAX + 1,
00653     NCSN_LISTV_ITEMRUP,
00655     NCSN_LISTV_HDRRDOWN,
00657     NCSN_LISTV_HDRRUP,
00659     NCSN_LISTV_ITEMDBCLK,
00661     NCSN_LISTV_FOLDITEM,
00663     NCSN_LISTV_UNFOLDITEM,
00665         NCSN_LISTV_MAX
00666 };
00667 
00674 MGNCS_EXPORT extern mListViewClass g_stmListViewCls;
00677 #ifdef __cplusplus
00678 }
00679 #endif  /* __cplusplus */
00680 
00681 #endif /* _MGUI_CTRL_LISTV_H */
00682 #endif //_MGNCSCTRL_LISTVIEW
Generated on Fri Jun 10 11:18:06 2011 for New Control Set V1.0.0 API Reference by  doxygen 1.6.3