diff --git a/Library/Meter.cpp b/Library/Meter.cpp index 1fa042a4..770dbb2e 100644 --- a/Library/Meter.cpp +++ b/Library/Meter.cpp @@ -64,6 +64,8 @@ CMeter::CMeter(CMeterWindow* meterWindow) m_AntiAlias = false; m_DynamicVariables = false; m_Initialized = false; + m_HasMouseAction = false; + m_MouseActionCursor = true; } /* @@ -271,6 +273,15 @@ void CMeter::ReadConfig(const WCHAR* section) m_MouseOverAction = parser.ReadString(section, L"MouseOverAction", L""); m_MouseLeaveAction = parser.ReadString(section, L"MouseLeaveAction", L""); + m_MouseActionCursor = 0!= parser.ReadInt(section, L"MouseActionCursor", 1); + + if(!m_MiddleMouseUpAction.empty() || !m_MiddleMouseDownAction.empty() + || !m_LeftMouseUpAction.empty() || !m_LeftMouseDownAction.empty() + || !m_RightMouseUpAction.empty() || !m_RightMouseDownAction.empty() ) + { + m_HasMouseAction = true; + } + m_MeasureName = parser.ReadString(section, L"MeasureName", L""); m_UpdateDivider = parser.ReadInt(section, L"UpdateDivider", 1); diff --git a/Library/Meter.h b/Library/Meter.h index c7874714..b3020ebd 100644 --- a/Library/Meter.h +++ b/Library/Meter.h @@ -59,6 +59,9 @@ public: std::wstring& GetMouseOverAction() { return m_MouseOverAction; }; std::wstring& GetMouseLeaveAction() { return m_MouseLeaveAction; }; + bool HasMouseAction() { return m_HasMouseAction; }; + bool HasMouseActionCursor() { return m_MouseActionCursor; }; + void Hide() { m_Hidden = true; }; void Show() { m_Hidden = false; }; bool IsHidden() { return m_Hidden; }; @@ -74,7 +77,7 @@ public: const WCHAR* GetName() { return m_Name.c_str(); }; static CMeter* Create(const WCHAR* meter, CMeterWindow* meterWindow); - + static void DrawBevel(Gdiplus::Graphics& graphics, Gdiplus::Rect& rect, Gdiplus::Pen& light, Gdiplus::Pen& dark); protected: @@ -116,6 +119,9 @@ protected: std::wstring m_MiddleMouseUpAction; std::wstring m_MouseOverAction; std::wstring m_MouseLeaveAction; + + bool m_HasMouseAction; + bool m_MouseActionCursor; bool m_MouseOver; METER_POSITION m_RelativeX; diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index a9ef54b9..1487c3ca 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2430,6 +2430,7 @@ LRESULT CMeterWindow::OnMouseMove(WPARAM wParam, LPARAM lParam) // Handle buttons bool redraw = false; + bool drawCursor = false; std::list::iterator j = m_Meters.begin(); for( ; j != m_Meters.end(); j++) { @@ -2441,7 +2442,18 @@ LRESULT CMeterWindow::OnMouseMove(WPARAM wParam, LPARAM lParam) { redraw |= button->MouseMove(pos); } + + if((*j)->HitTest(pos.x, pos.y) && (*j)->HasMouseActionCursor()) + { + drawCursor = ((*j)->HasMouseAction() || button); + } } + + if(drawCursor) + SetCursor(LoadCursor(NULL, IDC_HAND)); + else + SetCursor(LoadCursor(NULL, IDC_ARROW)); + if (redraw) { Redraw(); @@ -2856,6 +2868,7 @@ LRESULT CMeterWindow::OnLeftButtonDown(WPARAM wParam, LPARAM lParam) { redraw |= button->MouseDown(pos); } + } if (redraw) {