mgridboxpiece.h
00001
00002 #ifndef _MGUI_NCSCTRL_GRIDBOXPIECE_H
00003 #define _MGUI_NCSCTRL_GRIDBOXPIECE_H
00004
00005 #ifdef __cplusplus
00006 extern "C" {
00007 #endif
00008
00009 typedef struct _mGridBoxPieceClass mGridBoxPieceClass;
00010 typedef struct _mGridBoxPiece mGridBoxPiece;
00011
00012 #define CELL_POINT_ISNULL(cp) ((cp).row == 0xFFFF || (cp).col == 0xFFFF)
00013 #define NULL_CELL_POINT { 0xFFFF, 0xFFFF}
00014 typedef struct _CELL_POINT{
00015 unsigned short row;
00016 unsigned short col;
00017 }CELL_POINT;
00018
00019 #define mGridBoxPieceClassHeader(clss, superCls) \
00020 mRenderablePieceClassHeader(clss, superCls) \
00021 CELL_POINT (* hitCell)(clss *, int x, int y); \
00022 RECT * (*getCellRect)(clss *, int row, int col, RECT *prc); \
00023 void (*updateNewCell)(clss *, CELL_POINT old_cell, CELL_POINT new_cell, int old_mask, int new_mask, mWidget *owner);
00024
00025 struct _mGridBoxPieceClass
00026 {
00027 mGridBoxPieceClassHeader(mGridBoxPiece, mRenderablePiece)
00028 };
00029
00030 MGNCS_EXPORT extern mGridBoxPieceClass g_stmGridBoxPieceCls;
00031
00032 #define mGridBoxPieceHeader(clss) \
00033 mRenderablePieceHeader(clss) \
00034 unsigned short rows; \
00035 unsigned short cols;
00036
00037 struct _mGridBoxPiece
00038 {
00039 mGridBoxPieceHeader(mGridBoxPiece)
00040 };
00041
00042
00043 #define NCS_GRIDBOXPIECE_PAINT_MASK_DRAWSEL 0x01
00044 #define NCS_GRIDBOXPIECE_PAINT_MASK_HOT 0x02
00045 #define NCS_GRIDBOXPIECE_PAINT_MASK_REDRAW 0x04
00046 #define NCS_GRIDBOXPIECE_PAINT_MASK_ALL_CELLS 0x10
00047 typedef struct mGridBoxPiecePaintData{
00048 DWORD mask;
00049 CELL_POINT hot_cell;
00050 CELL_POINT sel_cell;
00051 DWORD add_data;
00052 }mGridBoxPiecePaintData;
00053
00054 enum mGridBoxPieceProps{
00055 NCSP_GRIDBOXPIECE_ROWS = GRIDBOXPIECE_PROP_BEGIN,
00056 NCSP_GRIDBOXPIECE_COLS
00057 };
00058
00059 #define mGridBoxPiece_makeCell(col, row) (DWORD)(((col)&0xFF)|(((row)&0xFF)<<8))
00060 #define mGridBoxPiece_getRow(cell) (((cell)&0xFF00)>>8)
00061 #define mGridBoxPiece_getCol(cell) ((cell)&0xFF)
00062
00063
00064 #ifdef __cplusplus
00065 }
00066 #endif
00067
00068 #endif
00069