43 #if defined (_MGNCSCTRL_SCROLLBAR) || defined (_MGNCSCTRL_TRACKBAR)
45 #ifndef _MGUI_NCSCTRL_SLIDERPIECE_H
46 #define _MGUI_NCSCTRL_SLIDERPIECE_H
52 typedef struct _mSliderPieceClass mSliderPieceClass;
53 typedef struct _mSliderPiece mSliderPiece;
55 #define mSliderPieceClassHeader(clss, superCls) \
56 mContainerPieceClassHeader(clss, superCls) \
57 int (*stepLine)(clss*, BOOL forward); \
58 int (*stepPage)(clss*, BOOL forward);
60 struct _mSliderPieceClass
62 mSliderPieceClassHeader(mSliderPiece, mContainerPiece)
65 MGNCS_EXPORT
extern mSliderPieceClass g_stmSliderPieceCls;
67 #define mSliderPieceHeader(clss) \
68 mContainerPieceHeader(clss) \
70 unsigned char flags; \
71 unsigned char thumb_state; \
72 unsigned short line_step; \
73 unsigned short page_step; \
74 unsigned short cur_pos; \
78 #define NCSS_SLIDERPIECE_VERT 0x01
79 #define NCSS_SLIDERPIECE_TICK 0x02
80 #define NCSS_SLIDERPIECE_MIN 0x04
81 #define NCSS_SLIDERPIECE_MAX 0x08
82 #define NCSS_SLIDERPIECE_CENTERTHUMB 0x10 //the start point at the center of thumb
84 #define mSliderPiece_setVert(self) (((self)->flags)|= NCSS_SLIDERPIECE_VERT)
85 #define mSliderPiece_setHorz(self) (((self)->flags)&= (~NCSS_SLIDERPIECE_VERT))
86 #define mSliderPiece_isVert(self) ((((self)->flags)&NCSS_SLIDERPIECE_VERT) == NCSS_SLIDERPIECE_VERT)
88 #define mSliderPiece_setTick(self) (((self)->flags)|=NCSS_SLIDERPIECE_TICK)
89 #define mSliderPiece_clearTick(self) (((self)->flags)&=(~NCSS_SLIDERPIECE_TICK))
90 #define mSliderPiece_isTick(self) (((self)->flags)&NCSS_SLIDERPIECE_TICK)
92 #define mSliderPiece_setMin(self) (((self)->flags)|=NCSS_SLIDERPIECE_MIN)
93 #define mSliderPiece_clearMin(self) (((self)->flags)&=(~NCSS_SLIDERPIECE_MIN))
94 #define mSliderPiece_isMin(self) ((self)->flags & NCSS_SLIDERPIECE_MIN)
96 #define mSliderPiece_setMax(self) (((self)->flags)|=NCSS_SLIDERPIECE_MAX)
97 #define mSliderPiece_clearMax(self) (((self)->flags)&=(~NCSS_SLIDERPIECE_MAX))
98 #define mSliderPiece_isMax(self) ((self)->flags & NCSS_SLIDERPIECE_MAX)
100 #define mSliderPiece_setCenterThumb(self) (((self)->flags) |= NCSS_SLIDERPIECE_CENTERTHUMB)
101 #define mSliderPiece_clearCenterThumb(self) (((self)->flags) &= (~NCSS_SLIDERPIECE_CENTERTHUMB))
102 #define mSliderPiece_isCenterThumb(self) ((self)->flags & NCSS_SLIDERPIECE_CENTERTHUMB)
106 mSliderPieceHeader(mSliderPiece)
109 enum mSliderPieceProps{
110 NCSP_SLIDERPIECE_POS = SLIDERPIECE_PROP_BEGIN,
111 NCSP_SLIDERPIECE_LINESTEP ,
112 NCSP_SLIDERPIECE_PAGESTEP ,
113 NCSP_SLIDERPIECE_MAX,
114 NCSP_SLIDERPIECE_MIN,
115 NCSP_SLIDERPIECE_TICK,
117 NCSP_SLIDERPIECE_DIRECTION = PIECECOMM_PROP_DIRECTION
120 enum mSliderPieceEvent
122 NCSN_SLIDERPIECE_POSCHANGED = SLIDERPIECE_EVENT_BEGIN,
123 NCSN_SLIDERPIECE_REACHMAX,
124 NCSN_SLIDERPIECE_REACHMIN
132 #endif //_MGNCSCTRL_SCROLLBAR _MGNCSCTRL_TRACKBAR