44 #ifndef _MGUI_NCSCTRL_PAIRPIECE_H
45 #define _MGUI_NCSCTRL_PAIRPIECE_H
51 typedef struct _mPairPieceClass mPairPieceClass;
52 typedef struct _mPairPiece mPairPiece;
54 #define mPairPieceClassHeader(clss, superCls) \
55 mLayoutPieceClassHeader(clss, superCls)
57 struct _mPairPieceClass
59 mPairPieceClassHeader(mPairPiece, mLayoutPiece)
62 MGNCS_EXPORT
extern mPairPieceClass g_stmPairPieceCls;
64 #define mPairPieceHeader(clss) \
65 mLayoutPieceHeader(clss) \
72 mPairPieceHeader(mPairPiece)
75 #define NCS_PAIRPIECE_DIRECTION_MASK 0x80000000
76 #define NCS_PAIRPIECE_FIRST_MASK 0x40000000
77 #define NCS_PAIRPIECE_SIZE_TYPE_MASK 0x30000000
78 #define NCS_PAIRPIECE_SIZE_MASK 0x00000FFF
79 #define NCS_PAIRPIECE_SPACE_MASK 0x0FF00000
80 #define NCS_PAIRPIECE_MARGIN_MASK 0x000FF000
82 #define mPairPiece_setVert(self) ((self)->flags |= NCS_PAIRPIECE_DIRECTION_MASK)
83 #define mPairPiece_setHorz(self) ((self)->flags &= ~NCS_PAIRPIECE_DIRECTION_MASK)
84 #define mPairPiece_isVert(self) ((self)->flags & NCS_PAIRPIECE_DIRECTION_MASK)
86 #define mPairPiece_setReverse(self) ((self)->flags |= NCS_PAIRPIECE_FIRST_MASK)
87 #define mPairPiece_cancelReverse(self) ((self)->flags &= ~NCS_PAIRPIECE_FIRST_MASK)
88 #define mPairPiece_reversed(self) ((self)->flags & NCS_PAIRPIECE_FIRST_MASK)
90 #define mPairPiece_getFirst(self) ((self)->first)
92 #define mPairPiece_getSecond(self) ((self)->second)
93 #define mPairPiece_setFirst(self, piece) do{ \
94 if(((self)->flags&NCS_PAIRPIECE_FIRST_MASK)) \
95 (self)->second=(piece); \
97 (self)->first=(piece); \
100 #define mPairPiece_setSecond(self, piece) do{ \
101 if(((self)->flags&NCS_PAIRPIECE_FIRST_MASK)) \
102 (self)->first=(piece); \
104 (self)->second=(piece); \
109 enum mPairPieceSizeType{
110 NCS_PAIRPIECE_ST_FIXED = NCS_LAYOUTPIECE_ST_FIXED,
111 NCS_PAIRPIECE_ST_PERCENT = NCS_LAYOUTPIECE_ST_PERCENT,
112 NCS_PAIRPIECE_ST_AUTO = NCS_LAYOUTPIECE_ST_AUTO
115 #define SET_BIT_VALUE(dword, value, mask,offset) ((dword) = ((dword)& (~(mask))) | (((value)<<(offset))&mask))
116 #define GET_BIT_VALUE(dword, mask, offset) (((dword)&(mask))>>(offset))
118 #define mPairPiece_setFirstSizeType(self, type) SET_BIT_VALUE(self->flags, type, NCS_PAIRPIECE_SIZE_TYPE_MASK,28)
119 #define mPairPiece_getFirstSizeType(self) GET_BIT_VALUE(self->flags, NCS_PAIRPIECE_SIZE_TYPE_MASK, 28)
120 #define mPairPiece_setFirstSize(self, size) (self->flags = (self->flags&(~NCS_PAIRPIECE_SIZE_MASK))|((size)&NCS_PAIRPIECE_SIZE_MASK))
121 #define mPairPiece_getFirstSize(self) (int)(self->flags&NCS_PAIRPIECE_SIZE_MASK)
123 #define mPairPiece_setSpace(self, space) SET_BIT_VALUE(self->flags, space, NCS_PAIRPIECE_SPACE_MASK, 20)
124 #define mPairPiece_getSpace(self) (int)GET_BIT_VALUE(self->flags, NCS_PAIRPIECE_SPACE_MASK, 20)
126 #define mPairPiece_setMargin(self, margin) SET_BIT_VALUE(self->flags, margin, NCS_PAIRPIECE_MARGIN_MASK, 12)
127 #define mPairPiece_getMargin(self) (int)GET_BIT_VALUE(self->flags, NCS_PAIRPIECE_MARGIN_MASK, 12)
129 enum mPairPieceProps{
130 NCSP_PAIRPIECE_SECOND_AS_FIRST = PAIRPIECE_PROP_BEGIN,
131 NCSP_PAIRPIECE_FIRST_SIZE_TYPE,
132 NCSP_PAIRPIECE_FIRST_SIZE,
133 NCSP_PAIRPIECE_FIRST,
134 NCSP_PAIRPIECE_SECOND,
135 NCSP_PAIRPIECE_DIRECTION = PIECECOMM_PROP_DIRECTION,
136 NCSP_PAIRPIECE_SPACE = PIECECOMM_PROP_SPACE,
137 NCSP_PAIRPIECE_MARGIN = PIECECOMM_PROP_MARGIN