FLImaging 6.5.8.1
GUISliderOwnerDrawnBase.h
1#pragma once
2#include "GUIDefinitions.h"
3
4namespace FLImaging
5{
6 namespace GUI
7 {
8 class FL_EXPORT CGUISliderOwnerDrawnBase
9 {
10 public:
11 CGUISliderOwnerDrawnBase(CWnd* pParentWnd, EOrientation eOrientation = EOrientation_Vertical);
12 virtual ~CGUISliderOwnerDrawnBase();
13
14 virtual void SetOrientation(EOrientation eOrientation);
15 virtual EOrientation GetOrientation() const;
16
17 virtual void SetColorThumb(COLORREF clrThumb, COLORREF clrThumbHilight);
18 virtual void GetColorThumb(COLORREF& clrThumb, COLORREF& clrThumbHilight) const;
19
20 virtual void SetColorBar(COLORREF clrBar, COLORREF clrBarHilight);
21 virtual void GetColorBar(COLORREF& clrBar, COLORREF& clrBarHilight) const;
22
23 virtual ESliderArea HitTest(const CPoint& ptPoint) const;
24 virtual void SetHitArea(ESliderArea eHitArea, bool bRedraw = true);
25 virtual ESliderArea GetHitArea()const;
26 virtual void SetSelectedArea(ESliderArea eSelArea, bool bRedraw = true);
27 virtual ESliderArea GetSelectedArea()const;
28
29 virtual const CRect GetBarRect() const;
30 virtual const CRect GetThumbRect() const;
31 virtual const CRect GetThumbMinRect() const;
32 virtual const CRect GetThumbMaxRect() const;
33
34 virtual bool IsLButtonDown() const;
35
36 virtual bool IsVisible() const;
37 virtual void Show(bool bShow);
38
39 virtual void Enable(bool bEnable);
40 virtual bool IsEnabled() const;
41
51 virtual void OnLButtonDown(const CPoint& ptPoint);
52
62 virtual void OnLButtonUp(const CPoint& ptPoint);
63
73 virtual void OnMouseMove(const CPoint& ptPoint);
74
75 virtual void SetOwner(void* pOwner);
76 virtual void* GetOwner() const;
77
78 virtual void UpdateSlider();
79 virtual const CResult CalcSliderRegion(CRect* pRect);
80
81 virtual void Draw(CDC* pDC) const;
82
83 virtual int32_t GetPos() const;
84 virtual int32_t GetPosOnLButtonDown() const;
85 virtual CPoint GetPointOnLButtonDown() const;
86 virtual void SetPos(int32_t i32Pos, bool bSetValue, bool bSendMsg, bool bRedraw);
87
106 virtual const CResult SetCallbackTriggerMode(ECallbackTriggerMode eMode = ECallbackTriggerMode_OnDrag);
107
122 virtual ECallbackTriggerMode GetCallbackTriggerMode() const;
123
124 protected:
125 CWnd* m_pParentWnd;
126 void* m_pOwner;
127
128 ESliderArea m_eHitArea;
129 ESliderArea m_eSelectedArea;
130 EOrientation m_eOrientation;
131 ECallbackTriggerMode m_eCallbackTriggerMode;
132
133 CPoint m_ptPointPrev;
134 CPoint m_ptLButtonDown;
135
136 CRect m_rtThumb;
137 CRect m_rtThumbMin;
138 CRect m_rtThumbMax;
139
140 CRect m_rtBar;
141 int32_t m_i32ThumbSize;
142
143 int32_t m_i32Pos; // current position. range [0, m_rtBar.Width()] (in case of horz bar)
144 int32_t m_i32PosOnLBtnDown;
145 int32_t m_i32ScrollRange;
146 int32_t m_i32PosOfZero;
147
148 bool m_bShow;
149 bool m_bEnable;
150 bool m_bLButtonDown;
151
152 double m_f64SectionWidth; // the width of a section. It is m_rtBar.Width() / section count (in case of horz bar)
153 double m_f64PixelsPerValue; // How many pixels correspond to value (1)
154 double m_f64ValuePerPixel; // How much value corresponds to one pixel
155
156 COLORREF m_clrThumb;
157 COLORREF m_clrThumbHilight;
158 COLORREF m_clrBar;
159 COLORREF m_clrBarHilight;
160 };
161
162 struct FL_EXPORT NM_SLIDER
163 {
164 NM_SLIDER() :pCaller(nullptr), pOwner(nullptr), i32Pos(-1), bMinPosChanged(false), bMaxPosChanged(false){}
165 CGUISliderOwnerDrawnBase* pCaller;
166 void* pOwner;
167 int32_t i32Pos;
168 bool bMinPosChanged;
169 bool bMaxPosChanged;
170 };
171 }
172}
ECallbackTriggerMode
Definition GUIDefinitions.h:10756
EOrientation
Direction.
Definition GUIDefinitions.h:5467
ESliderArea
Scroll Bar Area.
Definition GUIDefinitions.h:9851