msliderpiece.h
00001 #if defined (_MGNCSCTRL_SCROLLBAR) || defined (_MGNCSCTRL_TRACKBAR)
00002
00003 #ifndef _MGUI_NCSCTRL_SLIDERPIECE_H
00004 #define _MGUI_NCSCTRL_SLIDERPIECE_H
00005
00006 #ifdef __cplusplus
00007 extern "C" {
00008 #endif
00009
00010 typedef struct _mSliderPieceClass mSliderPieceClass;
00011 typedef struct _mSliderPiece mSliderPiece;
00012
00013 #define mSliderPieceClassHeader(clss, superCls) \
00014 mContainerPieceClassHeader(clss, superCls) \
00015 int (*stepLine)(clss*, BOOL forward); \
00016 int (*stepPage)(clss*, BOOL forward);
00017
00018 struct _mSliderPieceClass
00019 {
00020 mSliderPieceClassHeader(mSliderPiece, mContainerPiece)
00021 };
00022
00023 MGNCS_EXPORT extern mSliderPieceClass g_stmSliderPieceCls;
00024
00025 #define mSliderPieceHeader(clss) \
00026 mContainerPieceHeader(clss) \
00027 mHotPiece * thumb; \
00028 unsigned char flags; \
00029 unsigned char thumb_state; \
00030 unsigned short line_step; \
00031 unsigned short page_step; \
00032 unsigned short cur_pos; \
00033 unsigned short min; \
00034 unsigned short max;
00035
00036 #define NCSS_SLIDERPIECE_VERT 0x01
00037 #define NCSS_SLIDERPIECE_TICK 0x02
00038 #define NCSS_SLIDERPIECE_MIN 0x04
00039 #define NCSS_SLIDERPIECE_MAX 0x08
00040 #define NCSS_SLIDERPIECE_CENTERTHUMB 0x10 //the start point at the center of thumb
00041
00042 #define mSliderPiece_setVert(self) (((self)->flags)|= NCSS_SLIDERPIECE_VERT)
00043 #define mSliderPiece_setHorz(self) (((self)->flags)&= (~NCSS_SLIDERPIECE_VERT))
00044 #define mSliderPiece_isVert(self) ((((self)->flags)&NCSS_SLIDERPIECE_VERT) == NCSS_SLIDERPIECE_VERT)
00045
00046 #define mSliderPiece_setTick(self) (((self)->flags)|=NCSS_SLIDERPIECE_TICK)
00047 #define mSliderPiece_clearTick(self) (((self)->flags)&=(~NCSS_SLIDERPIECE_TICK))
00048 #define mSliderPiece_isTick(self) (((self)->flags)&NCSS_SLIDERPIECE_TICK)
00049
00050 #define mSliderPiece_setMin(self) (((self)->flags)|=NCSS_SLIDERPIECE_MIN)
00051 #define mSliderPiece_clearMin(self) (((self)->flags)&=(~NCSS_SLIDERPIECE_MIN))
00052 #define mSliderPiece_isMin(self) ((self)->flags & NCSS_SLIDERPIECE_MIN)
00053
00054 #define mSliderPiece_setMax(self) (((self)->flags)|=NCSS_SLIDERPIECE_MAX)
00055 #define mSliderPiece_clearMax(self) (((self)->flags)&=(~NCSS_SLIDERPIECE_MAX))
00056 #define mSliderPiece_isMax(self) ((self)->flags & NCSS_SLIDERPIECE_MAX)
00057
00058 #define mSliderPiece_setCenterThumb(self) (((self)->flags) |= NCSS_SLIDERPIECE_CENTERTHUMB)
00059 #define mSliderPiece_clearCenterThumb(self) (((self)->flags) &= (~NCSS_SLIDERPIECE_CENTERTHUMB))
00060 #define mSliderPiece_isCenterThumb(self) ((self)->flags & NCSS_SLIDERPIECE_CENTERTHUMB)
00061
00062 struct _mSliderPiece
00063 {
00064 mSliderPieceHeader(mSliderPiece)
00065 };
00066
00067 enum mSliderPieceProps{
00068 NCSP_SLIDERPIECE_POS = SLIDERPIECE_PROP_BEGIN,
00069 NCSP_SLIDERPIECE_LINESTEP ,
00070 NCSP_SLIDERPIECE_PAGESTEP ,
00071 NCSP_SLIDERPIECE_MAX,
00072 NCSP_SLIDERPIECE_MIN,
00073 NCSP_SLIDERPIECE_TICK,
00074
00075 NCSP_SLIDERPIECE_DIRECTION = PIECECOMM_PROP_DIRECTION
00076 };
00077
00078 enum mSliderPieceEvent
00079 {
00080 NCSN_SLIDERPIECE_POSCHANGED = SLIDERPIECE_EVENT_BEGIN,
00081 NCSN_SLIDERPIECE_REACHMAX,
00082 NCSN_SLIDERPIECE_REACHMIN
00083 };
00084
00085 #ifdef __cplusplus
00086 }
00087 #endif
00088
00089 #endif
00090 #endif //_MGNCSCTRL_SCROLLBAR _MGNCSCTRL_TRACKBAR