-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAngularRegulator.h
106 lines (72 loc) · 2.82 KB
/
AngularRegulator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/////////////////////////////////////////////////////////////////////////////
// Name: AngularRegulator.h
// Purpose: wxIndustrialControls Library
// Author: Marco Cavallini <m.cavallini AT koansoftware.com>
// Modified by:
// Copyright: (C)2004-2006 Copyright by Koan s.a.s. - www.koansoftware.com
// Licence: KWIC License http://www.koansoftware.com/kwic/kwic-license.htm
/////////////////////////////////////////////////////////////////////////////
const int kwxEVT_ANGREG_FIRST = wxEVT_FIRST + 5402;
const wxEventType kwxEVT_ANGREG_CHANGE = kwxEVT_ANGREG_FIRST + 1;
#define EVT_ANGULARREG_CHANGE(id, fn) \
DECLARE_EVENT_TABLE_ENTRY(kwxEVT_ANGREG_CHANGE, id, -1, \
(wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&fn, \
(wxObject*)NULL ),
#define PGRECO (4.0 * atan(1.0))
class kwxAngularRegulator : public wxControl
{
public:
kwxAngularRegulator(void) { m_id = -1 ; };
kwxAngularRegulator(wxWindow* parent,
const wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const long int style) ;
virtual ~kwxAngularRegulator();
void SetRange(int min, int max) { m_nMin = min ; m_nMax = max ; } ;
void SetAngle(int min, int max) { m_nAngleStart = min ; m_nAngleEnd = max ; } ;
int GetValue() { return m_nRealVal ; } ;
void SetValue(int val) ;
void SetExtCircleColour(wxColour colour) { m_cExtCircle = colour ; } ;
void SetIntCircleColour(wxColour colour) { m_cIntCircle = colour ; } ;
void SetKnobBorderColour(wxColour colour) { m_cKnobBorderColour = colour ; } ;
void SetKnobColour(wxColour colour) { m_cKnobColour = colour ; } ;
void SetLimitsColour(wxColour colour) { m_cLimitsColour = colour ; } ;
void SetTagsColour(wxColour colour) { m_cTagsColour = colour ; } ;
void AddTag(int value) ;
private:
DECLARE_DYNAMIC_CLASS(kwxAngularRegulator)
DECLARE_EVENT_TABLE()
void DrawKnob(wxDC &temp_dc) ;
void DrawLimit(wxDC &temp_dc) ;
void DrawTags(wxDC &temp_dc) ;
void SetPosition() ;
double GetAngleFromCord(int cx, int cy) ;
void OnPaint(wxPaintEvent& event);
// void OnEraseBackGround(wxEraseEvent& event) {};
void OnMouse(wxMouseEvent& event) ;
wxWindowID GetID() { return m_id; } ;
wxWindowID m_id ;
int m_nStato ;
int m_nMin ;
int m_nMax ;
int m_nAngleStart ;
int m_nAngleEnd ;
double m_nScaledVal ;
double old_ang ;
int m_nRealVal ;
wxPoint m_mousePosition ;
wxColour m_cExtCircle ;
wxColour m_cIntCircle ;
wxColour m_cKnobBorderColour ;
wxColour m_cKnobColour ;
wxColour m_cTagsColour ;
wxColour m_cLimitsColour ;
int m_nClientWidth ;
int m_nClientHeight ;
int m_nTagsValue[20] ;
int m_nTags ;
double m_dxi ;
double m_dyi ;
wxBitmap *membitmap ;
} ;