89 lines
2.5 KiB
C++
89 lines
2.5 KiB
C++
//---------------------------------------------------------------------------
|
|
|
|
#ifndef SkinScrollBarUnitH
|
|
#define SkinScrollBarUnitH
|
|
|
|
#define TIME_DELAY 200
|
|
#define TIME_NOTIFY 100
|
|
#define THUMB_BORDER 7
|
|
#define THUMB_MINSIZE (THUMB_BORDER * 2)
|
|
|
|
#define STATE_NORMAL 0
|
|
#define STATE_HIGHLIGHT 1
|
|
#define STATE_PUSH 2
|
|
|
|
class TSkinScrollBar : public TScrollBar
|
|
{
|
|
private:
|
|
int m_nTileHeight,
|
|
m_nThumbHeight,
|
|
m_nThumbTop,
|
|
m_nPreThumbTop,
|
|
m_nDragPos,
|
|
m_nDragPoint,
|
|
m_iClicked,
|
|
m_iHitPrev,
|
|
m_nMax,
|
|
m_nMin,
|
|
m_nPos,
|
|
m_nPage,
|
|
m_nTrackPos,
|
|
m_wBar;
|
|
|
|
bool m_bPause,
|
|
m_bNotify,
|
|
m_bDrag,
|
|
m_bTrace;
|
|
|
|
TTimer *m_pTimer;
|
|
TCanvas *m_pCanvas;
|
|
|
|
int HitTest( int X, int Y );
|
|
void CalcThumbHeight();
|
|
void CalcThumbTop();
|
|
void DrawArrow( int iDirection, int iState );
|
|
void DrawThumb( int iState, bool bEraseBk );
|
|
|
|
void __fastcall TimerProc(TObject* Sender);
|
|
|
|
MESSAGE void __fastcall WMPaint(Winapi::Messages::TWMPaint &Message);
|
|
MESSAGE void __fastcall WMLButtonDown(TWMMouse &Message);
|
|
MESSAGE void __fastcall WMLButtonUp(TWMMouse &Message);
|
|
MESSAGE void __fastcall WMLButtonDblClk(TWMMouse &Message);
|
|
MESSAGE void __fastcall WMMouseMove(TWMMouse &Message);
|
|
MESSAGE void __fastcall CMMouseLeave(TMessage &Message);
|
|
MESSAGE void __fastcall SBMSetScrollInfo(TMessage &Message);
|
|
MESSAGE void __fastcall SBMGetScrollInfo(TMessage &Message);
|
|
|
|
BEGIN_MESSAGE_MAP
|
|
MESSAGE_HANDLER(WM_PAINT, TWMPaint, WMPaint)
|
|
MESSAGE_HANDLER(WM_LBUTTONDOWN, TWMLButtonDown, WMLButtonDown)
|
|
MESSAGE_HANDLER(WM_LBUTTONUP, TWMLButtonUp, WMLButtonUp)
|
|
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, TWMLButtonDblClk, WMLButtonDblClk)
|
|
MESSAGE_HANDLER(WM_MOUSEMOVE, TWMMouseMove, WMMouseMove)
|
|
MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)
|
|
MESSAGE_HANDLER(SBM_SETSCROLLINFO, TMessage, SBMSetScrollInfo)
|
|
MESSAGE_HANDLER(SBM_GETSCROLLINFO, TMessage, SBMGetScrollInfo)
|
|
END_MESSAGE_MAP(TScrollBar)
|
|
|
|
protected:
|
|
virtual void __fastcall PaintWindow(HDC DC);
|
|
|
|
public:
|
|
TWinControl *m_pWndCtrl;
|
|
bool m_bAction;
|
|
|
|
__fastcall virtual TSkinScrollBar(System::Classes::TComponent* AOwner);
|
|
__fastcall ~TSkinScrollBar();
|
|
bool IsDraging(){ return m_bDrag; };
|
|
void __fastcall SetPosition(int Value, bool bRedraw=true);
|
|
void __fastcall SetPageSize(int Value, bool bRedraw=true);
|
|
void __fastcall SetRange(int AMin, int AMax, bool bRedraw=true);
|
|
void __fastcall GetScrollRange(int* nMin, int* nMax);
|
|
int __fastcall GetScrollPos();
|
|
int __fastcall GetPageSize();
|
|
};
|
|
|
|
//---------------------------------------------------------------------------
|
|
#endif
|