mabstractbuttonpiece.h
00001
00002 #ifndef _MGUI_NCSCTRL_ABSTRACTBUTTONPIECEPIECE_H
00003 #define _MGUI_NCSCTRL_ABSTRACTBUTTONPIECEPIECE_H
00004
00005 #ifdef __cplusplus
00006 extern "C" {
00007 #endif
00008
00009 typedef struct _mAbstractButtonPieceClass mAbstractButtonPieceClass;
00010 typedef struct _mAbstractButtonPiece mAbstractButtonPiece;
00011
00012 #define mAbstractButtonPieceClassHeader(clss, superCls) \
00013 mContainerPieceClassHeader(clss, superCls)
00014
00015 struct _mAbstractButtonPieceClass
00016 {
00017 mAbstractButtonPieceClassHeader(mAbstractButtonPiece, mContainerPiece)
00018 };
00019
00020 MGNCS_EXPORT extern mAbstractButtonPieceClass g_stmAbstractButtonPieceCls;
00021
00022 #define mAbstractButtonPieceHeader(clss) \
00023 mContainerPieceHeader(clss) \
00024 unsigned char flags; \
00025 unsigned char state; \
00026 unsigned char check_state; \
00027 unsigned char revert;
00028
00029 struct _mAbstractButtonPiece
00030 {
00031 mAbstractButtonPieceHeader(mAbstractButtonPiece)
00032 };
00033
00034 enum mAbstractButtonPieceStates{
00035 NCS_ABP_NORMAL = 0,
00036 NCS_ABP_HILIGHT,
00037 NCS_ABP_PUSHED,
00038 NCS_ABP_CAPTURED,
00039 NCS_ABP_DISABLED
00040 };
00041
00042 enum mAbstractButtonPieceCheckStates {
00043 NCS_ABP_UNCHECKED = 0,
00044 NCS_ABP_HALFCHECKED ,
00045 NCS_ABP_CHECKED
00046 };
00047
00048 #define NCSS_ABP_CHECKABLE 0x01
00049 #define NCSS_ABP_AUTOCHECK 0x02
00050 #define NCSS_ABP_3DCHECK 0x04
00051 #define NCSS_ABP_DISABLE 0x08
00052 #define NCSS_ABP_FLAT 0x10 // show button's as flat
00053 #define NCSS_ABP_NOREPEATMSG 0x20 // disbale the auto repeat message
00054
00055
00056 #define mAbstractButtonPiece_isCheckable(self) \
00057 IS_BIT_SET((self)->flags, NCSS_ABP_CHECKABLE)
00058 #define mAbstractButtonPiece_setCheckable(self, bcheckable) \
00059 ((bcheckable)?SET_BIT((self)->flags, NCSS_ABP_CHECKABLE):CLEAR_BIT((self)->flags, NCSS_ABP_CHECKABLE))
00060
00061 #define mAbstractButtonPiece_isAutoCheck(self) \
00062 IS_BIT_SET((self)->flags, NCSS_ABP_AUTOCHECK)
00063 #define mAbstractButtonPiece_setAutoCheck(self, bautocheck) \
00064 ((bautocheck)?SET_BIT((self)->flags, NCSS_ABP_AUTOCHECK):CLEAR_BIT((self)->flags, NCSS_ABP_AUTOCHECK))
00065
00066 #define mAbstractButtonPiece_is3DCheck(self) \
00067 IS_BIT_SET((self)->flags, NCSS_ABP_3DCHECK)
00068 #define mAbstractButtonPiece_set3DCheck(self, b3dcheck) \
00069 ((b3dcheck)?SET_BIT((self)->flags, NCSS_ABP_3DCHECK):CLEAR_BIT((self)->flags, NCSS_ABP_3DCHECK))
00070
00071 #define mAbstractButtonPiece_needRepeatMsg(self) \
00072 !(IS_BIT_SET((self)->flags, NCSS_ABP_NOREPEATMSG))
00073 #define mAbstractButtonPiece_setNoRepeatMsg(self, norepeat) \
00074 ((norepeat)?SET_BIT((self)->flags, NCSS_ABP_NOREPEATMSG):CLEAR_BIT((self)->flags, NCSS_ABP_NOREPEATMSG))
00075
00076 #define mAbstractButtonPiece_isEnableFlag(self) \
00077 (!IS_BIT_SET((self)->flags, NCSS_ABP_DISABLE))
00078
00079 #define mAbstractButtonPiece_setEnable(self, benable) \
00080 ((benable)?CLEAR_BIT((self)->flags,NCSS_ABP_DISABLE):SET_BIT((self)->flags, NCSS_ABP_DISABLE))
00081
00082 enum mAbstractButtonPieceProps{
00083 NCSP_ABP_CHECKABLE = ABP_PROP_BEGIN,
00084 NCSP_ABP_AUTOCHECK,
00085 NCSP_ABP_3DCHECK,
00086 NCSP_ABP_CHECKSTATE,
00087 NCSP_ABP_STATE,
00088 NCSP_ABP_DISABLE,
00089 NCSP_ABP_FLAT,
00090 NCSP_ABP_NOREPEATMSG,
00091 };
00092
00093 enum mAbstractButtonPieceEvent {
00094 NCSN_ABP_CLICKED = ABP_EVENT_BEGIN,
00095 NCSN_ABP_STATE_CHANGED,
00096 NCSN_ABP_PUSHED,
00097 NCSN_ABP_DISABLED
00098 };
00099
00100 #ifdef __cplusplus
00101 }
00102 #endif
00103
00104 #endif
00105