44 #ifndef _MGUI_NCSCTRL_ABSTRACTBUTTONPIECEPIECE_H
45 #define _MGUI_NCSCTRL_ABSTRACTBUTTONPIECEPIECE_H
51 typedef struct _mAbstractButtonPieceClass mAbstractButtonPieceClass;
52 typedef struct _mAbstractButtonPiece mAbstractButtonPiece;
54 #define mAbstractButtonPieceClassHeader(clss, superCls) \
55 mContainerPieceClassHeader(clss, superCls)
57 struct _mAbstractButtonPieceClass
59 mAbstractButtonPieceClassHeader(mAbstractButtonPiece, mContainerPiece)
62 MGNCS_EXPORT
extern mAbstractButtonPieceClass g_stmAbstractButtonPieceCls;
64 #define mAbstractButtonPieceHeader(clss) \
65 mContainerPieceHeader(clss) \
66 unsigned char flags; \
67 unsigned char state; \
68 unsigned char check_state; \
71 struct _mAbstractButtonPiece
73 mAbstractButtonPieceHeader(mAbstractButtonPiece)
76 enum mAbstractButtonPieceStates{
84 enum mAbstractButtonPieceCheckStates {
85 NCS_ABP_UNCHECKED = 0,
90 #define NCSS_ABP_CHECKABLE 0x01
91 #define NCSS_ABP_AUTOCHECK 0x02
92 #define NCSS_ABP_3DCHECK 0x04
93 #define NCSS_ABP_DISABLE 0x08
94 #define NCSS_ABP_FLAT 0x10 // show button's as flat
95 #define NCSS_ABP_NOREPEATMSG 0x20 // disbale the auto repeat message
98 #define mAbstractButtonPiece_isCheckable(self) \
99 IS_BIT_SET((self)->flags, NCSS_ABP_CHECKABLE)
100 #define mAbstractButtonPiece_setCheckable(self, bcheckable) \
101 ((bcheckable)?SET_BIT((self)->flags, NCSS_ABP_CHECKABLE):CLEAR_BIT((self)->flags, NCSS_ABP_CHECKABLE))
103 #define mAbstractButtonPiece_isAutoCheck(self) \
104 IS_BIT_SET((self)->flags, NCSS_ABP_AUTOCHECK)
105 #define mAbstractButtonPiece_setAutoCheck(self, bautocheck) \
106 ((bautocheck)?SET_BIT((self)->flags, NCSS_ABP_AUTOCHECK):CLEAR_BIT((self)->flags, NCSS_ABP_AUTOCHECK))
108 #define mAbstractButtonPiece_is3DCheck(self) \
109 IS_BIT_SET((self)->flags, NCSS_ABP_3DCHECK)
110 #define mAbstractButtonPiece_set3DCheck(self, b3dcheck) \
111 ((b3dcheck)?SET_BIT((self)->flags, NCSS_ABP_3DCHECK):CLEAR_BIT((self)->flags, NCSS_ABP_3DCHECK))
113 #define mAbstractButtonPiece_needRepeatMsg(self) \
114 !(IS_BIT_SET((self)->flags, NCSS_ABP_NOREPEATMSG))
115 #define mAbstractButtonPiece_setNoRepeatMsg(self, norepeat) \
116 ((norepeat)?SET_BIT((self)->flags, NCSS_ABP_NOREPEATMSG):CLEAR_BIT((self)->flags, NCSS_ABP_NOREPEATMSG))
118 #define mAbstractButtonPiece_isEnableFlag(self) \
119 (!IS_BIT_SET((self)->flags, NCSS_ABP_DISABLE))
121 #define mAbstractButtonPiece_setEnable(self, benable) \
122 ((benable)?CLEAR_BIT((self)->flags,NCSS_ABP_DISABLE):SET_BIT((self)->flags, NCSS_ABP_DISABLE))
124 enum mAbstractButtonPieceProps{
125 NCSP_ABP_CHECKABLE = ABP_PROP_BEGIN,
132 NCSP_ABP_NOREPEATMSG,
135 enum mAbstractButtonPieceEvent {
136 NCSN_ABP_CLICKED = ABP_EVENT_BEGIN,
137 NCSN_ABP_STATE_CHANGED,