mpairpiece.h

00001 
00002 #ifndef _MGUI_NCSCTRL_PAIRPIECE_H
00003 #define _MGUI_NCSCTRL_PAIRPIECE_H
00004 
00005 #ifdef __cplusplus
00006 extern "C" {
00007 #endif
00008 
00009 typedef struct _mPairPieceClass mPairPieceClass;
00010 typedef struct _mPairPiece mPairPiece;
00011 
00012 #define mPairPieceClassHeader(clss, superCls) \
00013         mLayoutPieceClassHeader(clss, superCls)
00014 
00015 struct _mPairPieceClass
00016 {
00017         mPairPieceClassHeader(mPairPiece, mLayoutPiece)
00018 };
00019 
00020 MGNCS_EXPORT extern mPairPieceClass g_stmPairPieceCls;
00021 
00022 #define mPairPieceHeader(clss) \
00023         mLayoutPieceHeader(clss)  \
00024         DWORD flags; \
00025         mHotPiece *first; \
00026         mHotPiece *second;
00027 
00028 struct _mPairPiece
00029 {
00030         mPairPieceHeader(mPairPiece)
00031 };
00032 
00033 #define NCS_PAIRPIECE_DIRECTION_MASK 0x80000000
00034 #define NCS_PAIRPIECE_FIRST_MASK     0x40000000
00035 #define NCS_PAIRPIECE_SIZE_TYPE_MASK 0x30000000
00036 #define NCS_PAIRPIECE_SIZE_MASK      0x00000FFF
00037 #define NCS_PAIRPIECE_SPACE_MASK     0x0FF00000
00038 #define NCS_PAIRPIECE_MARGIN_MASK    0x000FF000
00039 
00040 #define mPairPiece_setVert(self)   ((self)->flags |= NCS_PAIRPIECE_DIRECTION_MASK)
00041 #define mPairPiece_setHorz(self)   ((self)->flags &= ~NCS_PAIRPIECE_DIRECTION_MASK)
00042 #define mPairPiece_isVert(self)    ((self)->flags & NCS_PAIRPIECE_DIRECTION_MASK)
00043 
00044 #define mPairPiece_setReverse(self)      ((self)->flags |= NCS_PAIRPIECE_FIRST_MASK)
00045 #define mPairPiece_cancelReverse(self)   ((self)->flags &= ~NCS_PAIRPIECE_FIRST_MASK)
00046 #define mPairPiece_reversed(self)        ((self)->flags & NCS_PAIRPIECE_FIRST_MASK)
00047 //#define mPairPiece_getFirst(self)   (((self)->flags&NCS_PAIRPIECE_FIRST_MASK)?self->second:self->first)
00048 #define mPairPiece_getFirst(self)   ((self)->first)
00049 //#define mPairPiece_getSecond(self)   (((self)->flags&NCS_PAIRPIECE_FIRST_MASK)?self->first:self->second)
00050 #define mPairPiece_getSecond(self)  ((self)->second)
00051 #define mPairPiece_setFirst(self, piece)   do{ \
00052         if(((self)->flags&NCS_PAIRPIECE_FIRST_MASK)) \
00053                 (self)->second=(piece); \
00054         else \
00055                 (self)->first=(piece); \
00056 }while(0)
00057 
00058 #define mPairPiece_setSecond(self, piece)   do{ \
00059         if(((self)->flags&NCS_PAIRPIECE_FIRST_MASK)) \
00060                 (self)->first=(piece); \
00061         else \
00062                 (self)->second=(piece); \
00063 }while(0)
00064 
00065 
00066 
00067 enum mPairPieceSizeType{
00068         NCS_PAIRPIECE_ST_FIXED = NCS_LAYOUTPIECE_ST_FIXED,
00069         NCS_PAIRPIECE_ST_PERCENT = NCS_LAYOUTPIECE_ST_PERCENT,
00070         NCS_PAIRPIECE_ST_AUTO = NCS_LAYOUTPIECE_ST_AUTO
00071 };
00072 
00073 #define SET_BIT_VALUE(dword, value, mask,offset)  ((dword) = ((dword)& (~(mask))) | (((value)<<(offset))&mask))
00074 #define GET_BIT_VALUE(dword, mask, offset)   (((dword)&(mask))>>(offset))
00075 
00076 #define mPairPiece_setFirstSizeType(self, type)  SET_BIT_VALUE(self->flags, type, NCS_PAIRPIECE_SIZE_TYPE_MASK,28)
00077 #define mPairPiece_getFirstSizeType(self)        GET_BIT_VALUE(self->flags, NCS_PAIRPIECE_SIZE_TYPE_MASK, 28)
00078 #define mPairPiece_setFirstSize(self, size)      (self->flags = (self->flags&(~NCS_PAIRPIECE_SIZE_MASK))|((size)&NCS_PAIRPIECE_SIZE_MASK))
00079 #define mPairPiece_getFirstSize(self)            (int)(self->flags&NCS_PAIRPIECE_SIZE_MASK)
00080 
00081 #define mPairPiece_setSpace(self, space)         SET_BIT_VALUE(self->flags, space, NCS_PAIRPIECE_SPACE_MASK, 20)
00082 #define mPairPiece_getSpace(self)                (int)GET_BIT_VALUE(self->flags, NCS_PAIRPIECE_SPACE_MASK, 20)
00083 
00084 #define mPairPiece_setMargin(self, margin)       SET_BIT_VALUE(self->flags, margin, NCS_PAIRPIECE_MARGIN_MASK, 12)
00085 #define mPairPiece_getMargin(self)               (int)GET_BIT_VALUE(self->flags, NCS_PAIRPIECE_MARGIN_MASK, 12)
00086 
00087 enum mPairPieceProps{
00088         NCSP_PAIRPIECE_SECOND_AS_FIRST = PAIRPIECE_PROP_BEGIN,
00089         NCSP_PAIRPIECE_FIRST_SIZE_TYPE,
00090         NCSP_PAIRPIECE_FIRST_SIZE,
00091         NCSP_PAIRPIECE_FIRST,
00092         NCSP_PAIRPIECE_SECOND,
00093         NCSP_PAIRPIECE_DIRECTION = PIECECOMM_PROP_DIRECTION,
00094         NCSP_PAIRPIECE_SPACE     = PIECECOMM_PROP_SPACE,
00095         NCSP_PAIRPIECE_MARGIN    = PIECECOMM_PROP_MARGIN
00096 };
00097 
00098 #ifdef __cplusplus
00099 }
00100 #endif
00101 
00102 #endif
00103 
Generated on Fri Jun 10 11:18:06 2011 for New Control Set V1.0.0 API Reference by  doxygen 1.6.3